1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-01 01:03:09 +00:00

Retire "Idle Threads Sleep" UCI option

After last Joona's patch there is no measurable
difference between the option set or unset.

Tested by Andreas Strangmüller with 16 threads
on his Dual Opteron 6376.

After 5000 games at 15+0.05 the result is:

1 Stockfish_14050822_T16_on   : 3003  5000 (+849,=3396,-755), 50.9 %
2 Stockfish_14050822_T16_off  : 2997  5000 (+755,=3396,-849), 49.1 %

bench: 880215
This commit is contained in:
Marco Costalba 2014-05-11 10:13:56 +02:00
parent bfd8704a7d
commit 9f843adf89
5 changed files with 5 additions and 12 deletions

View file

@ -31,7 +31,6 @@ Aggressiveness = 100
Cowardice = 100 Cowardice = 100
Min Split Depth = 0 Min Split Depth = 0
Threads = 1 Threads = 1
Idle Threads Sleep = true
Hash = 128 Hash = 128
Ponder = true Ponder = true
OwnBook = false OwnBook = false

View file

@ -226,14 +226,12 @@ void Search::think() {
for (size_t i = 0; i < Threads.size(); ++i) for (size_t i = 0; i < Threads.size(); ++i)
Threads[i]->maxPly = 0; Threads[i]->maxPly = 0;
Threads.sleepWhileIdle = Options["Idle Threads Sleep"];
Threads.timer->run = true; Threads.timer->run = true;
Threads.timer->notify_one(); // Wake up the recurring timer Threads.timer->notify_one(); // Wake up the recurring timer
id_loop(RootPos); // Let's start searching ! id_loop(RootPos); // Let's start searching !
Threads.timer->run = false; // Stop the timer Threads.timer->run = false; // Stop the timer
Threads.sleepWhileIdle = true; // Send idle threads to sleep
if (Options["Write Search Log"]) if (Options["Write Search Log"])
{ {
@ -1462,7 +1460,7 @@ void Thread::idle_loop() {
{ {
// If we are not searching, wait for a condition to be signaled instead of // If we are not searching, wait for a condition to be signaled instead of
// wasting CPU time polling for work. // wasting CPU time polling for work.
while ((!searching && Threads.sleepWhileIdle) || exit) while (!searching || exit)
{ {
if (exit) if (exit)
{ {
@ -1537,8 +1535,7 @@ void Thread::idle_loop() {
// Wake up the master thread so to allow it to return from the idle // Wake up the master thread so to allow it to return from the idle
// loop in case we are the last slave of the split point. // loop in case we are the last slave of the split point.
if ( Threads.sleepWhileIdle if ( this != sp->masterThread
&& this != sp->masterThread
&& sp->slavesMask.none()) && sp->slavesMask.none())
{ {
assert(!sp->masterThread->searching); assert(!sp->masterThread->searching);

View file

@ -181,13 +181,12 @@ void MainThread::idle_loop() {
// init() is called at startup to create and launch requested threads, that will // init() is called at startup to create and launch requested threads, that will
// go immediately to sleep due to 'sleepWhileIdle' set to true. We cannot use // go immediately to sleep. We cannot use a c'tor because Threads is a static
// a c'tor because Threads is a static object and we need a fully initialized // object and we need a fully initialized engine at this point due to allocation
// engine at this point due to allocation of Endgames in Thread c'tor. // of Endgames in Thread c'tor.
void ThreadPool::init() { void ThreadPool::init() {
sleepWhileIdle = true;
timer = new_thread<TimerThread>(); timer = new_thread<TimerThread>();
push_back(new_thread<MainThread>()); push_back(new_thread<MainThread>());
read_uci_options(); read_uci_options();

View file

@ -166,7 +166,6 @@ struct ThreadPool : public std::vector<Thread*> {
void wait_for_think_finished(); void wait_for_think_finished();
void start_thinking(const Position&, const Search::LimitsType&, Search::StateStackPtr&); void start_thinking(const Position&, const Search::LimitsType&, Search::StateStackPtr&);
bool sleepWhileIdle;
Depth minimumSplitDepth; Depth minimumSplitDepth;
Mutex mutex; Mutex mutex;
ConditionVariable sleepCondition; ConditionVariable sleepCondition;

View file

@ -71,7 +71,6 @@ void init(OptionsMap& o) {
o["Cowardice"] << Option(100, 0, 200, on_eval); o["Cowardice"] << Option(100, 0, 200, on_eval);
o["Min Split Depth"] << Option(0, 0, 12, on_threads); o["Min Split Depth"] << Option(0, 0, 12, on_threads);
o["Threads"] << Option(1, 1, MAX_THREADS, on_threads); o["Threads"] << Option(1, 1, MAX_THREADS, on_threads);
o["Idle Threads Sleep"] << Option(true);
o["Hash"] << Option(32, 1, 16384, on_hash_size); o["Hash"] << Option(32, 1, 16384, on_hash_size);
o["Clear Hash"] << Option(on_clear_hash); o["Clear Hash"] << Option(on_clear_hash);
o["Ponder"] << Option(true); o["Ponder"] << Option(true);