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
Cowardice = 100
Min Split Depth = 0
Threads = 1
Cowardice = 100
Min Split Depth = 0
Threads = 1
-Idle Threads Sleep = true
Hash = 128
Ponder = true
OwnBook = false
Hash = 128
Ponder = true
OwnBook = false
for (size_t i = 0; i < Threads.size(); ++i)
Threads[i]->maxPly = 0;
for (size_t i = 0; i < Threads.size(); ++i)
Threads[i]->maxPly = 0;
- Threads.sleepWhileIdle = Options["Idle Threads Sleep"];
Threads.timer->run = true;
Threads.timer->notify_one(); // Wake up the recurring timer
id_loop(RootPos); // Let's start searching !
Threads.timer->run = false; // Stop the timer
Threads.timer->run = true;
Threads.timer->notify_one(); // Wake up the recurring timer
id_loop(RootPos); // Let's start searching !
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"])
{
{
// If we are not searching, wait for a condition to be signaled instead of
// wasting CPU time polling for work.
{
// If we are not searching, wait for a condition to be signaled instead of
// wasting CPU time polling for work.
- while ((!searching && Threads.sleepWhileIdle) || exit)
+ while (!searching || exit)
// 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.
// 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.
- if ( Threads.sleepWhileIdle
- && this != sp->masterThread
+ if ( this != sp->masterThread
&& sp->slavesMask.none())
{
assert(!sp->masterThread->searching);
&& sp->slavesMask.none())
{
assert(!sp->masterThread->searching);
// 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
-// a c'tor because Threads is a static object and we need a fully initialized
-// engine at this point due to allocation of Endgames in Thread c'tor.
+// go immediately to sleep. We cannot use a c'tor because Threads is a static
+// object and we need a fully initialized engine at this point due to allocation
+// of Endgames in Thread c'tor.
void ThreadPool::init() {
void ThreadPool::init() {
timer = new_thread<TimerThread>();
push_back(new_thread<MainThread>());
read_uci_options();
timer = new_thread<TimerThread>();
push_back(new_thread<MainThread>());
read_uci_options();
void wait_for_think_finished();
void start_thinking(const Position&, const Search::LimitsType&, Search::StateStackPtr&);
void wait_for_think_finished();
void start_thinking(const Position&, const Search::LimitsType&, Search::StateStackPtr&);
Depth minimumSplitDepth;
Mutex mutex;
ConditionVariable sleepCondition;
Depth minimumSplitDepth;
Mutex mutex;
ConditionVariable sleepCondition;
o["Cowardice"] << Option(100, 0, 200, on_eval);
o["Min Split Depth"] << Option(0, 0, 12, on_threads);
o["Threads"] << Option(1, 1, MAX_THREADS, on_threads);
o["Cowardice"] << Option(100, 0, 200, on_eval);
o["Min Split Depth"] << Option(0, 0, 12, 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["Clear Hash"] << Option(on_clear_hash);
o["Ponder"] << Option(true);
o["Hash"] << Option(32, 1, 16384, on_hash_size);
o["Clear Hash"] << Option(on_clear_hash);
o["Ponder"] << Option(true);