working source for stockfish 1.6.2

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

BBauer
Posts: 658
Joined: Wed Mar 08, 2006 8:58 pm

Re: working source for stockfish 1.6.2

Post by BBauer »

I posted the complete output.
As the compiler produced an executable it also must have done the linking phase. It is reasonable to suppose that your suggestion will not work.
Anyway I will give it a try - at Monday.
You know that there was an issue with stockfish 1.6.2 an the g++ compiler.
Now there is an issue with stockfish 1.6.2 and the intel compiler.
I wouldn't think that stockfish is right and both compilers are wrong.
kind regards
Bernhard
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: working source for stockfish 1.6.2

Post by zullil »

BBauer wrote: Now there is an issue with stockfish 1.6.2 and the intel compiler.

Bernhard
I built a working binary using Jim Ablett's source and the Mac version of icc.
I used optimization and even pgo.

I have since upgraded my OS and no longer have icc, so I cannot redo it on this computer.

I'll try a clean build later at home, using icc on my MacBook.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: working source for stockfish 1.6.2

Post by mcostalba »

BBauer wrote:I posted the complete output.
Please go in the directory with SF sources open a terminal and give the following commands:

Code: Select all

make clean
make icc > tmp.txt
then post the content of file tmp.txt, in my PC I have

Code: Select all

g++ -msse -MM application.cpp bitboard.cpp pawns.cpp material.cpp endgame.cpp evaluate.cpp main.cpp misc.cpp move.cpp movegen.cpp history.cpp movepick.cpp search.cpp piece.cpp position.cpp direction.cpp tt.cpp value.cpp uci.cpp ucioption.cpp mersenne.cpp book.cpp bitbase.cpp san.cpp benchmark.cpp > .depend
make \
	CXX='icpc' \
	CXXFLAGS="-fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503" \
	all
make[1]: Entering directory `/home/marco/programmi/stockfish/src'
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o application.o application.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o bitboard.o bitboard.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o pawns.o pawns.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o material.o material.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o endgame.o endgame.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o evaluate.o evaluate.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o main.o main.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o misc.o misc.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o move.o move.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o movegen.o movegen.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o history.o history.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o movepick.o movepick.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o search.o search.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o piece.o piece.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o position.o position.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o direction.o direction.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o tt.o tt.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o value.o value.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o uci.o uci.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o ucioption.o ucioption.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o mersenne.o mersenne.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o book.o book.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o bitbase.o bitbase.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o san.o san.cpp
icpc -fast -msse -DNDEBUG -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503   -c -o benchmark.o benchmark.cpp
icpc -lpthread -o stockfish application.o bitboard.o pawns.o material.o endgame.o evaluate.o main.o misc.o move.o movegen.o history.o movepick.o search.o piece.o position.o direction.o tt.o value.o uci.o ucioption.o mersenne.o book.o bitbase.o san.o benchmark.o
make[1]: Leaving directory `/home/marco/programmi/stockfish/src'
I am using Intel compiler 11.0 under Mandriva Linux.

Please, do _EXACTLY_ what I suggested to you, no more no less, it is very important you follow the steps carefully, otherwise we could miss something.

Thanks in advance for your patience.
ldesnogu

Re: working source for stockfish 1.6.2

Post by ldesnogu »

It works fine here too.

Host: i7 920 with Fedora 12 x86_64
Compiler: icc (ICC) 11.1 20091130

Code: Select all

$ make icc
$ ./stockfish
Stockfish 1.6.2 64bit. By Tord Romstad, Marco Costalba, Joona Kiiski.
Good! CPU has hardware POPCNT. We will use it.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: working source for stockfish 1.6.2

Post by mcostalba »

ldesnogu wrote:It works fine here too.

Host: i7 920 with Fedora 12 x86_64
Compiler: icc (ICC) 11.1 20091130

Code: Select all

$ make icc
$ ./stockfish
Stockfish 1.6.2 64bit. By Tord Romstad, Marco Costalba, Joona Kiiski.
Good! CPU has hardware POPCNT. We will use it.
You have a nice system, I suggest to recompile:

Code: Select all

make clean
make icc-profile-popcnt
It will be sensibly faster.
ldesnogu

Re: working source for stockfish 1.6.2

Post by ldesnogu »

mcostalba wrote:You have a nice system,
Thanks. It was on this system that I first tried popcnt with Glaurung, but that was at a time when Tord wasn't working on it a lot. Glad to see he changed his mind :)
I suggest to recompile:

Code: Select all

make clean
make icc-profile-popcnt
It will be sensibly faster.
Is there a "standard" way of testing speed-ups?
ldesnogu

Re: working source for stockfish 1.6.2

Post by ldesnogu »

Either the internal benchmark is misleading or gcc beats icc:

Code: Select all

$ ./stockfish-gcc bench 32 1 10 default depth >/dev/null
Total time (ms) : 3272
Nodes searched  : 4569519
Nodes/second    : 1396552
$ ./stockfish-icc bench 32 1 10 default depth >/dev/null
Total time (ms) : 3692
Nodes searched  : 4569519
Nodes/second    : 1237681
$ ./stockfish-icc-profile-popcnt bench 32 1 10 default depth >/dev/null
Total time (ms) : 3489
Nodes searched  : 4569519
Nodes/second    : 1309693
gcc is 4.4.2.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: working source for stockfish 1.6.2

Post by mcostalba »

This is interesting, on my PC icc is faster, please try with a bit longer test like:

Code: Select all

$ ./stockfish bench 256 1 13 default depth >/dev/null
ldesnogu

Re: working source for stockfish 1.6.2

Post by ldesnogu »

Same:

Code: Select all

$ for i in stockfish-*; do echo "**** $i"; ./$i bench 256 1 13 default depth 2>&1 | tail -4; done
**** stockfish-gcc
Total time (ms) : 29638
Nodes searched  : 42390880
Nodes/second    : 1430288

**** stockfish-icc
Total time (ms) : 33152
Nodes searched  : 42390880
Nodes/second    : 1278682

**** stockfish-icc-profile-popcnt
Total time (ms) : 31206
Nodes searched  : 42390880
Nodes/second    : 1358420
What versions of icc and gcc did you compare?

I've had mixed results with icc in the past, and most were in favour of gcc. The only recent exception is Richard Delorme EDAX that gains about 5% with icc.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: working source for stockfish 1.6.2

Post by mcostalba »

ldesnogu wrote: What versions of icc and gcc did you compare?

I've had mixed results with icc in the past, and most were in favour of gcc. The only recent exception is Richard Delorme EDAX that gains about 5% with icc.
I have icc 11.0 and gcc 4.3.2

Did you compile gcc with -DUSE_POPCNT ?

For instance please try to apply this to Makefile:

Code: Select all

--- a/src/Makefile
+++ b/src/Makefile
@@ -26,7 +26,7 @@ EXE = stockfish
 ### Compiler speed switches for both GCC and ICC. These settings are generally
 ### fast on a broad range of systems, but may be changed experimentally
 ### ==========================================================================
-GCCFLAGS = -O3 -msse
+GCCFLAGS = -O3 -msse -DUSE_POPCNT
 ICCFLAGS = -fast -msse
 ICCFLAGS-OSX = -fast -mdynamic-no-pic