Page 1 of 1

Just a newbie: Are speed compiles and PGO compiles the same?

PostPosted: 20 Dec 2006, 23:24
by juan dela cruz
I'm still new in programming due to this chess AI hobby. Though still intermediate in knowledge, I managed to catch up and learn minor insertion of scripts on some free sources and compile them for my own use. Even without PGO, I still could manage a fairly optimized chess engine. Simple EPD tests are my only tool to check if my compiles are fairly the same as the original.

Are these speed compiled and PGO compiled engines the same? A lot of individuals like Jim Ablett has given me tips on PGO compiling using Intel C++ compiler. I only asked this since my compilers are not PGO enabled and usually the free stuffs (Borland, MingW, GCC, Cygwin, DEVCPP, Codeblocks,OpenWatcom, MSVC6) or I just missed the function. If it were Machine Design, Thermodynamics, Fluid Mechanics and the like, I woudn't even ask. But I'm simply dumb in this area, so I want to know additional info.

Re: Just a newbie: Are speed compiles and PGO compiles the s

PostPosted: 21 Dec 2006, 02:40
by Jim Ablett
Hello Juan,

The fastest executables are compiled with 'profile guided' options. If it says 'speed compile' more often than not it will have been compiled with these options. Bryan Hoffman adds extra code tweaks manually by hand such as adding extra 'inlining' instructions to gain extra speed - laborious, but that's why his compiles are the fastest.

You already have a 'PGO' compiler in your collection.
Add these commands GCC .

Compile with command-line switch '-fprofile-generate' to generate
profiling data.

Run some epd suites, play some matches,

then compile finally with '-fprofile-use'


Regards,
Jim,

Re: Just a newbie: Are speed compiles and PGO compiles the s

PostPosted: 21 Dec 2006, 09:33
by Vladimir Medvedev
Which minimal gcc version supports -fprofile-generate?
On my gcc ver. 3.3.3 (Linux) and ver. 3.2 (MinGW) I only get error message: unrecognized option `-fprofile-generate'

Re: Just a newbie: Are speed compiles and PGO compiles the s

PostPosted: 21 Dec 2006, 11:31
by Jim Ablett
Hello Vladimir;

Which minimal gcc version supports -fprofile-generate?
On my gcc ver. 3.3.3 (Linux) and ver. 3.2 (MinGW) I only get error message: unrecognized option `-fprofile-generate'


You need at least GCC/MinGW is 3.4..

Try these older commands which speeds up branch prediction,
and will give a healthy boost, especially on Pentiums.

Compile with '-fprofile-arcs'

Run some test suites and games.

Re-compile with '-fbranch-probabilities'

Jim.

Re: Just a newbie: Are speed compiles and PGO compiles the s

PostPosted: 21 Dec 2006, 23:47
by juan dela cruz
Jim,

Thanks again for these new infos. It's good to mention Bryan Hoffman since one good example is TogaII. His compiles are faster than the ones distributed at Alex Schmidt's site. I read a tutorial at Superchessengine.com which mentioned him, but the MSVC 2005 Std. Edition installed by my firend lacks some pgo****.dll which is needed for PGO.

I'm just an "IDE-enabled compiling idiot" so I'll have to give my best again using commandline. This DOS-like scripting is not so comfortable for late bloomers like me. Though DevCpp incorporates GCC compiler in its interface I often get chess engine compiles with no "nodes per second" and other data. I'm still figuring out where I went wrong. I'll give it a try using commandline until I get it this time. No guts, no glory!

Juan

Re: Just a newbie: Are speed compiles and PGO compiles the s

PostPosted: 22 Dec 2006, 07:15
by juan dela cruz
Jim Ablett wrote:Hello Juan,

The fastest executables are compiled with 'profile guided' options. If it says 'speed compile' more often than not it will have been compiled with these options. Bryan Hoffman adds extra code tweaks manually by hand such as adding extra 'inlining' instructions to gain extra speed - laborious, but that's why his compiles are the fastest.

You already have a 'PGO' compiler in your collection.
Add these commands GCC .

Compile with command-line switch '-fprofile-generate' to generate
profiling data.

Run some epd suites, play some matches,

then compile finally with '-fprofile-use'


Regards,
Jim,


----------------------------------------------------------------------------------

Jim,

Just to be sure, is this what you meant for the new profiling data scheme?

Example:
1. Use these switches:
-O3 -fomit-frame-pointer -fexpensive-optimizations -ffast-math
-finline-function -funroll-loops -ffloat-store
.... plus "-fprofile-generate" then compile.
2. Run some epd suites etc.. for a few minutes
3. Finally, compile using previous switches again:
-O3 -fomit-frame-pointer -fexpensive-optimizations -ffast-math
-finline-function -funroll-loops -ffloat-store
....plus "-fprofile-use"

Thanks pal and I'm sending back what you said.......Good luck with all your future projects and be careful. This little hobby will take over your life! :-)

Juan

Re: Just a newbie: Are speed compiles and PGO compiles the s

PostPosted: 22 Dec 2006, 11:06
by Jim Ablett
Just to be sure, is this what you meant for the new profiling data scheme?


Yes that's right. Just make sure when generating profile data, you run the compiled exe ('-fprofile-generate) where it is, don't move it then run it or when you come to use '-fprofile-use' it won't find the profile data. SO if it was first compiled in C:\Dev-Cpp\bin, run it from there, generate profile data and recompile from there.

Jim.