How To Get Consistent Floating Point Results Using Intel Compilers
Sometimes Discovery users find that their floating point C/C++/Fortran codes that were compiled with the Intel Compilers using -O2 and -O3 optimizations produce different results from one compiler version to another and when run on Intel and AMD processors.
Below is an excellent write-up of why these differences occur and which Intel compiler options can be used to control accuracy and reproducibility.
For those of you who may not want to take the time to read this 16-page document, here is a summary:
-
- Use –fp-model precise –fp-model source compiler options on Intel compilers v11 and later to improve the consistency and reproducibility of floating-point results while limiting the impact on performance.
- If reproducibility between different processor types of the same architecture is important, use also -fimf-arch-consistency=true. This option is available starting with Intel compiler version 12.
- Since your code will run a little slower when you use these options, it is a good idea to compare results with and without to see if using these options makes a significant difference to your results.