Stockfish 1.4, the final weapon

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

krazyken

Re: Stockfish 1.4, the final weapon

Post by krazyken »

mcostalba wrote:
krazyken wrote:
mcostalba wrote:
Please, what is the compiler used, under what OS and what is the command line?

I am very interested because me and the others developers have compiled with Intel /gcc (Linux) and MSVC (Windows) with warning level set to maximum but never hit this.

Thanks
Marco
I use Apple GCC 4.2 under Mac OS 10.5
Thanks. I didn't imagined it works under Mac, please what processor you have? Intel or PowerPC ?

I don't think Stockfish _as is_ works on big endian machines.
Intel I am. Curious that you don't think it'll work on Macs as that is Tord's primary platform. You been working hard at breaking it?
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Stockfish 1.4, the final weapon

Post by mcostalba »

krazyken wrote: Intel I am. Curious that you don't think it'll work on Macs as that is Tord's primary platform. You been working hard at breaking it?
Yes :-)

And I think I succeed. I have removed a lot of low level bitboard stuff (included the tweaks to make it work on Mac PowerPc) because I was going crazy to add some new code from Heinz: too much ifdef's and I really hate them, so I have scrapped all, monkey style.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Stockfish 1.4, the final weapon

Post by mcostalba »

Gian-Carlo Pascutto wrote:If I use the Linux version, even if I set it to 1 thread, it's hogging 2 CPUs, which of course completely handicaps the opponent engine.

hmmm can i ask if this happens on Linux only or also with Windows version ?
krazyken

Re: Stockfish 1.4, the final weapon

Post by krazyken »

It behaves OK on Mac. 1 Thread gives me 1 thread. I put a copy of the Mac binary up on my site
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Stockfish 1.4, the final weapon

Post by mcostalba »

mcostalba wrote:
Gian-Carlo Pascutto wrote:If I use the Linux version, even if I set it to 1 thread, it's hogging 2 CPUs, which of course completely handicaps the opponent engine.

hmmm can i ask if this happens on Linux only or also with Windows version ?
I have found this old thread

http://www.talkchess.com/forum/viewtopi ... t&start=20

where it seems to occur the same problem with 1.01, indipendently Jim Ablett and George Speight found and fixed the problem, it was about use of pthreads, but I never knew the details. Perhaps they could share so that I can update the readme.txt with proper compile info for Linux.

BTW I cannot reproduce this behaviour on my Linux setup.

Thanks
Marco
Gian-Carlo Pascutto
Posts: 1243
Joined: Sat Dec 13, 2008 7:00 pm

Re: Stockfish 1.4, the final weapon

Post by Gian-Carlo Pascutto »

mcostalba wrote: BTW I cannot reproduce this behaviour on my Linux setup.

Thanks
Marco
Hmm, me neither. I might have misinterpreted top's output. It was showing 100%, whereas normal engines only show 50%.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Stockfish 1.4, the final weapon

Post by mcostalba »

Gian-Carlo Pascutto wrote:
mcostalba wrote: BTW I cannot reproduce this behaviour on my Linux setup.

Thanks
Marco
Hmm, me neither. I might have misinterpreted top's output. It was showing 100%, whereas normal engines only show 50%.
I think an easy test could be to set thread to 1 and then to 2 and see how nodes/sec increase (should almost double), so to be sure with thread nr = 1 you are actually working with one thread only.
royb
Posts: 536
Joined: Thu Mar 09, 2006 12:53 am

Re: Stockfish 1.4, the final weapon

Post by royb »

Gian-Carlo Pascutto wrote:
mcostalba wrote: BTW I cannot reproduce this behaviour on my Linux setup.

Thanks
Marco
Hmm, me neither. I might have misinterpreted top's output. It was showing 100%, whereas normal engines only show 50%.
I also cannot reproduce this behavior on Linux (Ubuntu 9.04 currently).
Here is top output for Stockfish-1.4 with 1 CPU:

Code: Select all

Tasks: 175 total,   4 running, 171 sleeping,   0 stopped,   0 zombie
Cpu(s): 51.4%us,  2.5%sy,  0.0%ni, 45.1%id,  1.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   3088068k total,  2999504k used,    88564k free,    17680k buffers
Swap:  4939948k total,    40008k used,  4899940k free,  2085464k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                 
25866 roy       20   0  338m 259m 1228 R  100  8.6   0:28.49 stockfish               
19511 roy       20   0  938m 848m 831m S    3 28.1  16:49.29 vmware-vmx              
 3680 root      20   0  563m 161m  48m S    3  5.3   5:09.94 Xorg
                 4813 roy       20   0  282m 114m  25m R    1  3.8   5:22.31 firefox


And here is top output for Stockfish-1.4 with 2 CPUs:

Code: Select all

Tasks: 175 total,   4 running, 171 sleeping,   0 stopped,   0 zombie
Cpu(s): 97.8%us,  2.0%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.2%hi,  0.0%si,  0.0%st
Mem:   3088068k total,  2999168k used,    88900k free,    18808k buffers
Swap:  4939948k total,    40036k used,  4899912k free,  2081048k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                 
26132 roy       20   0  338m 260m 1240 R  193  8.6   0:53.77 stockfish               
19511 roy       20   0  938m 848m 831m R    2 28.1  16:54.95 vmware-vmx              
 4813 roy       20   0  282m 114m  25m S    2  3.8   5:25.26 firefox                 
 3680 root      20   0  561m 161m  48m S    1  5.3   5:17.29 Xorg


The single CPU setting uses only 1 CPU and the 2 CPU setting uses as much of 2 CPUs as it can (not quite 200% shown on top but ...)

Roy
Gian-Carlo Pascutto
Posts: 1243
Joined: Sat Dec 13, 2008 7:00 pm

Re: Stockfish 1.4, the final weapon

Post by Gian-Carlo Pascutto »

The problem must have been something not related to the threading. Could it be polling too aggressively while it's not it's turn? (I'm playing with pondering off).
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Stockfish 1.4, the final weapon

Post by mcostalba »

Gian-Carlo Pascutto wrote:The problem must have been something not related to the threading. Could it be polling too aggressively while it's not it's turn? (I'm playing with pondering off).
I am on Windows now, I have started Stockfish from the console, sent the first move, read the response and then wait. Now task manager shows 0% of CPU activity until I send the new move. So I cannot reproduce that either.

Anyhow the waiting loop for opponent move when there is no pondering is the following in uci.cpp

Code: Select all

void uci_main_loop() {

  RootPosition.from_fen(StartPosition);
  string command;

  do {
      // Wait for a command from stdin
      if (!getline(cin, command))
          command = "quit";

  } while (handle_command(command));
}
So there is no polling because std::getline() is a blocking call, the control is yield to the OS that give us back only when there is something in stdin.