mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-25 19:46:55 +08:00
Refactor Network Usage
Continuing from PR #4968, this update improves how Stockfish handles network usage, making it easier to manage and modify networks in the future. With the introduction of a dedicated Network class, creating networks has become straightforward. See uci.cpp: ```cpp NN::NetworkBig({EvalFileDefaultNameBig, "None", ""}, NN::embeddedNNUEBig) ``` The new `Network` encapsulates all network-related logic, significantly reducing the complexity previously required to support multiple network types, such as the distinction between small and big networks #4915. Non-Regression STC: https://tests.stockfishchess.org/tests/view/65edd26c0ec64f0526c43584 LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 33760 W: 8887 L: 8661 D: 16212 Ptnml(0-2): 143, 3795, 8808, 3961, 173 Non-Regression SMP STC: https://tests.stockfishchess.org/tests/view/65ed71970ec64f0526c42fdd LLR: 2.96 (-2.94,2.94) <-1.75,0.25> Total: 59088 W: 15121 L: 14931 D: 29036 Ptnml(0-2): 110, 6640, 15829, 6880, 85 Compiled with `make -j profile-build` ``` bash ./bench_parallel.sh ./stockfish ./stockfish-nnue 13 50 sf_base = 1568540 +/- 7637 (95%) sf_test = 1573129 +/- 7301 (95%) diff = 4589 +/- 8720 (95%) speedup = 0.29260% +/- 0.556% (95%) ``` Compiled with `make -j build` ``` bash ./bench_parallel.sh ./stockfish ./stockfish-nnue 13 50 sf_base = 1472653 +/- 7293 (95%) sf_test = 1491928 +/- 7661 (95%) diff = 19275 +/- 7154 (95%) speedup = 1.30886% +/- 0.486% (95%) ``` closes https://github.com/official-stockfish/Stockfish/pull/5100 No functional change
This commit is contained in:
17
src/thread.h
17
src/thread.h
@@ -33,6 +33,7 @@
|
||||
|
||||
namespace Stockfish {
|
||||
|
||||
|
||||
class OptionsMap;
|
||||
using Value = int;
|
||||
|
||||
@@ -83,15 +84,13 @@ class ThreadPool {
|
||||
void clear();
|
||||
void set(Search::SharedState);
|
||||
|
||||
Search::SearchManager* main_manager() const {
|
||||
return static_cast<Search::SearchManager*>(main_thread()->worker.get()->manager.get());
|
||||
};
|
||||
Thread* main_thread() const { return threads.front(); }
|
||||
uint64_t nodes_searched() const { return accumulate(&Search::Worker::nodes); }
|
||||
uint64_t tb_hits() const { return accumulate(&Search::Worker::tbHits); }
|
||||
Thread* get_best_thread() const;
|
||||
void start_searching();
|
||||
void wait_for_search_finished() const;
|
||||
Search::SearchManager* main_manager();
|
||||
Thread* main_thread() const { return threads.front(); }
|
||||
uint64_t nodes_searched() const;
|
||||
uint64_t tb_hits() const;
|
||||
Thread* get_best_thread() const;
|
||||
void start_searching();
|
||||
void wait_for_search_finished() const;
|
||||
|
||||
std::atomic_bool stop, abortedSearch, increaseDepth;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user