I didn't find the older Glaurung source files, but the same bug I saw in the oldest Stockfish source (available on the net).
The code is from the routine :
Code: Select all
void sp_search_pv(SplitPoint *sp, int threadID) {
Code: Select all
value = -search(pos, ss, -sp->alpha, newDepth, sp->ply+1, true, threadID);
if (value > sp->alpha && value < sp->beta)
{
// When the search fails high at ply 1 while searching the first
// move at the root, set the flag failHighPly1. This is used for
// time managment: We don't want to stop the search early in
// such cases, because resolving the fail high at ply 1 could
// result in a big drop in score at the root.
if (sp->ply == 1 && RootMoveNumber == 1)
Threads[threadID].failHighPly1 = true;
value = -search_pv(pos, ss, -sp->beta, -sp->alpha, newDepth, sp->ply+1, threadID);
Threads[threadID].failHighPly1 = false;
}
- Assume the initial alpha is 10 (just a number)
- The minimal window search will start with this value.
- A fail high occurs , value for example 11.
- This does not mean the new score is 11, it indicates that the actual score >= 11 (could even be 100, or whatever).
- But ,....................................... if in the meantime a parallel thread also has found a better score , example 12, then the Splitpoint Alpha value will be changed by the other thread to 12.
- Which does not trigger the condition to do a new search for this thread!!!
- So in the above code the sp->alpha value for the search and then for the if statement could be different !!
- So you should use a local copy of the sp->alpha (see new/most recent code Stockfish).
At least when i examined the logs of all the cores/threads, this was what happened in my case.
After changing and doing the same search 100 times, in all cases the move and score was equal.
I'm not sure if I solved all bugs now, but at least a tricky one.
Bert