Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7944 Discussions

Change in floating optimization from 10.1 to 12.0

amaigil
Beginner
362 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
362 Views
The latest compiler is doing more aggresive optimization.The "-fp-model source" compiler option might be helpful.
0 Kudos
TimP
Honored Contributor III
362 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)?
0 Kudos
italo1337
Beginner
362 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).

0 Kudos
amaigil
Beginner
362 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
0 Kudos
mecej4
Honored Contributor III
362 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.
0 Kudos
Reply