GCC PGO builds of Stockfish 1.7.1

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

oysteijo

GCC PGO builds of Stockfish 1.7.1

Post by oysteijo »

Hi all!

I've modified the Stockfish Makefile such that it's now possible to build PGO builds with GCC. You may download my modified Makefile here:

http://www.gnubg.org/media/Makefile-stockfish

I've made these changes for Windows systems with mingw gcc. To make an executable you need mingw gcc and make. It's probably easy to make similar changes for doing the same ting on Linux systems. I have made the changes with out USE_POPCNT, but adding it should also be simple.

Results (form my machine):
Straight for the box compile:
stockfish.exe bench 32 1 10 default depth
Bench position: 16/16
===============================
Total time (ms) : 3625
Nodes searched : 2530382
Nodes/second : 698036


Profile optimize guided build:
stockfish-pgo.exe bench 32 1 10 default depth
Bench position: 16/16
===============================
Total time (ms) : 3437
Nodes searched : 2530382
Nodes/second : 736218

(Not a really impressive improvement, but at least it's something)

-Øystein
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: GCC PGO builds of Stockfish 1.7.1

Post by mcostalba »

oysteijo wrote:Hi all!

I've modified the Stockfish Makefile such that it's now possible to build PGO builds with GCC. You may download my modified Makefile here:
Thanks !

I will merge in the current development version.

Why you have used:

Code: Select all

@$(PGOBENCH) > $(TMPOUTPUT)

instead of

@$(PGOBENCH) > /dev/null
oysteijo

Re: GCC PGO builds of Stockfish 1.7.1

Post by oysteijo »

I will merge in the current development version.
WARNING: Please test it a bit first, I've only used it on a Windows system, and it might not work on Linux. Notice for instance that I've removed the ./ in PGOBENCH, which will make trouble i for Linux builders.
Why you have used:

Code:
@$(PGOBENCH) > $(TMPOUTPUT)
My build system does not have a /dev/null (windows). I could maybe have generated some kind of /dev/null, but to me it the above was the most pragmatic.

However, my experience so far is that compile options like -mtune and -msseX are those who gains the most when compiling with GCC. I will try some more and see what I can come up with.

Could it be smart to check (automatic) which SSE-level the computer supports and then add the right -msse flag?

-Øystein
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: GCC PGO builds of Stockfish 1.7.1

Post by mcostalba »

oysteijo wrote:
I will merge in the current development version.
WARNING: Please test it a bit first, I've only used it on a Windows system, and it might not work on Linux. Notice for instance that I've removed the ./ in PGOBENCH, which will make trouble i for Linux builders.
Why you have used:

Code:
@$(PGOBENCH) > $(TMPOUTPUT)
My build system does not have a /dev/null (windows). I could maybe have generated some kind of /dev/null, but to me it the above was the most pragmatic.

However, my experience so far is that compile options like -mtune and -msseX are those who gains the most when compiling with GCC. I will try some more and see what I can come up with.

Could it be smart to check (automatic) which SSE-level the computer supports and then add the right -msse flag?

-Øystein
yes, I needed to readd ./ in PGOBENCH and then it worked on Linux without problems.

Regarding to be smart I would avoid it: to be smart doesn't work well with software development ;-). Just adding -msse should be enough because is supported by almost all the CPU. And also I am not sure that with these flags speed will change, but admittely I have not tested myself.

Thanks a lot for the patch !
User avatar
Jim Ablett
Posts: 1384
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: GCC PGO builds of Stockfish 1.7.1

Post by Jim Ablett »

I usually get a speedup with these for GCC > (-ftree-vectorize is GCC 4 & above)

Code: Select all

-funroll-all-loops -ftree-vectorize -funsafe-math-optimizations -mfpmath=387 
Jim.
edwardyu
Posts: 34
Joined: Mon Nov 17, 2008 6:58 am

Re: GCC PGO builds of Stockfish 1.7.1

Post by edwardyu »

Hi Jim and other experts,

How do you do GPO? By running gaunlet tests or positions/suite? How many and what sort of positons are appropriate?

thx!
User avatar
Jim Ablett
Posts: 1384
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: GCC PGO builds of Stockfish 1.7.1

Post by Jim Ablett »

edwardyu wrote:Hi Jim and other experts,

How do you do GPO? By running gaunlet tests or positions/suite? How many and what sort of positons are appropriate?

thx!
Hi Edward,

Run a few games and some test positions to gather the profile data.
Actually most of the areas critical to the speed of the engine are profiled in the first few seconds of running a game with it.
I think doing a profiling run for more than about ten minutes is overkill.

Jim.