Too much Hash harms?

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

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
User avatar
Laskos
Posts: 9840
Joined: Wed Jul 26, 2006 8:21 pm
Full name: Kai Laskos

Re: Too much Hash harms?

Post by Laskos » Thu Feb 02, 2017 9:11 pm

Jouni wrote:In Stockfish forum this has been discussed/tested many times. Now they seems to use 4MB for 10+0,1 and 64MB for 60+0,6 one thread tests.
Interesting, I didn't know. This is what I get in LittleBlitzer for the numbers I need:

Code: Select all

Games Completed = 1000 of 1000 (Avg game length = 17.901 sec)
Settings = Gauntlet/0MB/6000ms+60ms/M 500cp for 2 moves, D 100 moves/EPD:C:\LittleBlitzer\2moves_v1.epd(32000)
Time = 4548 sec elapsed, 0 sec remaining
 1.  SF 256M     478.5/1000	172-215-613  	(L: m=0 t=0 i=0 a=215)	(D: r=425 i=55 f=6 s=9 a=118)	(tpm=148.7 d=15.95 nps=1625641)
 2.  SF 4M       521.5/1000	215-172-613  	(L: m=0 t=0 i=0 a=172)	(D: r=425 i=55 f=6 s=9 a=118)	(tpm=148.4 d=16.12 nps=1759164)
TC is 6''+0.06'', Hash needed is about 1-2M on average, I used SF with 4M Hash and 256M Hash. The NPS decrease is 8%, depth decrease of 0.17 plies, and 256M version is about 15 ELO points weaker.

Kohflote
Posts: 205
Joined: Wed Sep 19, 2007 9:07 am
Location: Singapore

Re: Too much Hash harms?

Post by Kohflote » Fri Feb 03, 2017 7:17 am

That is very interesting. Have you experiment the hash size for LTC such as 40 moves in 120 minutes or 180 minutes?

Thank you!

Jouni
Posts: 2083
Joined: Wed Mar 08, 2006 7:15 pm

Re: Too much Hash harms?

Post by Jouni » Fri Feb 03, 2017 4:28 pm

But for 4 threads 256MB is not harmful anymore!

Code: Select all

Games Completed = 200 of 500 (Avg game length = 28.269 sec)
Settings = Gauntlet/0MB/10000ms+100ms/M 450cp for 4 moves, D 100 moves/EPD:WCC_opening.epd(250)
Time = 5932 sec elapsed, 8897 sec remaining
 1.  SF 256MB                	101.0/200	24-22-154  	(L: m=0 t=0 i=0 a=22)	(D: r=105 i=20 f=1 s=1 a=27)	(tpm=248.5 d=22.29 nps=8662575)
 2.  SF 4MB                   	99.0/200	22-24-154  	(L: m=0 t=0 i=0 a=24)	(D: r=105 i=20 f=1 s=1 a=27)	(tpm=248.2 d=21.85 nps=8751651)
Jouni

User avatar
Laskos
Posts: 9840
Joined: Wed Jul 26, 2006 8:21 pm
Full name: Kai Laskos

Re: Too much Hash harms?

Post by Laskos » Fri Feb 03, 2017 5:04 pm

Jouni wrote:But for 4 threads 256MB is not harmful anymore!

Code: Select all

Games Completed = 200 of 500 (Avg game length = 28.269 sec)
Settings = Gauntlet/0MB/10000ms+100ms/M 450cp for 4 moves, D 100 moves/EPD:WCC_opening.epd(250)
Time = 5932 sec elapsed, 8897 sec remaining
 1.  SF 256MB                	101.0/200	24-22-154  	(L: m=0 t=0 i=0 a=22)	(D: r=105 i=20 f=1 s=1 a=27)	(tpm=248.5 d=22.29 nps=8662575)
 2.  SF 4MB                   	99.0/200	22-24-154  	(L: m=0 t=0 i=0 a=24)	(D: r=105 i=20 f=1 s=1 a=27)	(tpm=248.2 d=21.85 nps=8751651)
Maybe because 4MB is too little and 256M is too much. 16M or 32M might be optimal here.

User avatar
Laskos
Posts: 9840
Joined: Wed Jul 26, 2006 8:21 pm
Full name: Kai Laskos

Re: Too much Hash harms?

Post by Laskos » Fri Feb 03, 2017 8:32 pm

hgm wrote:
IIRC in my measurements the search time only started to go up once the overload factor exeded 10.
That seems confirmed. In 1000 games each, about 60,000 positions per Stockfish with different Hash at 6''+0.06'' 1 core, I get the following depths and nps:

