Stockfish version with hash saving capability

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

Moderators: hgm, Rebel, chrisw

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 »

cdani wrote:
cdani wrote:Here you have an example of an epd file:
http://talkchess.com/forum/viewtopic.ph ... 76&t=64914
This version of Stockfish only uses:
fen
acd (depth searched)
bm (best move)
ce (score)
I gave it this epd (1 position) and engine still stops working.

r3kb1r/1bqn1p1p/p1Np1P2/3P4/1p6/5Q1B/PPP4P/2KR2R1 b kq - 4 20 acd 40; ce 2426; bm Bh3
F.S.I. Chess Teacher
duncan
Posts: 12038
Joined: Mon Jul 07, 2008 10:50 pm

Re: Stockfish version with hash saving capability

Post by duncan »

Vinvin wrote:
duncan wrote:
Vinvin wrote:
Sting-SF 8.5, 4*4GHz. Mate in 60 in 4m17s, mate in 33 in 14m39s.

thanks for running it. does sting-sf have an advantage over normal sf ?

also how much hash did you use ?
I don't know what are the mods compare to the regular SF but Sting-SF can find very long mates.
do you know why louis found the mate in only 64 ply ?
Dann Corbit
Posts: 12538
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Stockfish version with hash saving capability

Post by Dann Corbit »

I just now found this post of yours.

How unspeakably decent of you to do that.

I am sure I will have eons of fun with it.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
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 »

Dann Corbit wrote:I just now found this post of yours.

How unspeakably decent of you to do that.

I am sure I will have eons of fun with it.
Hi Dann,

I hope it'll work with you. I'm having troubles with it, maybe I'm doing something wrong. Could you please tell if it's ok? :)
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 »

duncan wrote:
Vinvin wrote:
duncan wrote:
Vinvin wrote:
Sting-SF 8.5, 4*4GHz. Mate in 60 in 4m17s, mate in 33 in 14m39s.

thanks for running it. does sting-sf have an advantage over normal sf ?

also how much hash did you use ?
I don't know what are the mods compare to the regular SF but Sting-SF can find very long mates.
do you know why louis found the mate in only 64 ply ?
This too will vary when searching with more than one thread. Also, most engines now use "Lazy SMP" for multi-threaded searching. With this technique, a range of different depths are being searched simultaneously, so the reported depth (iteration) should be considered somewhat "fuzzy."
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:
Vinvin wrote:
duncan wrote:
Vinvin wrote:
Sting-SF 8.5, 4*4GHz. Mate in 60 in 4m17s, mate in 33 in 14m39s.

thanks for running it. does sting-sf have an advantage over normal sf ?

also how much hash did you use ?
I don't know what are the mods compare to the regular SF but Sting-SF can find very long mates.
do you know why louis found the mate in only 64 ply ?
This too will vary when searching with more than one thread. Also, most engines now use "Lazy SMP" for multi-threaded searching. With this technique, a range of different depths are being searched simultaneously, so the reported depth (iteration) should be considered somewhat "fuzzy."

not having much luck myself. 2 gig hash, infinite search, stockfish 8, still not found the mate in 33 after 70 ply.




2017-08-22 06:25:37.875<--1:info depth 70 seldepth 78 multipv 1 score mate 34 nodes 67731979618 nps 1364600 hashfull 181

tbhits 0 time 49635032 pv d7h3 c7b6 a8b8 b6c6 f1e3 c6d6 e3c2 d6c6 b8c8 c6d6 c8d8 d6c5 d8d7 c5d5 h3f1 d5e5 d7e7 e5f5 f1d3 f5e5

e7f7 e5d6 f7f6 d6d5 d3f1 d5e4 f1c4 e4f4 c4d3 f4g4 f6e5 g4h4 c2e3 h4g5 d3e4 g5h6 e5f6 h6h5 e4g6 h5h4 f6f5 h4g3 e3c2 g3f2 g6h5

f2g3 f5g5 g3f2 g5f4 f2g2 h5f3 g2h3 c2e3 h3h4 f3d1 h4h3 d1g4 h3h2 f4f3 h2g1 f3g3 g1h1 g3f2 h1h2 e3f1 h2h1 g4f3
giovanni
Posts: 142
Joined: Wed Jul 08, 2015 12:30 pm

Re: Stockfish version with hash saving capability

Post by giovanni »

cdani wrote:
yorkman wrote:First, thanks for this overdue feature. I've been waiting for SF to have this option for a very long time now.

