It's working!!
Thank you Mike )
Andscacs - New version 0.921 with source
Moderators: hgm, Rebel, chrisw
-
- Posts: 364
- Joined: Sat Jun 13, 2015 10:08 am
- Location: Poland
- Full name: Dariusz Domagała
-
- Posts: 2204
- Joined: Sat Jan 18, 2014 10:24 am
- Location: Andorra
Re: Updated MacOS built with clang ( includes updated sourc
Many thanks!! I added it all to the zip file.
Daniel José - http://www.andscacs.com
-
- Posts: 5566
- Joined: Tue Feb 28, 2012 11:56 pm
Re: Andscacs - New version 0.921 with source
It seems Andscacs performed a 3-ply search which correctly found Kh4 as only move, but then picked the move it had just played.cdani wrote:As the bug happened in only one move situation,
https://pastebin.com//fvyc06hY
This suggests to me that Andscacs picked a move from a lazy search thread which had not yet been properly initialised and still had the old move (and perhaps the old score and depth) in its PV data structure.
If this is indeed what happened, then the solution is to reset the various thread-specific data structures in the main thread before starting the actual search.
But I am only speculating. My Catalan is not yet at a level that allows me to fully understand your code
-
- Posts: 5566
- Joined: Tue Feb 28, 2012 11:56 pm
Re: Andscacs - New version 0.921 with source
I noticed that my Linux compile of Andscacs starts to use cpu once I set it to 6 threads:
Now "top" shows about 20% CPU usage for Andscacs.
This may of course just be a problem of the Linux version.
Code: Select all
$ ./andscacs
Andscacs 0.921 by Daniel Jose
uci
id name Andscacs 0.921
id author Daniel Jose
option name Ponder type check default false
option name Hash type spin default 128 min 1 max 65536
option name Clear Hash type button
option name NullMove type check default true
option name MultiPV type spin default 1 min 1 max 100
option name Threads type spin default 1 min 1 max 128
option name AlwaysFullPv type check default false
option name Contempt type spin default 0 min -100 max 100
option name WinGroupAffinity type check default false
option name NeverClearHash type check default false
option name HashFile type string default hash.hsh
option name SaveHashtoFile type button
option name LoadHashfromFile type button
uciok
setoption name Threads value 6
isready
readyok
This may of course just be a problem of the Linux version.
-
- Posts: 5566
- Joined: Tue Feb 28, 2012 11:56 pm
Re: Andscacs - New version 0.921 with source
It seems you're letting threads sleep by repeatedly calling Sleep(1) on Windows and nanosleep(&ts, NULL) on Linux.
The ts timespec struct is initialised to 1000ns, so that means it wakes up every microsecond. You probably meant to set it to 1,000,000ns, which is 1ms.
Sleep(1) corresponds to a 1ms sleep. So each thread still wakes up 1000 times per second.
I think you should seriously consider changing this.
The ts timespec struct is initialised to 1000ns, so that means it wakes up every microsecond. You probably meant to set it to 1,000,000ns, which is 1ms.
Sleep(1) corresponds to a 1ms sleep. So each thread still wakes up 1000 times per second.
I think you should seriously consider changing this.
-
- Posts: 2204
- Joined: Sat Jan 18, 2014 10:24 am
- Location: Andorra
Re: Andscacs - New version 0.921 with source
Thanks!! Yes, is what I thought. I will solve this bug soon and publish the changed code and new compiles.syzygy wrote:It seems Andscacs performed a 3-ply search which correctly found Kh4 as only move, but then picked the move it had just played.cdani wrote:As the bug happened in only one move situation,
https://pastebin.com//fvyc06hY
This suggests to me that Andscacs picked a move from a lazy search thread which had not yet been properly initialised and still had the old move (and perhaps the old score and depth) in its PV data structure.
If this is indeed what happened, then the solution is to reset the various thread-specific data structures in the main thread before starting the actual search.
But I am only speculating. My Catalan is not yet at a level that allows me to fully understand your code
Daniel José - http://www.andscacs.com
-
- Posts: 2204
- Joined: Sat Jan 18, 2014 10:24 am
- Location: Andorra
Re: Andscacs - New version 0.921 with source
Thanks!! I will change this also. My knowledge of linux C stuff is not good, and I replicated the windows instruction thinking that was the same.syzygy wrote:It seems you're letting threads sleep by repeatedly calling Sleep(1) on Windows and nanosleep(&ts, NULL) on Linux.
The ts timespec struct is initialised to 1000ns, so that means it wakes up every microsecond. You probably meant to set it to 1,000,000ns, which is 1ms.
Sleep(1) corresponds to a 1ms sleep. So each thread still wakes up 1000 times per second.
I think you should seriously consider changing this.
Daniel José - http://www.andscacs.com
-
- Posts: 5566
- Joined: Tue Feb 28, 2012 11:56 pm
Re: Andscacs - New version 0.921 with source
But you should also the change the Windows implementation. If the engine is not searching, the search threads should really block until it is the engine's turn. On Windows you can use a primitive like WaitForSingleObject().cdani wrote:Thanks!! I will change this also. My knowledge of linux C stuff is not good, and I replicated the windows instruction thinking that was the same.syzygy wrote:It seems you're letting threads sleep by repeatedly calling Sleep(1) on Windows and nanosleep(&ts, NULL) on Linux.
The ts timespec struct is initialised to 1000ns, so that means it wakes up every microsecond. You probably meant to set it to 1,000,000ns, which is 1ms.
Sleep(1) corresponds to a 1ms sleep. So each thread still wakes up 1000 times per second.
I think you should seriously consider changing this.
-
- Posts: 2204
- Joined: Sat Jan 18, 2014 10:24 am
- Location: Andorra
Re: Andscacs - New version 0.921 with source
I see. I will do it. But such change will be for next version.syzygy wrote: But you should also the change the Windows implementation. If the engine is not searching, the search threads should really block until it is the engine's turn. On Windows you can use a primitive like WaitForSingleObject().
Daniel José - http://www.andscacs.com
-
- Posts: 4889
- Joined: Thu Mar 09, 2006 6:34 am
- Location: Pen Argyl, Pennsylvania
Re: Andscacs - New version 0.921 with source
In C++11, you can do this with standard library facilities:cdani wrote:I see. I will do it. But such change will be for next version.syzygy wrote: But you should also the change the Windows implementation. If the engine is not searching, the search threads should really block until it is the engine's turn. On Windows you can use a primitive like WaitForSingleObject().
Code: Select all
#include <chrono>
#include <thread>
std::this_thread::sleep_for(std::chrono::milliseconds(1));
Since this change it pretty simple - you might want to make it now
you have three places to change this in analysis.cpp:
Code: Select all
#ifdef LINUX
//nanosleep(&ts, NULL);
std::this_thread::sleep_for(std::chrono::milliseconds(1));
#endif