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

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Houdini
Posts: 1471
Joined: Tue Mar 16, 2010 12:00 am

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

Post by Houdini »

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 9:06 pm
Location: San Francisco, USA

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

Post by vladstamate »

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: 327
Joined: Sat Mar 27, 2010 7:15 pm

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

Post by silentshark »

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: 1296
Joined: Sun Mar 12, 2006 6:46 pm
Location: Kelowna
Full name: Tony Mokonen

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

Post by tmokonen »

The Intel compiler is not free, but you can download a trial version if you want to play with the compiler.
Dann Corbit
Posts: 12537
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

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

Post by Dann Corbit »

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: 12537
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

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

Post by Dann Corbit »

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: 327
Joined: Sat Mar 27, 2010 7:15 pm

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

Post by silentshark »

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: 362
Joined: Thu Mar 16, 2006 7:39 pm
Location: Portugal
Full name: Alvaro Cardoso

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

Post by Cardoso »

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 6:57 pm
Location: Washington, DC

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

Post by Greg Strong »

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: 362
Joined: Thu Mar 16, 2006 7:39 pm
Location: Portugal
Full name: Alvaro Cardoso

Many thanks (NT)

Post by Cardoso »

Many thanks,
Alvaro