Stockfish version with hash saving capability

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

Moderators: hgm, Rebel, chrisw

zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Stockfish version with hash saving capability

Post by zullil »

duncan wrote:
question to daniel jose. I tried to 'educate' the hash by setting it this position

[d]4k3/2pp1ppp/4p3/8/3P4/3Q4/PPP1PPPP/RNB1KBNR b KQ - 0 2 and waiting till it found the mate in 11.

saved the hash and reloaded it. however it still did not find the mate in 11. do you know why this is ?
A request for clarification:

You had the engine search the position above until it showed that, after any move by Black, the position is mate-in-9? You then saved the hash, restarted the engine, loaded the saved hash, and gave it the following position?
[D]4k3/2pppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQ - 0 1

If so, what were you expecting to happen?
duncan
Posts: 12038
Joined: Mon Jul 07, 2008 10:50 pm

Re: Stockfish version with hash saving capability

Post by duncan »

zullil wrote:
duncan wrote:
question to daniel jose. I tried to 'educate' the hash by setting it this position

[d]4k3/2pp1ppp/4p3/8/3P4/3Q4/PPP1PPPP/RNB1KBNR b KQ - 0 2 and waiting till it found the mate in 11.

saved the hash and reloaded it. however it still did not find the mate in 11. do you know why this is ?
A request for clarification:

You had the engine search the position above until it showed that, after any move by Black, the position is mate-in-9? You then saved the hash, restarted the engine, loaded the saved hash, and gave it the following position?
[D]4k3/2pppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQ - 0 1

If so, what were you expecting to happen?
I saved the hash for this position [D]4k3/2pppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQ - 0 1 after it had found a mate in 12.
reloaded the hash and gave it this position [d]4k3/2pp1ppp/4p3/8/3P4/3Q4/PPP1PPPP/RNB1KBNR b KQ - 0 2 and waiting till it found the mate in 9 .
saved the hash and reloaded the hash and gave it this position [D]4k3/2pppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQ - 0 1

hoping it would find the mate in 11 within a few minutes. It did not find it even after a few hours.

(finally found the mate in 11 AFTER I had done the above. computer slowish. though would still like to know what I am doing wrong for the future)

2017-08-04 07:46:20.796<--1:info depth 53 seldepth 24 multipv 1 score mate 11 nodes 28952476534 nps 1471042 hashfull 999 tbhits 0 time 19681610 pv a2a4 h7h5 a4a5 g7g5 d2d4 g5g4 d1d3 e7e6 c1g5 f7f6 d3g6 e8e7 g6f6 e7d6 f6f8 d6c6 f8a8 c6d6 b1c3 c7c6 a8b8)
Last edited by duncan on Fri Aug 04, 2017 6:26 pm, edited 2 times in total.
duncan
Posts: 12038
Joined: Mon Jul 07, 2008 10:50 pm

Re: Stockfish version with hash saving capability

Post by duncan »

BeyondCritics wrote:There is new flag, that forbids stockfish to clear the hash. Did you set it on?
Please always tell, how big your hash file is, this is highly significiant. Make it as big as possible. I use typically sizes in the giga bytes.
A Hash table in a chess program is a probabilistic data structure, that does not promise anything, not even a correct entry. Take this into account.
If you use persistent/sticky hashing, you are required, to only search root positions, which are related somehow. Otherwise you will get into deep trouble in the long run.
never clear hash is ticked.
1000 mb hash

you say
"If you use persistent/sticky hashing, you are required, to only search root positions, which are related somehow." I am not sure what I should be doing
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Stockfish version with hash saving capability

Post by zullil »

duncan wrote:
zullil wrote:
duncan wrote:
question to daniel jose. I tried to 'educate' the hash by setting it this position

[d]4k3/2pp1ppp/4p3/8/3P4/3Q4/PPP1PPPP/RNB1KBNR b KQ - 0 2 and waiting till it found the mate in 11.

saved the hash and reloaded it. however it still did not find the mate in 11. do you know why this is ?
A request for clarification:

