Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
36 Views

Matching floating point outputs between Visual C++ 11 and Intel Compiler

I am recompiling a computational program created in Visual Studio 2012 with Intel compiler from Parallel Studio 2017. The Visual Studio project has the floating point model set to /fp:precise In turn, I made sure it's also set to /fp:precise and /fp:source under Floating point expression evaluation. However, the outputs can still differ by 10^-5. In certain instances, the outputs differ by 10^5 with the original value  in the neighborhood of 10^5. What can I do to make the floating number output match closer ? I even disabled the use of MKL and it was not helping.

Thx,

Cliff

0 Kudos
4 Replies
Highlighted
Black Belt
36 Views

We would need more information on your platform choice etc.  If I remember correctly, if you targeted 32-bit mode with Visual Studio, the default should resemble ICL with options /arch:IA32 /fp:double. 

ICL /fp:source is closest to MSVC++ /fp:fast which ought to get you defaulted to equivalent of /arch:SSE2.

There is also ICL /fp:consistent.  I don't know if that is intended to help match MSVC++.

I hope you check at least the build log to see if the options you intend are echoed there.  Presumably, if you make multiple settings of /fp: the last one should rule.

0 Kudos
Highlighted
Valued Contributor II
36 Views

I wounder if one of these two C++ compilers is set to generate Fused-Multiply-Add ( FMA ) instructions?
0 Kudos
Highlighted
Valued Contributor II
36 Views

Here are a couple of recommendations: 1. Check FPU Control Word using _control87, _controlfp or _controlfp_s CRT-functions for executables generated with both C++ compilers. If FPU Control Words are different then FPUs initialized using different settings ( look at float.h header file for more information ). 2. In case of Intel C++ compiler verify if Flush Denormal Results to Zero compiler option ( /Qftz ) is used, or Not used. 3. In order to make FP results consistent for executables generated by different C++ compilers a call to _control87 CRT-function with the same settings could be needed ( before main processing! ). 4. It is Not clear what Instruction Sets are generated by both C++ compilers.
0 Kudos
Highlighted
Valued Contributor II
36 Views

Also, try to set: - for Intel C++ compiler - Fast=2 (/fp:fast=2) [Intel C++] and - for Microsoft C++ compiler - Fast (/fp:fast) Note: I use these options in all Release configurations for both C++ compilers.
0 Kudos