]> git.sesse.net Git - stockfish/commitdiff
Adjust reductions based on the number of threads
authorJoost VandeVondele <Joost.VandeVondele@gmail.com>
Wed, 25 Sep 2019 19:24:05 +0000 (21:24 +0200)
committerStéphane Nicolet <cassio@free.fr>
Tue, 1 Oct 2019 23:43:02 +0000 (01:43 +0200)
In lazySMP it makes sense to prune a little more, as multiple threads
search wider. We thus increase the prefactor of the reductions slowly
as a function of the threads. The prefactor of the log(threads) term
is a parameter, this pull request uses 1/2 after testing.

passed STC @ 8threads:
LLR: 2.96 (-2.94,2.94) [0.50,4.50]
Total: 118125 W: 23151 L: 22462 D: 72512
http://tests.stockfishchess.org/tests/view/5d8bbf4d0ebc59509180f217

passed LTC @ 8threads:
LLR: 2.95 (-2.94,2.94) [0.00,3.50]
Total: 67546 W: 10630 L: 10279 D: 46637
http://tests.stockfishchess.org/tests/view/5d8c463b0ebc5950918167e8

passed ~LTC @ 14threads:
LLR: 2.95 (-2.94,2.94) [0.00,3.50]
Total: 74271 W: 12421 L: 12040 D: 49810
http://tests.stockfishchess.org/tests/view/5d8db1f50ebc590f3beb24ef

Note:
A larger prefactor (1) passed similar tests at STC and LTC (8 threads),
while a very large one (2) passed STC quickly but failed LTC (8 threads).

For the single-threaded case there is no functional change.

Closes https://github.com/official-stockfish/Stockfish/pull/2337

Bench: 4088701

Fixup: remove redundant code.

src/main.cpp
src/search.cpp
src/thread.cpp

index f94a322c4afc5fedca652c5e453866d35dee41e3..40081e8d0c24f7db6a31133f0713717c38f92066 100644 (file)
@@ -43,7 +43,6 @@ int main(int argc, char* argv[]) {
   Position::init();
   Bitbases::init();
   Endgames::init();
   Position::init();
   Bitbases::init();
   Endgames::init();
-  Search::init();
   Threads.set(Options["Threads"]);
   Search::clear(); // After threads are up
 
   Threads.set(Options["Threads"]);
   Search::clear(); // After threads are up
 
index d34e182392843b4874a07b1b5858610a4e78a143..55df6172c64c779d890431bc6f0f42abab2cc9fb 100644 (file)
@@ -191,7 +191,7 @@ namespace {
 void Search::init() {
 
   for (int i = 1; i < MAX_MOVES; ++i)
 void Search::init() {
 
   for (int i = 1; i < MAX_MOVES; ++i)
-      Reductions[i] = int(23.4 * std::log(i));
+      Reductions[i] = int((23.4 + std::log(Threads.size()) / 2) * std::log(i));
 }
 
 
 }
 
 
index f7445f98ca4cbbb7b9bfab48acfff7251a5a96ed..90ec274d82052827dda6bd891534bd69e523b4f5 100644 (file)
@@ -148,6 +148,9 @@ void ThreadPool::set(size_t requested) {
 
       // Reallocate the hash with the new threadpool size
       TT.resize(Options["Hash"]);
 
       // Reallocate the hash with the new threadpool size
       TT.resize(Options["Hash"]);
+
+      // Init thread number dependent search params.
+      Search::init();
   }
 }
 
   }
 }