You had the engine search the position above until it showed that, after any move by Black, the position is mate-in-9? You then saved the hash, restarted the engine, loaded the saved hash, and gave it the following position?
[D]4k3/2pppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQ - 0 1

If so, what were you expecting to happen?
I saved the hash for this position [D]4k3/2pppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQ - 0 1 after it had found a mate in 12.
reloaded the hash and gave it this position [d]4k3/2pp1ppp/4p3/8/3P4/3Q4/PPP1PPPP/RNB1KBNR b KQ - 0 2 and waiting till it found the mate in 9 .
saved the hash and reloaded the hash and gave it this position [D]4k3/2pppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQ - 0 1

hoping it would find the mate in 11 within a few minutes. It did not find it even after a few hours.

(finally found the mate in 11 AFTER I had done the above. computer slowish. though would still like to know what I am doing wrong for the future)

2017-08-04 07:46:20.796<--1:info depth 53 seldepth 24 multipv 1 score mate 11 nodes 28952476534 nps 1471042 hashfull 999 tbhits 0 time 19681610 pv a2a4 h7h5 a4a5 g7g5 d2d4 g5g4 d1d3 e7e6 c1g5 f7f6 d3g6 e8e7 g6f6 e7d6 f6f8 d6c6 f8a8 c6d6 b1c3 c7c6 a8b8)
Perhaps your expectations are unrealistic? After finding the mate-in-9, you saved the hash. So, when you reloaded that hash and searched the original position, the engine now had an exact score (mate-in-9) for that one position. I wouldn't expect that knowledge to be all that helpful in determining the evaluation of the original position. There are so many other nodes that still need to be considered.
BeyondCritics
Posts: 396
Joined: Sat May 05, 2012 2:48 pm
Full name: Oliver Roese

Re: Stockfish version with hash saving capability

Post by BeyondCritics »

duncan wrote:
BeyondCritics wrote:There is new flag, that forbids stockfish to clear the hash. Did you set it on?
Please always tell, how big your hash file is, this is highly significiant. Make it as big as possible. I use typically sizes in the giga bytes.
A Hash table in a chess program is a probabilistic data structure, that does not promise anything, not even a correct entry. Take this into account.
If you use persistent/sticky hashing, you are required, to only search root positions, which are related somehow. Otherwise you will get into deep trouble in the long run.
never clear hash is ticked.
1000 mb hash

you say
"If you use persistent/sticky hashing, you are required, to only search root positions, which are related somehow." I am not sure what I should be doing
OK, 1Gb looks reasonable to me.

You should just be aware of the fact, that saved "unrelated" searches are detremial for search performance. With "unrelated" i mean a completely different board position. If you are doing performance experiments, this is an important "factor" for the outcome.
So i would do it exactly as you described and taking care, not to search a different board position with this same hash table loaded. I would clear the table before any experiment.
Of course, a carefull controlled "robustness" experiment would be feasable too.
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Stockfish version with hash saving capability

Post by zullil »

zullil wrote:
zullil wrote:
Rodolfo Leoni wrote:
zullil wrote:
Rodolfo Leoni wrote:BTW, I just tested AsmFishW save and load hashes: it doesn't work at all, even if no move is made.
I just tested the Linux version. TTSave worked. TTLoad did not---until I discovered that the file created by TTSave had permissions 000. Once I made the file readable, TTLoad worked.
Then, a more interesting test you could run could be, with little hash size:

a) let AsmfishW analyze a position until a consistant fail high/low happens.
b) save hash
c) close and restart GUI
d) load hashes and chech if AsmFishW hits the fail high/low immediately.

Here, it didn't work. I'm curious if it works under linux.
Actually, I'm beginning to have some doubts too. :wink: So far not seeing any indication that the loaded hash is resulting in a faster search. Guess I need to test more...
Definitely seems like there are issues here. Using a saved hash seems to hinder the search rather than help it. Load followed by immediate save produces a file different from what was loaded, which seems odd ...
Received confirmation that hash save/load in asmFish are broken:
I just found that the ttload/ttsave functions are completely broken. Easy to fix though.
https://github.com/lantonov/asmFish/issues/69
Rodolfo Leoni
Posts: 545
Joined: Tue Jun 06, 2017 4:49 pm
Location: Italy

