Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parallel search with shared transposition table #9

Merged
merged 16 commits into from
Oct 15, 2017

Conversation

vinc
Copy link
Owner

@vinc vinc commented Oct 13, 2017

See #8

@vinc vinc self-assigned this Oct 13, 2017
@vinc
Copy link
Owner Author

vinc commented Oct 13, 2017

SharedTranspositions is a bit of a hack because it implements Sync without making sure that the inner UnsafeCell<Transpositions> is thread safe. But it allows Arc<SharedTranspositions> to share the transposition table between threads.

An improvement would be to only share entries of Transposition, so that all threads can access the same Box<[Transposition]> and we could then put some sort of lock on Transpositions#set.

@vinc
Copy link
Owner Author

vinc commented Oct 13, 2017

The build fail on rust 1.20.0 but should pass on the next stable version.

@vinc vinc force-pushed the feature-parallel-search branch from 1d26ce8 to b14a293 Compare October 14, 2017 06:46
@vinc
Copy link
Owner Author

vinc commented Oct 14, 2017

Rust 1.21.0 is now stable and it fixes compile errors about Clone not implemented for big arrays.

@vinc
Copy link
Owner Author

vinc commented Oct 14, 2017

The search threads need a stack size of at least 4 MB so the default at 2 MB had to be increased to fix stack overflow.

@vinc
Copy link
Owner Author

vinc commented Oct 14, 2017

Something is not yet right with this PR, increasing the number of threads doesn't make the engine any faster, and it's even weaker on one thread when it shouldn't be.

$ cutechess-cli \
  -engine cmd=littlewing-v0.3.0-26-gfab2928 \
  -engine cmd=littlewing-v0.3.0-18-g441470e \
  -each proto=xboard tc=40/10+0.1 \
  -sprt elo0=0 elo1=5 alpha=0.05 beta=0.05 \
  -openings file=2moves.pgn -repeat -rounds 10000 \
  -pgnout games.pgn -concurrency 8
...
Score of Little Wing v0.3.0-26-gfab2928 vs Little Wing v0.3.0-18-g441470e: 338 - 501 - 168  [0.419] 1007
Elo difference: -56.74 +/- 19.79
SPRT: llr -2.96, lbound -2.94, ubound 2.94 - H0 was accepted
Finished match

@vinc vinc force-pushed the feature-parallel-search branch from 041eb3a to 9922948 Compare October 15, 2017 11:00
@vinc
Copy link
Owner Author

vinc commented Oct 15, 2017

The bugs have been removed and the code cleaned up, but more work is to be done on the SMP code to see any positive results with more threads.

Score of Little Wing v0.3.0-31-ge3629c2 vs Little Wing v0.3.0-18-g441470e: 508 - 503 - 295  [0.502] 1306
Elo difference: 1.33 +/- 16.57
SPRT: llr -0.0817, lbound -2.94, ubound 2.94
Finished match
Score of Little Wing v0.3.0-33-g2b35191 vs Little Wing v0.3.0-18-g441470e: 1563 - 1611 - 924  [0.494] 4098
Elo difference: -4.07 +/- 9.35
SPRT: llr -1.44, lbound -2.94, ubound 2.94
Finished match
Score of Little Wing v0.3.0-34-g9922948 vs Little Wing v0.3.0-18-g441470e: 948 - 1008 - 554  [0.488] 2510
Elo difference: -8.31 +/- 11.99
SPRT: llr -1.44, lbound -2.94, ubound 2.94
Finished match

@vinc vinc merged commit de6c9b5 into master Oct 15, 2017
@vinc vinc deleted the feature-parallel-search branch October 15, 2017 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant