Retire "Idle Threads Sleep" UCI option
authorMarco Costalba <mcostalba@gmail.com>
Sun, 11 May 2014 08:13:56 +0000 (10:13 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 11 May 2014 08:29:56 +0000 (10:29 +0200)
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

polyglot.ini
src/search.cpp
src/thread.cpp
src/thread.h
src/ucioption.cpp

index 4e825f3..cd7a318 100644 (file)
@@ -31,7 +31,6 @@ Aggressiveness = 100
 Cowardice = 100
 Min Split Depth = 0
 Threads = 1
-Idle Threads Sleep = true
 Hash = 128
 Ponder = true
 OwnBook = false
index 22a954a..dfe690b 100644 (file)
@@ -226,14 +226,12 @@ void Search::think() {
   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.sleepWhileIdle = true; // Send idle threads to sleep
 
   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
       // wasting CPU time polling for work.
-      while ((!searching && Threads.sleepWhileIdle) || exit)
+      while (!searching || 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
           // 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);
index 06244dc..344cfb7 100644 (file)
@@ -181,13 +181,12 @@ void MainThread::idle_loop() {
 
 
 // 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() {
 
-  sleepWhileIdle = true;
   timer = new_thread<TimerThread>();
   push_back(new_thread<MainThread>());
   read_uci_options();
index 66df55b..3565431 100644 (file)
@@ -166,7 +166,6 @@ struct ThreadPool : public std::vector<Thread*> {
   void wait_for_think_finished();
   void start_thinking(const Position&, const Search::LimitsType&, Search::StateStackPtr&);
 
-  bool sleepWhileIdle;
   Depth minimumSplitDepth;
   Mutex mutex;
   ConditionVariable sleepCondition;
index e117e44..d5db2c9 100644 (file)
@@ -71,7 +71,6 @@ void init(OptionsMap& o) {
   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);