The best compiler for chess, Intel or gcc or something else?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Has GCC caught up with Intel with respect to performance?

Poll ended at Sun Oct 14, 2012 4:32 pm

Yes
15
60%
No
10
40%
 
Total votes: 25

User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

The best compiler for chess, Intel or gcc or something else?

Post by Don »

This issue has come up in another thread - I have heard conflicting reports over the past few years.

Some say that gcc as of version 4.6 and 4.7 is now at least the equal of Intel with respect to producing binaries that perform well - particularly due to improved link time optimization and a massive improvement in PGO.

Traditionally however Intel has always had the edge. What is the truth?

Both compilers are available for Windows and Linux - are there any platform differences? For instance is the Intel compiler crippled on Linux?
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
rbarreira
Posts: 900
Joined: Tue Apr 27, 2010 3:48 pm

Re: The best compiler for chess, Intel or gcc or something e

Post by rbarreira »

ICC used to have an edge even when PGO was not used. In my experience this is not the case anymore since gcc 4.5.

When PGO is used, it's possible that ICC still has an edge. Probably a small one, if anything (something like 5-10%).

GCC has an edge in being able to generate hardware-agnostic binaries, whereas ICC creates executables that either don't run on AMD at all, or run with a crappy codepath which deliberately cripples performance. This is well documented and was proven in court:

http://www.agner.org/optimize/blog/read.php?i=49
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: The best compiler for chess, Intel or gcc or something e

Post by Don »

rbarreira wrote:ICC used to have an edge even when PGO was not used. In my experience this is not the case anymore since gcc 4.5.

When PGO is used, it's possible that ICC still has an edge. Probably a small one, if anything (something like 5-10%).

GCC has an edge in being able to generate hardware-agnostic binaries, whereas ICC creates executables that either don't run on AMD at all, or run with a crappy codepath which deliberately cripples performance. This is well documented and was proven in court:

http://www.agner.org/optimize/blog/read.php?i=49
Mincho Georgiev is claiming that the Intel compiler produces exactly the same quality binaries on both platforms but that it's GCC that produces the disparity.

Has anyone tried the Intel compiler on BOTH platforms and proved that there is no difference in speed? I have a difficult time believing that the same compiler (gcc) would produce significantly different code on Windows but that Intel would not.

I have 2 dual boot machines - so I can check this out if someone will produce an Intel binary for each platform of stockfish for example. I want to verify this claim because it doesn't make sense to me.
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
ZirconiumX
Posts: 1334
Joined: Sun Jul 17, 2011 11:14 am

Re: The best compiler for chess, Intel or gcc or something e

Post by ZirconiumX »

My answer is 'it depends'.

ICC is extremely good on Intel architectures, but crippled on AMD.
GCC is a jack of all trades. It is about equal on intel and amd.

Being devil's advocate, I suggest you look at Clang, which is mostly equal on intel and amd, and employs run-time optimizations as well as compile-time optimizations. LTO is non-existent though, and it cannot handle multiarch. However, it is a monster on -O3.

Also, DragonEgg is a GCC plugin which includes the Clang optimzers. Apparently -fplugin-arg-dragonegg-enable-gcc-optzns gives 'ultimate performance' by using the already excellent GCC and Clang optimizers.

YMMV.

Matthew:out
Some believe in the almighty dollar.

I believe in the almighty printf statement.
User avatar
velmarin
Posts: 1600
Joined: Mon Feb 21, 2011 9:48 am

Re: The best compiler for chess, Intel or gcc or something e

Post by velmarin »

I compiled with Intel in Visual Studio,
My machine is AMD Phenom II X4, supports SSE4.2,
my compilations run on any machine with the proper DLL,
I think with a good performance.
Still GCC is my experience with less, I can not give a good opinion on comparisons.

No more trick that does not include specific Headers of Intel compiler options.

Code: Select all

Performance Libraries — The Intel Performance Library family consists of a set
of software libraries optimized for Intel architecture processors. The library
family includes the following:
— Intel® Integrated Performance Primitives (Intel® IPP)
— Intel® Math Kernel Library (Intel® MKL)
— Intel® Threading Building Blocks (Intel® TBB)
Tom Likens
Posts: 303
Joined: Sat Apr 28, 2012 6:18 pm
Location: Austin, TX

Re: The best compiler for chess, Intel or gcc or something e

Post by Tom Likens »

Don wrote:This issue has come up in another thread - I have heard conflicting reports over the past few years.

