1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Clear Workers after changing the network

ensures internal state (e.g. accumulator cache) is consistent with network

closes https://github.com/official-stockfish/Stockfish/pull/5204

No functional change
This commit is contained in:
Disservin 2024-05-01 15:10:23 +02:00 committed by Joost VandeVondele
parent be142337d8
commit be026bdcb2
2 changed files with 10 additions and 3 deletions

View file

@ -141,14 +141,18 @@ void Engine::verify_networks() const {
}
void Engine::load_networks() {
networks.big.load(binaryDirectory, options["EvalFile"]);
networks.small.load(binaryDirectory, options["EvalFileSmall"]);
load_big_network(options["EvalFile"]);
load_small_network(options["EvalFileSmall"]);
}
void Engine::load_big_network(const std::string& file) { networks.big.load(binaryDirectory, file); }
void Engine::load_big_network(const std::string& file) {
networks.big.load(binaryDirectory, file);
threads.clear();
}
void Engine::load_small_network(const std::string& file) {
networks.small.load(binaryDirectory, file);
threads.clear();
}
void Engine::save_network(const std::pair<std::optional<std::string>, std::string> files[2]) {

View file

@ -161,6 +161,9 @@ void ThreadPool::clear() {
for (Thread* th : threads)
th->worker->clear();
if (threads.size() == 0)
return;
main_manager()->callsCnt = 0;
main_manager()->bestPreviousScore = VALUE_INFINITE;
main_manager()->bestPreviousAverageScore = VALUE_INFINITE;