Second, unfortunately the code isn't working properly. It only works up to a 2 GB hash size and it takes extremely long to save it...about 10 mins. For comparison, I save the asmFish hash (32 GB) in about 7 mins).

Hopefully you can fix that...or if you can at least provide instructions on how to add this feature into the source code ourselves (including a fix) and which file we're to add it in we'd really appreciate it.
Hello. Have you tried with the latest version I published few days ago? Should be solved.

Andscacs:

www.andscacs.com/downloads/andscacs091237.zip

Stockfish:

www.andscacs.com/downloads/stockfish_x6 ... vehash.zip
Thanks. However I tried to compile it on my ubuntu linux box and I didn't succeed:


giovanni@giovanni-X555YI:~/Downloads/stockfish_savehash/src$ make build ARCH=x86-64-modern

Config:
debug: 'no'
sanitize: 'no'
optimize: 'yes'
arch: 'x86_64'
bits: '64'
kernel: 'Linux'
os: 'GNU/Linux'
prefetch: 'yes'
popcnt: 'yes'
sse: 'yes'
pext: 'no'

Flags:
CXX: g++
CXXFLAGS: -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -flto
LDFLAGS: -m64 -Wl,--no-as-needed -lpthread -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -flto

Testing config sanity. If this fails, try 'make help' ...

make ARCH=x86-64-modern COMP=gcc all
make[1]: Entering directory '/home/giovanni/Downloads/stockfish_savehash/src'
g++ -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -flto -c -o benchmark.o benchmark.cpp
g++ -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -flto -c -o bitbase.o bitbase.cpp
g++ -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -flto -c -o bitboard.o bitboard.cpp
g++ -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -flto -c -o endgame.o endgame.cpp
g++ -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -flto -c -o evaluate.o evaluate.cpp
g++ -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -flto -c -o main.o main.cpp
g++ -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -flto -c -o material.o material.cpp
g++ -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -flto -c -o misc.o misc.cpp
g++ -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -flto -c -o movegen.o movegen.cpp
g++ -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -flto -c -o movepick.o movepick.cpp
g++ -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -flto -c -o pawns.o pawns.cpp
g++ -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -flto -c -o position.o position.cpp
g++ -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -flto -c -o psqt.o psqt.cpp
g++ -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -flto -c -o search.o search.cpp
g++ -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -flto -c -o thread.o thread.cpp
g++ -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -flto -c -o timeman.o timeman.cpp
g++ -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 -pedantic -Wextra -Wshadow -m64 -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -flto -c -o tt.o tt.cpp
tt.cpp: In member function ‘bool TranspositionTable::save()’:
tt.cpp:106:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (long long i = 0; i < clusterCount * sizeof(Cluster); i += (1 << 30)) { //1GB
^
tt.cpp:107:71: error: ‘__min’ was not declared in this scope
long long j = __min((1 << 30), (clusterCount * sizeof(Cluster)) - i);
^
<builtin>: recipe for target 'tt.o' failed
make[1]: *** [tt.o] Error 1
make[1]: Leaving directory '/home/giovanni/Downloads/stockfish_savehash/src'
Makefile:433: recipe for target 'build' failed
make: *** [build] Error 2
Dann Corbit
Posts: 12538
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Stockfish version with hash saving capability

Post by Dann Corbit »

Built fine for me.
I am going to test it this evening.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
giovanni
Posts: 142
Joined: Wed Jul 08, 2015 12:30 pm

Re: Stockfish version with hash saving capability

Post by giovanni »

Dann Corbit wrote:Built fine for me.
I am going to test it this evening.
Did you compile it on ubuntu?
User avatar
cdani
Posts: 2204
Joined: Sat Jan 18, 2014 10:24 am
Location: Andorra

Re: Stockfish version with hash saving capability

Post by cdani »

giovanni wrote: Thanks. However I tried to compile it on my ubuntu linux box and I didn't succeed:

...
for (long long i = 0; i < clusterCount * sizeof(Cluster); i += (1 << 30)) { //1GB
^
tt.cpp:107:71: error: ‘__min’ was not declared in this scope
long long j = __min((1 << 30), (clusterCount * sizeof(Cluster)) - i);
^
Is far from the best solution, but you can try adding this line in tt.cpp before the use of __min

Code: Select all

#define __min&#40;a,b&#41; ((&#40;a&#41; < &#40;b&#41;) ? &#40;a&#41; &#58; &#40;b&#41;)
Sure someone will understand what is happening.