mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-06 10:53:50 +08:00
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:
committed by
Disservin
parent
4afd7f1a7b
commit
652a8874b5
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
@@ -32,6 +33,7 @@
|
|||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "nnue/network.h"
|
#include "nnue/network.h"
|
||||||
#include "nnue/nnue_common.h"
|
#include "nnue/nnue_common.h"
|
||||||
|
#include "numa.h"
|
||||||
#include "perft.h"
|
#include "perft.h"
|
||||||
#include "position.h"
|
#include "position.h"
|
||||||
#include "search.h"
|
#include "search.h"
|
||||||
@@ -44,8 +46,9 @@ namespace Stockfish {
|
|||||||
|
|
||||||
namespace NN = Eval::NNUE;
|
namespace NN = Eval::NNUE;
|
||||||
|
|
||||||
constexpr auto StartFEN = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
|
constexpr auto StartFEN = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
|
||||||
constexpr int MaxHashMB = Is64Bit ? 33554432 : 2048;
|
constexpr int MaxHashMB = Is64Bit ? 33554432 : 2048;
|
||||||
|
int MaxThreads = std::max(1024, 4 * int(get_hardware_concurrency()));
|
||||||
|
|
||||||
Engine::Engine(std::optional<std::string> path) :
|
Engine::Engine(std::optional<std::string> path) :
|
||||||
binaryDirectory(path ? CommandLine::get_binary_directory(*path) : ""),
|
binaryDirectory(path ? CommandLine::get_binary_directory(*path) : ""),
|
||||||
@@ -74,7 +77,7 @@ Engine::Engine(std::optional<std::string> path) :
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
options.add( //
|
options.add( //
|
||||||
"Threads", Option(1, 1, 1024, [this](const Option&) {
|
"Threads", Option(1, 1, MaxThreads, [this](const Option&) {
|
||||||
resize_threads();
|
resize_threads();
|
||||||
return thread_allocation_information_as_string();
|
return thread_allocation_information_as_string();
|
||||||
}));
|
}));
|
||||||
|
|||||||
Reference in New Issue
Block a user