Some say that gcc as of version 4.6 and 4.7 is now at least the equal of Intel with respect to producing binaries that perform well - particularly due to improved link time optimization and a massive improvement in PGO.

Traditionally however Intel has always had the edge. What is the truth?

Both compilers are available for Windows and Linux - are there any platform differences? For instance is the Intel compiler crippled on Linux?
Don,

My experience is that the GCC has caught up with Intel when you use GCC 4.6+ (I'm currently using the default 64-bit version 4.6.3 that comes with Linux Mint vs. icpc (ICC) 13.0.0 20120731). This wasn't true for earlier versions of the Gnu compiler; then Intel had a substantial lead, especially when PGO was selected. At that time ICC was roughly 30% faster after PGO optimization.

I do have one question for you, previously you said that you were able to run PGO on a GCC compiled linux version and use it for optimizing a MingW version (same gcc version for both of course). I've tried this but it doesn't seem to work for me. I get a lot of messages that the optimizer can't find a large number of the functions (the name C++ name-mangling algorithm seems different) and the final Windows executable doesn't seem any faster than a straight MingW compile.

Could you elaborate a bit more on exactly how you got that to work, as it would be nice not to leave a 10-15% performance boost on the table. Is Komodo a C or C++ program? That might be the difference as my engine is written in C++.

regards,
--tom
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: The best compiler for chess, Intel or gcc or something e

Post by Don »

Tom Likens wrote:
Don wrote:This issue has come up in another thread - I have heard conflicting reports over the past few years.

Some say that gcc as of version 4.6 and 4.7 is now at least the equal of Intel with respect to producing binaries that perform well - particularly due to improved link time optimization and a massive improvement in PGO.

Traditionally however Intel has always had the edge. What is the truth?

Both compilers are available for Windows and Linux - are there any platform differences? For instance is the Intel compiler crippled on Linux?
Don,

My experience is that the GCC has caught up with Intel when you use GCC 4.6+ (I'm currently using the default 64-bit version 4.6.3 that comes with Linux Mint vs. icpc (ICC) 13.0.0 20120731). This wasn't true for earlier versions of the Gnu compiler; then Intel had a substantial lead, especially when PGO was selected. At that time ICC was roughly 30% faster after PGO optimization.

I do have one question for you, previously you said that you were able to run PGO on a GCC compiled linux version and use it for optimizing a MingW version (same gcc version for both of course). I've tried this but it doesn't seem to work for me. I get a lot of messages that the optimizer can't find a large number of the functions (the name C++ name-mangling algorithm seems different) and the final Windows executable doesn't seem any faster than a straight MingW compile.

Could you elaborate a bit more on exactly how you got that to work, as it would be nice not to leave a 10-15% performance boost on the table. Is Komodo a C or C++ program? That might be the difference as my engine is written in C++.

regards,
--tom
In another thread someone reports that "MSVC version without PGO was 10% faster then the GCC version with the PGO."

But Dragan, who reports this, does not say what compiler options are used.

Don
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
Tom Likens
Posts: 303
Joined: Sat Apr 28, 2012 6:18 pm
Location: Austin, TX

Re: The best compiler for chess, Intel or gcc or something e

Post by Tom Likens »

Don wrote:
Tom Likens wrote:
Don wrote:This issue has come up in another thread - I have heard conflicting reports over the past few years.

Some say that gcc as of version 4.6 and 4.7 is now at least the equal of Intel with respect to producing binaries that perform well - particularly due to improved link time optimization and a massive improvement in PGO.

Traditionally however Intel has always had the edge. What is the truth?

Both compilers are available for Windows and Linux - are there any platform differences? For instance is the Intel compiler crippled on Linux?
Don,

My experience is that the GCC has caught up with Intel when you use GCC 4.6+ (I'm currently using the default 64-bit version 4.6.3 that comes with Linux Mint vs. icpc (ICC) 13.0.0 20120731). This wasn't true for earlier versions of the Gnu compiler; then Intel had a substantial lead, especially when PGO was selected. At that time ICC was roughly 30% faster after PGO optimization.

I do have one question for you, previously you said that you were able to run PGO on a GCC compiled linux version and use it for optimizing a MingW version (same gcc version for both of course). I've tried this but it doesn't seem to work for me. I get a lot of messages that the optimizer can't find a large number of the functions (the name C++ name-mangling algorithm seems different) and the final Windows executable doesn't seem any faster than a straight MingW compile.

Could you elaborate a bit more on exactly how you got that to work, as it would be nice not to leave a 10-15% performance boost on the table. Is Komodo a C or C++ program? That might be the difference as my engine is written in C++.

regards,
--tom
In another thread someone reports that "MSVC version without PGO was 10% faster then the GCC version with the PGO."

But Dragan, who reports this, does not say what compiler options are used.

Don
It's possible, I don't have any experience with Visual C++.

regards,
--tom
rbarreira
Posts: 900
Joined: Tue Apr 27, 2010 3:48 pm

Re: The best compiler for chess, Intel or gcc or something e

Post by rbarreira »

Don wrote:
Tom Likens wrote:
Don wrote:This issue has come up in another thread - I have heard conflicting reports over the past few years.

Some say that gcc as of version 4.6 and 4.7 is now at least the equal of Intel with respect to producing binaries that perform well - particularly due to improved link time optimization and a massive improvement in PGO.

Traditionally however Intel has always had the edge. What is the truth?

Both compilers are available for Windows and Linux - are there any platform differences? For instance is the Intel compiler crippled on Linux?
Don,

My experience is that the GCC has caught up with Intel when you use GCC 4.6+ (I'm currently using the default 64-bit version 4.6.3 that comes with Linux Mint vs. icpc (ICC) 13.0.0 20120731). This wasn't true for earlier versions of the Gnu compiler; then Intel had a substantial lead, especially when PGO was selected. At that time ICC was roughly 30% faster after PGO optimization.

I do have one question for you, previously you said that you were able to run PGO on a GCC compiled linux version and use it for optimizing a MingW version (same gcc version for both of course). I've tried this but it doesn't seem to work for me. I get a lot of messages that the optimizer can't find a large number of the functions (the name C++ name-mangling algorithm seems different) and the final Windows executable doesn't seem any faster than a straight MingW compile.

Could you elaborate a bit more on exactly how you got that to work, as it would be nice not to leave a 10-15% performance boost on the table. Is Komodo a C or C++ program? That might be the difference as my engine is written in C++.

regards,
--tom
In another thread someone reports that "MSVC version without PGO was 10% faster then the GCC version with the PGO."

But Dragan, who reports this, does not say what compiler options are used.

Don
Does he say what version of GCC was used?

BTW, my post above is written with regards to Linux, I haven't used many Windows compilers lately.
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: The best compiler for chess, Intel or gcc or something e

Post by diep »

rbarreira wrote:ICC used to have an edge even when PGO was not used. In my experience this is not the case anymore since gcc 4.5.

When PGO is used, it's possible that ICC still has an edge. Probably a small one, if anything (something like 5-10%).

GCC has an edge in being able to generate hardware-agnostic binaries, whereas ICC creates executables that either don't run on AMD at all, or run with a crappy codepath which deliberately cripples performance. This is well documented and was proven in court:

http://www.agner.org/optimize/blog/read.php?i=49
GCC 4.5 is duck slow.

PGO never worked ok in GCC. Was total sabotaged. gcc 4.7 is big improvement of course (could be 4.6.x series started that) yet intel c++ is faster for majority of software, as intel c++ wins 20%-30% speed by pgo for Diep and GCC just 7%.

I don't know 100% what's the problem with GCC but it always needs more instructions and always did.

Intel c++ is 7-11% faster for diep than GCC 4.7.0.

Maybe by rewriting lots of 'signed integer' code to unsigned integer code i can reduce that difference, but it will keep an edge for intel c++.

Diep really suffers losing 7-11% just like that.

I see no difference between intel c++ for linux versus windows but i didn't measure things real accurate.

If GCC would be better compiler then Intel c++ cannot afford optimizing to code that objectively is slower. They can pick 'alternatives' that are slower yet they would not be able to have code paths that objectively are slower for both cpu's.

Please note that todays GCC is duck slow for AMD processors.
GCC 4.7 versus 4.5 wins a lot of speed for intel processors yet not for AMD processors.

GCC still is optimizing their code to code paths that fall just outside the reorder of AMD processors i get impression and just within intel processors reordering, if i say it technical correct.

So it's still sabotaged to run faster on intel yet not on AMD.

There's no excuse for doing that to be honest.

As i run mainly on intel core2 Xeons here of course i'm not going to accurately test this out here - i don't have the time for this.

You could also argue that it's AMD's fault - they should simply pay some dudes to improve GCC for AMD as well.

If GCC would do it ok for AMD, intel c++ can no longer do what it's doing there. They WANT and NEED to be faster than GCC on AMD.