Re: Stockfish version with hash saving capability

Post by Rodolfo Leoni »

zullil wrote:
zullil wrote:
zullil wrote:
Rodolfo Leoni wrote:
zullil wrote:
Rodolfo Leoni wrote:BTW, I just tested AsmFishW save and load hashes: it doesn't work at all, even if no move is made.
I just tested the Linux version. TTSave worked. TTLoad did not---until I discovered that the file created by TTSave had permissions 000. Once I made the file readable, TTLoad worked.
Then, a more interesting test you could run could be, with little hash size:

a) let AsmfishW analyze a position until a consistant fail high/low happens.
b) save hash
c) close and restart GUI
d) load hashes and chech if AsmFishW hits the fail high/low immediately.

Here, it didn't work. I'm curious if it works under linux.
Actually, I'm beginning to have some doubts too. :wink: So far not seeing any indication that the loaded hash is resulting in a faster search. Guess I need to test more...
Definitely seems like there are issues here. Using a saved hash seems to hinder the search rather than help it. Load followed by immediate save produces a file different from what was loaded, which seems odd ...
Received confirmation that hash save/load in asmFish are broken:
I just found that the ttload/ttsave functions are completely broken. Easy to fix though.
https://github.com/lantonov/asmFish/issues/69
"Easy to fix." Good news. Thanks for posting the issue, Louis. :)
F.S.I. Chess Teacher
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Stockfish version with hash saving capability

Post by zullil »

Rodolfo Leoni wrote:
"Easy to fix." Good news. Thanks for posting the issue, Louis. :)
Thanks for raising the issue in the first place. I don't think I would have tested otherwise. Let's hope a patch is committed to fix this very soon.
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Stockfish version with hash saving capability

Post by zullil »

zullil wrote:
zullil wrote:
zullil wrote:
Rodolfo Leoni wrote:
zullil wrote:
Rodolfo Leoni wrote:BTW, I just tested AsmFishW save and load hashes: it doesn't work at all, even if no move is made.
I just tested the Linux version. TTSave worked. TTLoad did not---until I discovered that the file created by TTSave had permissions 000. Once I made the file readable, TTLoad worked.
Then, a more interesting test you could run could be, with little hash size:

a) let AsmfishW analyze a position until a consistant fail high/low happens.
b) save hash
c) close and restart GUI
d) load hashes and chech if AsmFishW hits the fail high/low immediately.

Here, it didn't work. I'm curious if it works under linux.
Actually, I'm beginning to have some doubts too. :wink: So far not seeing any indication that the loaded hash is resulting in a faster search. Guess I need to test more...
Definitely seems like there are issues here. Using a saved hash seems to hinder the search rather than help it. Load followed by immediate save produces a file different from what was loaded, which seems odd ...
Received confirmation that hash save/load in asmFish are broken:
I just found that the ttload/ttsave functions are completely broken. Easy to fix though.
https://github.com/lantonov/asmFish/issues/69
A fix has been committed:
The bugs in the ttload/ttsave functions were fixed by @tthsqe12 with commit 222d48c.
The executables of 05Aug contain these bug fixes.
Anyone know who tthsqe12 is? Is that Mohammed?
Rodolfo Leoni
Posts: 545
Joined: Tue Jun 06, 2017 4:49 pm
Location: Italy

Re: Stockfish version with hash saving capability

Post by Rodolfo Leoni »

zullil wrote: A fix has been committed:
The bugs in the ttload/ttsave functions were fixed by @tthsqe12 with commit 222d48c.
The executables of 05Aug contain these bug fixes.
Anyone know who tthsqe12 is? Is that Mohammed?
Just to clear misunderstandings. AsmFishW has the save/load hash feature, but its hashes aren't "persistent" as Stockfish savehash by Daniel. The concept is different. In traditional hashes (example, AsmFishW) newest entries will overwrite oldest ones. In persistent hashes (Stockfish savehash) more valuable entries will overwrite less valuable ones. This, only in infinite mode.

No idea about who tthsq12 is...
F.S.I. Chess Teacher