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

Running results are different for an application from compiling -O0 option and -O3 option

Lyndon_L_
Beginner
430 Views

Hi,

    I am running some climate models and met an annoying problem. If the climate model was compiled wih debug mode -O0 (using intel/12.1.9.293 and openmpi 1.4.3), then the running result is totally different from that running model compiled with -O3 option.

    Could someone please tell me if this is normal?  Should a model compiled with debug mode be used in production runs?

     Many thanks.

Cheers,

Lyndon.

0 Kudos
6 Replies
TimP
Honored Contributor III
430 Views

You may need to investigate questions such as whether the differences are resolved by

-fp-model precise

(or some of the components of that group option)

It may help to know if there are accepted build options for another compiler, such as gcc.  If -O3 isn't acceptable for gcc, you might conclude the application isn't robust enough for more than -O1.

Then, if there are only small differences remaining, you must make you own assessment about repeatability vs. performance.

You will expect differences from MPI when you change distribution of ranks.  It's helpful to have a generally accepted test case.

0 Kudos
Armando_Lazaro_Alami
430 Views

Are you mixing  float and double in your code ?  If this is your case try  /fp:double

0 Kudos
TimP
Honored Contributor III
430 Views

Armando Lazaro Alaminos Bouza wrote:

Are you mixing  float and double in your code ?  If this is your case try  /fp:double

If the application is compiled for 32-bit mode, the default for gcc (and, until about 4 years ago) for icc) was x87 mode, with implicit double (-mia32 option for your version if 32-bit icc) or long double evaluation of expressions.  At -O3, the double evaluation effect could extend across assignments.

/fp:double forces implicit promotion of float expression evaluation, as was expected by traditional C implementations prior to 20 years ago.  If that produces variations in results, it would verify a problem of that nature.  With the default -msse2 architecture of current Intel compilers, there is no implicit data type promotion, and this explanation of differences between -O0 and -O3 seems remote.

0 Kudos
TimP
Honored Contributor III
430 Views

The forum is acting strangely.  A few minutes ago, a response by Heinz B early today replaced all the others, and now that one has disappeared.

0 Kudos
jimdempseyatthecove
Honored Contributor III
430 Views

>>The forum is acting strangely.

I am geting some 504 problems and clicks to links are abysmally slow.

If I get a 504 on a post, it is iffy as to if the post makes it to the website.

Jim Dempsey

0 Kudos
Bernard
Valued Contributor I
430 Views

Lyndon can you post some results?

0 Kudos
Reply