Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
7568 Discussions

Change in floating optimization from 10.1 to 12.0

amaigil
Beginner
118 Views
Hello,

I am trying to rebuild a project with icc 12.0.0 20101116 which were done before with 10.1.xxx. In addition to some changes about the language I unfortunately get slightly different results for floating arithmetics, and differences between debug and release builds indicate it's about optimization. So only 12.x debug code reproduces the results for 10.1 debug&release builds (which were using the same compiler flags).
The math operations are mostly basic +-*/ and some pow()/sqrt(), os(linux)&hardware are the very same.

Now I wonder if there was some obvious change about the optimization defaults?

Regards
Alexander

0 Kudos
5 Replies
Om_S_Intel
Employee
118 Views
The latest compiler is doing more aggresive optimization.The "-fp-model source" compiler option might be helpful.
TimP
Black Belt
118 Views
Are you talking about the change in default architecture for the 32-bit compiler? 10.1 32-bit defaulted to x87 code, as set by /arch:IA32 in the current compilers, which implies double evaluation of float expressions, and extended double for pow(). If you require (double) evaluation of all float expressions, without setting IA32 mode, /fp:double should do that, but you should get better efficiency by specifying where it is required in the source code.
As Om mentioned, you need a /fp: option in order to suppress K&R traditional style optimizations, and there may be a few cases where the difference is more glaring in the new compiler, but that would not seem to be implied by "basic operations," whatever that means (float operands with desired double evaluation)?
italo1337
Beginner
118 Views

Do you use OpenMP on your code? I am also getting different results in my code with v12, and it is related to OpenMP and optimizations in my case.

Try disabling OpenMP. Also try disabling the optimizations (/O0 or /O1 works for me).

amaigil
Beginner
118 Views
Short update:
there is no OpenMP used in our code. Also the resulting binaries turned out to be unusable: where the previous icc 11.x produced binaries working everywhere, 12.x gave me segmentations faults (on some machines) and a hard time in fruitless attempts to understand the problem.
So for now I am back to 11.1.

Regards
Alexander
mecej4
Black Belt
118 Views
There may be any number of reasons for the problems that you described, but little can be done unless you provide specific details, including if possible a small program and a description of how it can be compiled and run in specified environments to reproduce the claimed failures.

Creating such a reproducer does require some effort but the result is of much value. In fact, during the preparation of the reproducer you may discover properties of your code that you were not aware of.
Reply