]> git.sesse.net Git - stockfish/commit
Upon changing the number of threads, make sure all threads are bound
authorJoost VandeVondele <Joost.VandeVondele@gmail.com>
Tue, 26 Dec 2017 09:40:42 +0000 (10:40 +0100)
committerMarco Costalba <mcostalba@users.noreply.github.com>
Tue, 26 Dec 2017 09:40:42 +0000 (10:40 +0100)
commit1c50d8cbf554733c0db6ab423b413d75cc0c1928
tree498cc79f689be71684e9c7a21416bd42315d13c7
parent2198cd0524574f0d9df8c0ec9aaf14ad8c94402b
Upon changing the number of threads, make sure all threads are bound

The heuristic to avoid thread binding if less than 8 threads are requested resulted in the first 7 threads not being bound.
The branch was verified to yield a roughly 13% speedup by @CoffeeOne on the appropriate hardware and OS, and an earlier version of this patch tested well on his machine:

http://tests.stockfishchess.org/tests/view/5a3693480ebc590ccbb8be5a
ELO: 9.24 +-4.6 (95%) LOS: 100.0%
Total: 5000 W: 634 L: 501 D: 3865

To make sure all threads (including mainThread) are bound as soon as the total number exceeds 7, recreate all threads on a change of thread number.
To do this, unify Threads::init, Threads::exit and Threads::set are unified in a single Threads::set function that goes through the needed steps.
The code includes several suggestions from @joergoster.

Fixes issue #1312

No functional change
src/main.cpp
src/misc.cpp
src/search.cpp
src/thread.cpp
src/thread.h