Visual C++ 2008 - good compiler/ linker settings for speed?

Discussion of chess software programming and technical issues.

Moderators: Harvey Williamson, bob, hgm

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
User avatar
Houdini
Posts: 1471
Joined: Mon Mar 15, 2010 11:00 pm
Contact:

Re: Visual C++ 2008 - good compiler/ linker settings for spe

Post by Houdini » Tue Apr 13, 2010 10:26 am

rvida wrote:
vladstamate wrote: I can testify to that. I got roughly 12% increase in speed (both when doing perft as well as normal search) by using PGO. In Visual Studio that is done as simply as clicking 3 buttons and waiting your program to run for some time so it gets some performance data. I was quite impressed.
You are a lucky one. Or you just happen to write "branchy" code. In my experience with Critter there is only cca 5% speedup from PGO :(
PGO improvements depend very much on the code.
On my current code PGO provokes a 2% slow-down compared to the normal /O2 /GL compile. PGO doesn't seem to achieve a lot apart from inflating the exe from 233 kB to 277 kB :(.

vladstamate
Posts: 161
Joined: Thu Jan 08, 2009 8:06 pm
Location: San Francisco, USA
Contact:

Re: Visual C++ 2008 - good compiler/ linker settings for spe

Post by vladstamate » Tue Apr 13, 2010 2:38 pm

Dann Corbit wrote: I have seen up to 30% for some engines.
I usually do the following sort of test during the profile sessions:
1. A couple hundred EPD test positions at 5 seconds each
2. At least ten games of engine verses engine.
3. Perft (if the engine has it) at depths 4/5/6
On the games, I have the GUI restart the engines after each game.
Is the pgo data produced by running the instrumented executable incremental? That is when you run it each time does it add to the same file or replace?

Also has anyone tried (successfully) pgo on gcc?

Regards,
Vlad

User avatar
silentshark
Posts: 284
Joined: Sat Mar 27, 2010 6:15 pm
Contact:

Re: Visual C++ 2008 - good compiler/ linker settings for spe

Post by silentshark » Tue Apr 13, 2010 6:10 pm

Dann Corbit wrote:
silentshark wrote:The subject field says it all, really. What are good compiler flags to wring out good speed from the MS C++ 2008 compiler?

So far, I've found the following are good:

/O2 - optimise speed
/arch:SSE2 - compile for platforms supporting SSE2 instruction set

But there are probably some other ones I haven't come across?

(And feel free to tell me to go and use compiler X, if I really should be trying something else for high speed code these days)

Regards,
Tom
The Intel compiler produces a little bit better results, most of the time.
Profile guided optimization produced a good gain almost all the time (for both Intel and MSVC++ compilers).
I will give pgo a go, although it looks like a need a better version of the dev. environment.. vc++ 2008 express appears to lack the pgo stuff :(

Is the Intel compiler a freebie?

tmokonen
Posts: 1144
Joined: Sun Mar 12, 2006 5:46 pm
Location: Kelowna
Full name: Tony Mokonen
Contact:

Re: Visual C++ 2008 - good compiler/ linker settings for spe

Post by tmokonen » Tue Apr 13, 2010 6:22 pm

The Intel compiler is not free, but you can download a trial version if you want to play with the compiler.

Dann Corbit
Posts: 11626
Joined: Wed Mar 08, 2006 7:57 pm
Location: Redmond, WA USA
Contact:

Re: Visual C++ 2008 - good compiler/ linker settings for spe

Post by Dann Corbit » Tue Apr 13, 2010 6:44 pm

vladstamate wrote:
Dann Corbit wrote: I have seen up to 30% for some engines.
I usually do the following sort of test during the profile sessions:
1. A couple hundred EPD test positions at 5 seconds each
2. At least ten games of engine verses engine.
3. Perft (if the engine has it) at depths 4/5/6
On the games, I have the GUI restart the engines after each game.
Is the pgo data produced by running the instrumented executable incremental? That is when you run it each time does it add to the same file or replace?

Also has anyone tried (successfully) pgo on gcc?

Regards,
Vlad
With MSVC++, each new pgo profile run creates a new file. When you perform the link, all the files get merged.

PGO works well with gcc also. However, my 64 bit GCC installation is flaky now and I have not been able to repair it.

Dann Corbit
Posts: 11626
Joined: Wed Mar 08, 2006 7:57 pm
Location: Redmond, WA USA
Contact:

Re: Visual C++ 2008 - good compiler/ linker settings for spe

Post by Dann Corbit » Tue Apr 13, 2010 6:45 pm

tmokonen wrote:The Intel compiler is not free, but you can download a trial version if you want to play with the compiler.
The Intel compiler is free for non-commercial use on Linux.

User avatar
silentshark
Posts: 284
Joined: Sat Mar 27, 2010 6:15 pm
Contact:

Re: Visual C++ 2008 - good compiler/ linker settings for spe

Post by silentshark » Wed Apr 14, 2010 8:12 pm

silentshark wrote:
Dann Corbit wrote:
silentshark wrote:The subject field says it all, really. What are good compiler flags to wring out good speed from the MS C++ 2008 compiler?

So far, I've found the following are good:

/O2 - optimise speed
/arch:SSE2 - compile for platforms supporting SSE2 instruction set

But there are probably some other ones I haven't come across?

(And feel free to tell me to go and use compiler X, if I really should be trying something else for high speed code these days)

Regards,
Tom
The Intel compiler produces a little bit better results, most of the time.
Profile guided optimization produced a good gain almost all the time (for both Intel and MSVC++ compilers).
I will give pgo a go, although it looks like a need a better version of the dev. environment.. vc++ 2008 express appears to lack the pgo stuff :(

Is the Intel compiler a freebie?
cool.. the pgo stuff in vc++ 2010 seems to give me about a 15% performance boost. Worth having..

Cardoso
Posts: 316
Joined: Thu Mar 16, 2006 6:39 pm
Location: Portugal
Full name: Alvaro Cardoso
Contact:

Re: Visual C++ 2008 - good compiler/ linker settings for spe

Post by Cardoso » Sun Apr 18, 2010 10:00 pm

My checkers engine is totaly dependent on the GUI for commands.
After I launch the GUI and it loads the engine is it possible to atach VS2008 to the engine process and execute the PGO?

Thanks,
Alvaro

User avatar
Greg Strong
Posts: 388
Joined: Sun Dec 21, 2008 5:57 pm
Location: Washington, DC

Re: Visual C++ 2008 - good compiler/ linker settings for spe

Post by Greg Strong » Mon Apr 19, 2010 12:15 am

Actually, you just build a PGO-instrumented build of your checkers engine and use that. Each time the program runs, it automatically outputs a file with the technical timing/performance data. You can then use this data to build a PGO optimized version. Visual studio doesn't itself need to be running for the profiling session.

Cardoso
Posts: 316
Joined: Thu Mar 16, 2006 6:39 pm
Location: Portugal
Full name: Alvaro Cardoso
Contact:

Many thanks (NT)

Post by Cardoso » Tue Apr 20, 2010 1:22 pm

Many thanks,
Alvaro

Post Reply