Code: Select all

 1.  SF 1M         tpm=148.0 d=16.14 nps=1951575    99%
 2.  SF 4M         tpm=148.1 d=16.30 nps=1955569    80%
 3.  SF 16M        tpm=149.3 d=16.36 nps=1946288    25%
 4.  SF 64M        tpm=149.3 d=16.33 nps=1910916     7%
 5.  SF 256M       tpm=149.5 d=16.25 nps=1817734     2%
 6.  SF 1024M      tpm=149.4 d=16.14 nps=1718677     1%
The last column is approximate Hash usage per move out of available. 25% (16M Hash) seems the optimum here depth-wise. And indeed, a factor of 16 overload seems to not hurt almost at all (4M vs 64M).

User avatar
Laskos
Posts: 9840
Joined: Wed Jul 26, 2006 8:21 pm
Full name: Kai Laskos

Re: Too much Hash harms?

Post by Laskos » Fri Feb 03, 2017 8:52 pm

Kohflote wrote:That is very interesting. Have you experiment the hash size for LTC such as 40 moves in 120 minutes or 180 minutes?

Thank you!
For this TC even on one core the optimum might be at 4GB, and that's the maximum Hash I can have on my PC. To go to much higher Hash to see what happens is impossible for me. Also, the testing time on many positions for reliability of the result would be huge.

Kohflote
Posts: 205
Joined: Wed Sep 19, 2007 9:07 am
Location: Singapore

Re: Too much Hash harms?

Post by Kohflote » Fri Feb 03, 2017 11:15 pm

Hi Laskos,
4GB for LTC - is there a typo error? Jouni wrote 64MB for 60+0.6; 4GB is a huge jump for 40 moves in120 (or 180) mins.....

Thank you & regards,
Koh, Kah Huat

User avatar
Laskos
Posts: 9840
Joined: Wed Jul 26, 2006 8:21 pm
Full name: Kai Laskos

Re: Too much Hash harms?

Post by Laskos » Sat Feb 04, 2017 4:56 am

Kohflote wrote:Hi Laskos,
4GB for LTC - is there a typo error? Jouni wrote 64MB for 60+0.6; 4GB is a huge jump for 40 moves in120 (or 180) mins.....

Thank you & regards,
Koh, Kah Huat
Jouni wrote about 60+0.6 seconds, not minutes. And 64MB for that would mean about 64*120 ~ 8GB for 120min + 1.2min.

Kohflote
Posts: 205
Joined: Wed Sep 19, 2007 9:07 am
Location: Singapore

Re: Too much Hash harms?

Post by Kohflote » Sat Feb 04, 2017 8:23 am

My bad. Thank you!

Adam Hair
Posts: 3206
Joined: Wed May 06, 2009 8:31 pm
Location: Fuquay-Varina, North Carolina

Re: Too much Hash harms?

Post by Adam Hair » Sun Feb 05, 2017 1:05 am

Laskos wrote:
hgm wrote:
IIRC in my measurements the search time only started to go up once the overload factor exeded 10.
That seems confirmed. In 1000 games each, about 60,000 positions per Stockfish with different Hash at 6''+0.06'' 1 core, I get the following depths and nps:

Code: Select all

 1.  SF 1M         tpm=148.0 d=16.14 nps=1951575    99%
 2.  SF 4M         tpm=148.1 d=16.30 nps=1955569    80%
 3.  SF 16M        tpm=149.3 d=16.36 nps=1946288    25%
 4.  SF 64M        tpm=149.3 d=16.33 nps=1910916     7%
 5.  SF 256M       tpm=149.5 d=16.25 nps=1817734     2%
 6.  SF 1024M      tpm=149.4 d=16.14 nps=1718677     1%
The last column is approximate Hash usage per move out of available. 25% (16M Hash) seems the optimum here depth-wise. And indeed, a factor of 16 overload seems to not hurt almost at all (4M vs 64M).
I measured depth, nodes per second, and hash usage at 1.5 seconds per move from a set of positions (the 8238 positions from the sim tool; data extracted from Polyglot logs). I think the thinking time would equate to 1 to 1.2 seconds per move on your computer.

Code: Select all

  
Hash	Depth	   NPS	    Hashfull
   1	19.71	1423911.54	98.92%
   4	19.84	1423019.10	98.59%
  16	19.99	1471216.76	73.69%
  32	19.90	1425357.18	43.74%
  64	19.87	1407208.73	22.82%
 256	19.84	1385323.14	 5.69%
1024	19.71	1310237.31	 2.06%
4096	19.66	1284870.14	 1.65%
16 MB of hash seems to be best for this tpm and these positions on my computer. I was expecting a little more of a difference compared to your results.

Post Reply