SF branching factor
Moderators: hgm, Rebel, chrisw
-
- Posts: 3286
- Joined: Wed Mar 08, 2006 8:15 pm
SF branching factor
With latest version I notice, that branching factor is about 1,25. Really impressive value! Before NNUE it was about 1,4. It was about same with 1 and 6 cores up to 40 plies. So the number of threads don't effect bf?
Jouni
-
- Posts: 1796
- Joined: Thu Sep 18, 2008 10:24 pm
Re: SF branching factor
Virtually certain it does on SF Cluster, don't know about the normal version.
Has this lower BF lowered tactical ability?
Has this lower BF lowered tactical ability?
-
- Posts: 5565
- Joined: Tue Feb 28, 2012 11:56 pm
Re: SF branching factor
More search threads will take more nodes to reach the same depth, but this does not increase the branching factor.
Suppose 8 threads search the same tree completely independently. They will need exactly 8x as many nodes to reach the same depth. The multiplication factor going from depth N to depth N+1 will be the same as for one thread, since 8/8 = 1.
-
- Posts: 3286
- Joined: Wed Mar 08, 2006 8:15 pm
Re: SF branching factor
I forgot to say I tested in opening position. But I remember to read, that with more threads SF does more elaborate search e.g. less reductions. True/false?
Jouni
-
- Posts: 4317
- Joined: Tue Apr 03, 2012 4:28 pm
-
- Posts: 5565
- Joined: Tue Feb 28, 2012 11:56 pm
Re: SF branching factor
I don't think SF really takes into account the number of search threads when deciding on reductions and pruning. However, I would have to check the code to be sure about this.
If you have many threads searching, different threads will make different pruning and reduction decisions (because they have different information available to them), but this should not influence the branching factor.
With many search threads, some threads will be able to skip parts of the tree because the hash table already has the outcome, but this also cannot change the branching factor (you can't have superlinear speedup).
-
- Posts: 4317
- Joined: Tue Apr 03, 2012 4:28 pm
Re: SF branching factor
SF is increasing reductions with thread count. I guess the rationale is that you can reduce more because chances are that other threads in similar situation will order moves differently and thus a possible late “missed” move would be “unmissed” elsewhere, get a chance to fail high and enter the global hash for all threads to maybe discover.
- /// Search::init() is called at startup to initialize various lookup tables
void Search::init() {
for (int i = 1; i < MAX_MOVES; ++i)
Reductions = int((20.26 + std::log(Threads.size()) / 2) * std::log(i));
}
If you have many threads searching, different threads will make different pruning and reduction decisions (because they have different information available to them), but this should not influence the branching factor.
With many search threads, some threads will be able to skip parts of the tree because the hash table already has the outcome, but this also cannot change the branching factor (you can't have superlinear speedup).
-
- Posts: 5565
- Joined: Tue Feb 28, 2012 11:56 pm
Re: SF branching factor
But it does:
Code: Select all
void Search::init() {
for (int i = 1; i < MAX_MOVES; ++i)
Reductions[i] = int((20.26 + std::log(Threads.size()) / 2) * std::log(i));
}
But this effect seems to be quite small. Even with 64 threads, 20.26 + log(64) is just 22.066. (This could be tested using a single thread by replacing Threads.size() with 64 in this line of search.cpp.)
edit: I now see that Chris already pointed this out
-
- Posts: 5565
- Joined: Tue Feb 28, 2012 11:56 pm
Re: SF branching factor
Yes, I now remember that that was the intuitive reasoning, and I guess it helped in tests.chrisw wrote: ↑Tue Dec 06, 2022 5:52 pmSF is increasing reductions with thread count. I guess the rationale is that you can reduce more because chances are that other threads in similar situation will order moves differently and thus a possible late “missed” move would be “unmissed” elsewhere, get a chance to fail high and enter the global hash for all threads to maybe discover.
But I do wonder. If this indeed decreaes the branching factor, then if you get deep enough into the search, you will spend much fewer total nodes on each depth than a single-threaded search. (And those total nodes are from multiple threads, so are worth less.)
Perhaps the increase in reductions should only be applied at lower depths.
-
- Posts: 3286
- Joined: Wed Mar 08, 2006 8:15 pm
Re: SF branching factor
But how to explain this from pro deo forum!?
The test was run with the Stockfish bench mark command for Stockfish 15.
bench 1024 32 26 default depth nnue - Threadripper
bench 1024 8 26 default depth nnue - $1500 Laptop.
Theadripper Results.
NPS = 21,956,331
$1500 Laptop Results.
NPS = 13,699,948
The Threadripper is 1.6x faster in NPS. If your conclusion is the Threadripper is the faster computer running Stockfish. You would be dead wrong.
Solve time to complete the benchmark.
$1500 Laptop Total Solve Time Results.
Total Time (ms) 110,731
Threadripper Total Solve Time Results.
Total Time (ms) 199,936
The $1500 Laptop is 1.8x faster in completing the benchmark test.
The test was run with the Stockfish bench mark command for Stockfish 15.
bench 1024 32 26 default depth nnue - Threadripper
bench 1024 8 26 default depth nnue - $1500 Laptop.
Theadripper Results.
NPS = 21,956,331
$1500 Laptop Results.
NPS = 13,699,948
The Threadripper is 1.6x faster in NPS. If your conclusion is the Threadripper is the faster computer running Stockfish. You would be dead wrong.
Solve time to complete the benchmark.
$1500 Laptop Total Solve Time Results.
Total Time (ms) 110,731
Threadripper Total Solve Time Results.
Total Time (ms) 199,936
The $1500 Laptop is 1.8x faster in completing the benchmark test.
Jouni