What does the option "use sleeping threads" in Stockfish mean? If I set Stockfish to use 4 threads does it mean it will try to use more than 4 threads if they are not being used by other processes?
Don
use sleeping threads
Moderator: Ras
-
- Posts: 5106
- Joined: Tue Apr 29, 2008 4:27 pm
use sleeping threads
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
-
- Posts: 966
- Joined: Fri Mar 10, 2006 4:29 pm
- Location: Germany
- Full name: Jörg Oster
Re: use sleeping threads
No.
Afaik, it means, threads without work should sleep and not keep spinning. See http://talkchess.com/forum/viewtopic.ph ... 14&t=37574
Afaik, it means, threads without work should sleep and not keep spinning. See http://talkchess.com/forum/viewtopic.ph ... 14&t=37574
Jörg Oster
-
- Posts: 43719
- Joined: Sun Feb 26, 2006 10:52 am
- Location: Auckland, NZ
Re: use sleeping threads
Confusing use of language.Joerg Oster wrote:No.
Afaik, it means, threads without work should sleep and not keep spinning. See http://talkchess.com/forum/viewtopic.ph ... 14&t=37574
Should be changed to Non-use of sleeping threads or something that more correctly indicates what is meant.
gbanksnz at gmail.com
-
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: use sleeping threads
I think we had this discussion a while back. The question is, when a thread has no work, what does it do? If you do a spin-wait, the instant the pointer to the work is updated, the thread can get to work with no delay. If you somehow block (whether it be waiting on a semaphore, a condition variable, or even a mutex) when work becomes available it takes time to wake the thread, get its context restored (registers, memory management stuff, etc) and actually start executing the thing, introducing a little "lag" between when work is available and the thread gets busy on that work.
I do busy spins in Crafty, period, since I know that the length of time between when a thread goes idle and it starts to help another thread is very short.
The only exception I make is at the end of an iteration when pondering is disabled. In normal mode, Crafty keeps the threads spinning waiting for work. Not good if you want to do an 8 core vs 8 core game, without pondering. There's an "smpnice" variable that can be set to 1 which tells it to terminate threads while waiting on an opponent's move.
I believe the stockfish option is backward in terminology. That is, if you prefer threads to sleep when not busy, you want that off... and vice-versa...
I do busy spins in Crafty, period, since I know that the length of time between when a thread goes idle and it starts to help another thread is very short.
The only exception I make is at the end of an iteration when pondering is disabled. In normal mode, Crafty keeps the threads spinning waiting for work. Not good if you want to do an 8 core vs 8 core game, without pondering. There's an "smpnice" variable that can be set to 1 which tells it to terminate threads while waiting on an opponent's move.
I believe the stockfish option is backward in terminology. That is, if you prefer threads to sleep when not busy, you want that off... and vice-versa...
-
- Posts: 6401
- Joined: Thu Mar 09, 2006 8:30 pm
- Location: Chicago, Illinois, USA
Re: use sleeping threads
I do not think it is confusing, but to have a very straightforward dialog,Graham Banks wrote:Confusing use of language.Joerg Oster wrote:No.
Afaik, it means, threads without work should sleep and not keep spinning. See http://talkchess.com/forum/viewtopic.ph ... 14&t=37574
Should be changed to Non-use of sleeping threads or something that more correctly indicates what is meant.
I would suggest a UCI variable "threads wait" = sleeping/spinning
Miguel
-
- Posts: 6442
- Joined: Tue Jan 09, 2007 12:31 am
- Location: PA USA
- Full name: Louis Zulli
Re: use sleeping threads
Whatever it means, apparently the default choice is Use Sleeping Threads = true.Don wrote:What does the option "use sleeping threads" in Stockfish mean? If I set Stockfish to use 4 threads does it mean it will try to use more than 4 threads if they are not being used by other processes?
Don
Code: Select all
/// init() initializes the UCI options to their hard coded default values
/// and initializes the default value of "Threads" and "Min Split Depth"
/// parameters according to the number of CPU cores detected.
void init(OptionsMap& o) {
int cpus = std::min(cpu_count(), MAX_THREADS);
int msd = cpus < 8 ? 4 : 7;
o["Use Debug Log"] = Option(false, on_logger);
o["Use Search Log"] = Option(false);
o["Search Log Filename"] = Option("SearchLog.txt");
o["Book File"] = Option("book.bin");
o["Best Book Move"] = Option(false);
o["Contempt Factor"] = Option(0, -50, 50);
o["Mobility (Midgame)"] = Option(100, 0, 200, on_eval);
o["Mobility (Endgame)"] = Option(100, 0, 200, on_eval);
o["Pawn Structure (Midgame)"] = Option(100, 0, 200, on_eval);
o["Pawn Structure (Endgame)"] = Option(100, 0, 200, on_eval);
o["Passed Pawns (Midgame)"] = Option(100, 0, 200, on_eval);
o["Passed Pawns (Endgame)"] = Option(100, 0, 200, on_eval);
o["Space"] = Option(100, 0, 200, on_eval);
o["Aggressiveness"] = Option(100, 0, 200, on_eval);
o["Cowardice"] = Option(100, 0, 200, on_eval);
o["Min Split Depth"] = Option(msd, 4, 12, on_threads);
o["Max Threads per Split Point"] = Option(5, 4, 8, on_threads);
o["Threads"] = Option(cpus, 1, MAX_THREADS, on_threads);
o["Use Sleeping Threads"] = Option(true);
-
- Posts: 568
- Joined: Tue Dec 12, 2006 10:10 am
- Full name: Gary Linscott
Re: use sleeping threads
This is only true for development versions of SF. For release versions, it is set to false by default. This commit did that for SF3 https://github.com/mcostalba/Stockfish/ ... de3dfe22bezullil wrote:Whatever it means, apparently the default choice is Use Sleeping Threads = true.Don wrote:What does the option "use sleeping threads" in Stockfish mean? If I set Stockfish to use 4 threads does it mean it will try to use more than 4 threads if they are not being used by other processes?
Don
-
- Posts: 2283
- Joined: Sat Jun 02, 2012 2:13 am
Re: use sleeping threads?
So then which setting should we use? Is there any guideline?gladius wrote:This is only true for development versions of SF. For release versions, it is set to false by default. This commit did that for SF3 https://github.com/mcostalba/Stockfish/ ... de3dfe22bezullil wrote:Whatever it means, apparently the default choice is Use Sleeping Threads = true.Don wrote:What does the option "use sleeping threads" in Stockfish mean? If I set Stockfish to use 4 threads does it mean it will try to use more than 4 threads if they are not being used by other processes?
Don
If testing a newer developmental version, should we leave the default setting alone (=true), even though Stockfish v3 has it the other way around (=false)?
Thanks,
CL
-
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: use sleeping threads?
Unless Marco says otherwise, I believe you want it "false". It sounds like a good idea (use sleeping threads) but I believe he stated that the term doesn't really mean what it says (he is not a native English speaker)...carldaman wrote:So then which setting should we use? Is there any guideline?gladius wrote:This is only true for development versions of SF. For release versions, it is set to false by default. This commit did that for SF3 https://github.com/mcostalba/Stockfish/ ... de3dfe22bezullil wrote:Whatever it means, apparently the default choice is Use Sleeping Threads = true.Don wrote:What does the option "use sleeping threads" in Stockfish mean? If I set Stockfish to use 4 threads does it mean it will try to use more than 4 threads if they are not being used by other processes?
Don
If testing a newer developmental version, should we leave the default setting alone (=true), even though Stockfish v3 has it the other way around (=false)?
Thanks,
CL
-
- Posts: 5106
- Joined: Tue Apr 29, 2008 4:27 pm
Re: use sleeping threads?
carldaman wrote:So then which setting should we use? Is there any guideline?gladius wrote:This is only true for development versions of SF. For release versions, it is set to false by default. This commit did that for SF3 https://github.com/mcostalba/Stockfish/ ... de3dfe22bezullil wrote:Whatever it means, apparently the default choice is Use Sleeping Threads = true.Don wrote:What does the option "use sleeping threads" in Stockfish mean? If I set Stockfish to use 4 threads does it mean it will try to use more than 4 threads if they are not being used by other processes?
Don
If testing a newer developmental version, should we leave the default setting alone (=true), even though Stockfish v3 has it the other way around (=false)?
Thanks,
CL
If you don't use all your threads it should be a minor benefit to the other programs using the same machine. So for competition testing on the same machine the fairest thing to do is to use all the resources that are rightfully yours, even if they are not of much benefit to you. Here is why:
Even though the ideal with modern processors is for them to act completely independent, the reality is that this is not the case. If you let some processors go idle it will benefit (at least slightly) other processes. I don't know if that is a big deal or not but the issue does exist.
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.