Allow more than 1024 threads on high-end machines

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

No functional change
This commit is contained in:
Robert Nurnberg @ elitebook
2025-03-14 20:32:38 +01:00
committed by Disservin
parent 4afd7f1a7b
commit 652a8874b5

View File

@@ -18,6 +18,7 @@
#include "engine.h"
#include <algorithm>
#include <cassert>
#include <deque>
#include <iosfwd>
@@ -32,6 +33,7 @@
#include "misc.h"
#include "nnue/network.h"
#include "nnue/nnue_common.h"
#include "numa.h"
#include "perft.h"
#include "position.h"
#include "search.h"
@@ -46,6 +48,7 @@ namespace NN = Eval::NNUE;
constexpr auto StartFEN = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
constexpr int MaxHashMB = Is64Bit ? 33554432 : 2048;
int MaxThreads = std::max(1024, 4 * int(get_hardware_concurrency()));
Engine::Engine(std::optional<std::string> path) :
binaryDirectory(path ? CommandLine::get_binary_directory(*path) : ""),
@@ -74,7 +77,7 @@ Engine::Engine(std::optional<std::string> path) :
}));
options.add( //
"Threads", Option(1, 1, 1024, [this](const Option&) {
"Threads", Option(1, 1, MaxThreads, [this](const Option&) {
resize_threads();
return thread_allocation_information_as_string();
}));