Stockfish 1.01 FIX A SERIOUS BUG

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

Moderators: hgm, Rebel, chrisw

User avatar
Graham Banks
Posts: 41473
Joined: Sun Feb 26, 2006 10:52 am
Location: Auckland, NZ

Re: Stockfish 1.01 FIX A SERIOUS BUG

Post by Graham Banks »

Dann Corbit wrote:
Graham Banks wrote:
Dann Corbit wrote:First impression:
Stockfish looks really strong. It seems to outsearch everyone. And I am using my MS VC++ build. Jim's build will probably be quite a bit faster.
I get extremely low kn/s counts here. Same for others?
Not for me...
I get Glaurung like nodecounts, as expected.
E.g. I am getting 3.5 million NPS right now with 2 theads.
Try this one (it's 64 bit):
http://cap.connx.com/chess-engines/new- ... ckfish.zip
I'm using the 32-bit 1cpu exe

[Event "1st Honey Memorial"]
[Site "?"]
[Date "2008.11.04"]
[Round "1.1"]
[White "Naum 3.1 32-bit"]
[Black "Stockfish 1.01 32-bit"]
[Result "1-0"]
[ECO "D34"]
[Annotator "0.75;0.66"]
[PlyCount "61"]
[EventDate "2008.11.04"]
[EventType "tourn"]
[Source "Banks"]
[TimeControl "40/2280:40/2280:40/2280"]

{Dual Core AMD Opteron(tm) Processor 185 2600 MHz W=20.7 ply; 1,377kN/s; 33,
741 TBAs; HS-Variety.ctg B=12.1 ply; 7kN/s; HS-Variety.ctg} 1. Nf3 {
[%eval 35534,0] [%emt 0:00:00]} c5 {[%eval 35534,0] [%emt 0:00:00]} 2. c4 {
[%eval 35534,0] [%emt 0:00:00]} Nc6 {[%eval 35534,0] [%emt 0:00:00]} 3. Nc3 {
[%eval 35534,0] [%emt 0:00:00]} Nf6 {[%eval 35534,0] [%emt 0:00:00]} 4. g3 {
[%eval 35534,0] [%emt 0:00:00]} e6 {[%eval 35534,0] [%emt 0:00:00]} 5. Bg2 {
[%eval 35534,0] [%emt 0:00:00]} d5 {[%eval 35534,0] [%emt 0:00:00]} 6. cxd5 {
[%eval 35534,0] [%emt 0:00:00]} exd5 {[%eval 35534,0] [%emt 0:00:00]} 7. d4 {
[%eval 35534,0] [%emt 0:00:00]} Be7 {[%eval 35534,0] [%emt 0:00:00]} 8. O-O {
[%eval 35534,0] [%emt 0:00:00]} O-O {[%eval 35534,0] [%emt 0:00:00]} 9. Bg5 {
[%eval 35534,0] [%emt 0:00:00]} cxd4 {[%eval 35534,0] [%emt 0:00:00]} 10. Nxd4
{[%eval 35534,0] [%emt 0:00:00]} h6 {[%eval 35534,0] [%emt 0:00:00]} 11. Be3 {
[%eval 35534,0] [%emt 0:00:00]} Re8 {[%eval 35534,0] [%emt 0:00:00]} 12. Rc1 {
[%eval 35534,0] [%emt 0:00:00]} Bf8 {[%eval 35534,0] [%emt 0:00:00]} 13. Qb3 {
[%eval 75,15] [%emt 0:02:00]} Na5 {[%eval 66,12] [%emt 0:01:52]} 14. Qc2 {
[%eval 54,17] [%emt 0:02:19]} Bg4 {[%eval 66,12] [%emt 0:01:58]} 15. h3 {
[%eval 56,16] [%emt 0:01:15]} Bh5 {(Bd7) [%eval 50,11] [%emt 0:01:25]} 16. Nf5
{[%eval 44,16] [%emt 0:01:57]} Bg6 {[%eval 70,11] [%emt 0:01:03]} 17. Rfd1 {
[%eval 49,17] [%emt 0:02:07]} Rc8 {(Re5) [%eval 90,11] [%emt 0:01:40]} 18. g4 {
[%eval 57,15] [%emt 0:01:50]} Nc4 {(h5) [%eval 72,10] [%emt 0:02:03]} 19. Nxd5
{(Bxa7) [%eval 82,16] [%emt 0:01:25]} Nxe3 {(Nxd5) [%eval 66,9] [%emt 0:01:17]}
20. Qxc8 {[%eval 89,18] [%emt 0:01:03]} Nexd5 {
(Nxd1) [%eval 80,10] [%emt 0:01:41]} 21. Qxd8 {
(Qxb7) [%eval 213,19] [%emt 0:01:04]} Rxd8 {[%eval 88,12] [%emt 0:01:06]} 22.
e4 {[%eval 233,21] [%emt 0:01:45]} Bxf5 {(h5) [%eval 88,6] [%emt 0:01:08]} 23.
gxf5 {[%eval 231,19] [%emt 0:01:02]} Nf4 {(Bd6) [%eval 115,12] [%emt 0:00:51]}
24. Rxd8 {[%eval 394,23] [%emt 0:01:17]} Ne2+ {[%eval 239,12] [%emt 0:01:53]}
25. Kh2 {[%eval 398,24] [%emt 0:01:20]} Nxc1 {[%eval 313,14] [%emt 0:00:57]}
26. e5 {[%eval 401,24] [%emt 0:01:38]} g5 {[%eval 313,10] [%emt 0:00:54]} 27.
exf6 {(fxg6) [%eval 486,22] [%emt 0:00:51]} Nxa2 {[%eval 384,15] [%emt 0:01:04]
} 28. Bxb7 {[%eval 492,24] [%emt 0:01:59]} a5 {
(Nb4) [%eval 394,14] [%emt 0:00:51]} 29. Rd7 {
(f4) [%eval 709,23] [%emt 0:00:59]} Nb4 {[%eval 503,15] [%emt 0:01:20]} 30. Bf3
{[%eval 730,23] [%emt 0:02:19]} a4 {(Kh8) [%eval 509,12] [%emt 0:00:53]} 31.
Bh5 {[%eval 898,24] [%emt 0:01:14]} 1-0
gbanksnz at gmail.com
User avatar
Graham Banks
Posts: 41473
Joined: Sun Feb 26, 2006 10:52 am
Location: Auckland, NZ

Re: Stockfish 1.01 FIX A SERIOUS BUG

Post by Graham Banks »

Dirt wrote:
Graham Banks wrote:
Dann Corbit wrote:First impression:
Stockfish looks really strong. It seems to outsearch everyone. And I am using my MS VC++ build. Jim's build will probably be quite a bit faster.
I get extremely low kn/s counts here. Same for others?
It sounds like you might have the same problem as I, where everything gets very slow. This includes opponent engines with ponder off.
No - it's just Stockfish here.
gbanksnz at gmail.com
User avatar
Eelco de Groot
Posts: 4567
Joined: Sun Mar 12, 2006 2:40 am
Full name:   

Re: Stockfish 1.01 FIX A SERIOUS BUG

Post by Eelco de Groot »

Graham Banks wrote:
Dirt wrote:
Graham Banks wrote:
Dann Corbit wrote:First impression:
Stockfish looks really strong. It seems to outsearch everyone. And I am using my MS VC++ build. Jim's build will probably be quite a bit faster.
I get extremely low kn/s counts here. Same for others?
It sounds like you might have the same problem as I, where everything gets very slow. This includes opponent engines with ponder off.
No - it's just Stockfish here.
Graham did you try Glaurung_clone as well? Any signs of disk-swapping or the program getting only a small percentage of the CPU? If you are running your match without pondering on a dual, maybe it is necessary to set the number of threads to two first? I am sure you have looked at all basic suggestions like this but I'm at a loss what else could be the problem. With enough memory for hashtables I see no diskswapping here but this is on one CPU.

Regards, Eelco
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
User avatar
Graham Banks
Posts: 41473
Joined: Sun Feb 26, 2006 10:52 am
Location: Auckland, NZ

Re: Stockfish 1.01 FIX A SERIOUS BUG

Post by Graham Banks »

Eelco de Groot wrote:
Graham Banks wrote:
Dirt wrote:
Graham Banks wrote:
Dann Corbit wrote:First impression:
Stockfish looks really strong. It seems to outsearch everyone. And I am using my MS VC++ build. Jim's build will probably be quite a bit faster.
I get extremely low kn/s counts here. Same for others?
It sounds like you might have the same problem as I, where everything gets very slow. This includes opponent engines with ponder off.
No - it's just Stockfish here.
Graham did you try Glaurung_clone as well? Any signs of disk-swapping or the program getting only a small percentage of the CPU? If you are running your match without pondering on a dual, maybe it is necessary to set the number of threads to two first? I am sure you have looked at all basic suggestions like this but I'm at a loss what else could be the problem. With enough memory for hashtables I see no diskswapping here but this is on one CPU.

Regards, Eelco
Hi Eelco,

I haven't tried setting the threads to 2 first. I'll try this later and do a reboot also.

Cheers, Graham.
gbanksnz at gmail.com
User avatar
Graham Banks
Posts: 41473
Joined: Sun Feb 26, 2006 10:52 am
Location: Auckland, NZ

Re: Stockfish 1.01 FIX A SERIOUS BUG

Post by Graham Banks »

Eelco de Groot wrote:
Graham Banks wrote:
Dirt wrote:
Graham Banks wrote:
Dann Corbit wrote:First impression:
Stockfish looks really strong. It seems to outsearch everyone. And I am using my MS VC++ build. Jim's build will probably be quite a bit faster.
I get extremely low kn/s counts here. Same for others?
It sounds like you might have the same problem as I, where everything gets very slow. This includes opponent engines with ponder off.
No - it's just Stockfish here.
Graham did you try Glaurung_clone as well? Any signs of disk-swapping or the program getting only a small percentage of the CPU? If you are running your match without pondering on a dual, maybe it is necessary to set the number of threads to two first? I am sure you have looked at all basic suggestions like this but I'm at a loss what else could be the problem. With enough memory for hashtables I see no diskswapping here but this is on one CPU.

Regards, Eelco
Okay - here's the problem.
Stockfish will run fine using 2cpu. Node count is as expected.
If you set the number of threads to 1cpu it will still try to hog both cpus on the dual.
If I run two tourneys concurrently however (ponder off for all), it will stick to 50% of the cpu power, but the node count goes down to lower than Rybkas.
Doesn't look like I'll be testing Stockfish after all unless this can be fixed. :(

Cheers, Graham.
gbanksnz at gmail.com
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Stockfish 1.01 FIX A SERIOUS BUG

Post by mcostalba »

Graham Banks wrote:
Dann Corbit wrote:First impression:
Stockfish looks really strong. It seems to outsearch everyone. And I am using my MS VC++ build. Jim's build will probably be quite a bit faster.
I get extremely low kn/s counts here. Same for others?
Hi,

kn/s should really be in the same range of Glaurung, actually a little bit more then Glaurung, expecially on 32 bits.

I have not changed anything sensible here, in particular evaluation is the same and move generation is a little bit faster.

I have seen that you are testing on a Dual Core AMD Opteron, I would think that this chip counts as two processors, and so the optimum number of threads is two.

In Glaurung as well as in Stockfish there is some code to overwrite the number of threads set to the "stimated" cpu count.

In ucioption.cpp

Code: Select all

/// init_uci_options() initializes the UCI options.  Currently, the only
/// thing this function does is to initialize the default value of the
/// "Threads" parameter to the number of available CPU cores.

 void init_uci_options() {

   load_defaults(options);

   // Limit the default value of "Threads" to 7 even if we have 8 CPU cores.
   // According to Ken Dail's tests, Glaurung plays much better with 7 than
   // with 8 threads.  This is weird, but it is probably difficult to find out
   // why before I have a 8-core computer to experiment with myself.
   Options::iterator it = option_with_name("Threads");

   assert(it != options.end());

   it->defaultValue = stringify(Min(cpu_count(), 7));
   it->currentValue = stringify(Min(cpu_count(), 7));

   ----cut---

where cpu_count() tries to determine the number of CPU but it's a bit of a hack for non MSVC case (see misc.cpp). I didn't changed that part from Glaurung.

If you have still problems after setting the threads to 2, please comment out the cpu_count() assignments:

Code: Select all


   //it->defaultValue = stringify(Min(cpu_count(), 7));
   //it->currentValue = stringify(Min(cpu_count(), 7));

and see what happens.
User avatar
Graham Banks
Posts: 41473
Joined: Sun Feb 26, 2006 10:52 am
Location: Auckland, NZ

Re: Stockfish 1.01 FIX A SERIOUS BUG

Post by Graham Banks »

mcostalba wrote:
Graham Banks wrote:
Dann Corbit wrote:First impression:
Stockfish looks really strong. It seems to outsearch everyone. And I am using my MS VC++ build. Jim's build will probably be quite a bit faster.
I get extremely low kn/s counts here. Same for others?
Hi,

kn/s should really be in the same range of Glaurung, actually a little bit more then Glaurung, expecially on 32 bits.

I have not changed anything sensible here, in particular evaluation is the same and move generation is a little bit faster.

I have seen that you are testing on a Dual Core AMD Opteron, I would think that this chip counts as two processors, and so the optimum number of threads is two.

In Glaurung as well as in Stockfish there is some code to overwrite the number of threads set to the "stimated" cpu count.

In ucioption.cpp

Code: Select all

/// init_uci_options() initializes the UCI options.  Currently, the only
/// thing this function does is to initialize the default value of the
/// "Threads" parameter to the number of available CPU cores.

 void init_uci_options() {

   load_defaults(options);

   // Limit the default value of "Threads" to 7 even if we have 8 CPU cores.
   // According to Ken Dail's tests, Glaurung plays much better with 7 than
   // with 8 threads.  This is weird, but it is probably difficult to find out
   // why before I have a 8-core computer to experiment with myself.
   Options::iterator it = option_with_name("Threads");

   assert(it != options.end());

   it->defaultValue = stringify(Min(cpu_count(), 7));
   it->currentValue = stringify(Min(cpu_count(), 7));

   ----cut---

where cpu_count() tries to determine the number of CPU but it's a bit of a hack for non MSVC case (see misc.cpp). I didn't changed that part from Glaurung.

If you have still problems after setting the threads to 2, please comment out the cpu_count() assignments:

Code: Select all


   //it->defaultValue = stringify(Min(cpu_count(), 7));
   //it->currentValue = stringify(Min(cpu_count(), 7));

and see what happens.
Hi Marco,

unfortunately I am not a programmer, only a tester.
Unless there is a compile released that will restrict Stockfish to 1cpu without wrecking the node count (and therefore performance), I will be unable to test it.
It would be great to be able to test Stockfish 1cpu on a dual or quad.

Regards, Graham.
gbanksnz at gmail.com
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Stockfish 1.01 FIX A SERIOUS BUG

Post by mcostalba »

Graham Banks wrote:
Hi Marco,

unfortunately I am not a programmer, only a tester.
Unless there is a compile released that will restrict Stockfish to 1cpu without wrecking the node count (and therefore performance), I will be unable to test it.
It would be great to be able to test Stockfish 1cpu on a dual or quad.

Regards, Graham.
Yes, I understund. I can compile for you a version of Stockfish for one cpu, probaby my compile is not as fast as the Jim one but at least can be useful to understand the problem.

What is the CPU type on which you are going to test ? is it the Dual Core AMD Opteron ?

In this case I will prepare a version that set's the thread number to 2 as a fixed value. It is the optimal value for that kind of CPU.


Thanks for your time
Marco
User avatar
Graham Banks
Posts: 41473
Joined: Sun Feb 26, 2006 10:52 am
Location: Auckland, NZ

Re: Stockfish 1.01 FIX A SERIOUS BUG

Post by Graham Banks »

mcostalba wrote:
Graham Banks wrote:
Hi Marco,

unfortunately I am not a programmer, only a tester.
Unless there is a compile released that will restrict Stockfish to 1cpu without wrecking the node count (and therefore performance), I will be unable to test it.
It would be great to be able to test Stockfish 1cpu on a dual or quad.

Regards, Graham.
Yes, I understund. I can compile for you a version of Stockfish for one cpu, probaby my compile is not as fast as the Jim one but at least can be useful to understand the problem.

What is the CPU type on which you are going to test ? is it the Dual Core AMD Opteron ?

In this case I will prepare a version that set's the thread number to 2 as a fixed value. It is the optimal value for that kind of CPU.


Thanks for your time
Marco
What I would like if possible is a Stockfish that will use 1cpu only no matter what.
Other CCRL testers will test the multi-cpu version, but I currently restrict my testing to 1cpu versions only, even though I use dual computers.
Perhaps Jim or Dann can do such a compile?

Cheers, Graham.
gbanksnz at gmail.com
kranium
Posts: 2129
Joined: Thu May 29, 2008 10:43 am

Re: Stockfish 1.01 FIX A SERIOUS BUG

Post by kranium »

Hi all,

one of the issues here may be physical vs logical processors...
i.e. on any Intel chipset with Hyperthreading enabled, Windows sees (one physical processor) as two logical processors. you can see this clearly using windows systems properties.

for ex: if you have one CPU with Hyperthreading (enabled) , Windows will report 2 CPUs.

performance can then suffer when 2 threads are competing, trying to address the same physical processor...

http://software.intel.com/en-us/article ... processors

i'm somewhat familiar with this issue because i've been working on code that attempts to identify hyperthreading enabled processors, counts the physical and logical processors on any system, in order to enable an optimal thread config...Intel provides code for this purpose, but it's large and may require a separate DLL.

Good luck,
Norm