- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Intel Fortran Compiler Professional for applications running on IA-32, Version 11.0 Build 20090131
I have a small program that I wrote that is producing different results based on whether or not the -g flag is passed to the compiler. I boiled down the compiler flags and narrowed it down to the -g flag producing the difference. When compiled with debugging symbols, the assembler output indicates it is using the standard floating point registers (using simple "flds", "fmulp", etc instructions), however without the -g flag it is using the SSE registers (%xmm1, %xmm0, etc) instead, which are producing drastically different results. I'm not sure if this is a compiler issue or an SSE issue (or something I'm doing), but the output of compiling the following files as such is:
ifort -g -o test_math test_math.for
./test_math
RESULT OF MATH OPERATION 6758.8686523
ifort -o test_math test_math.for
./test_math
RESULT OF MATH OPERATION 6758.8691406
I would consider the difference between those two operations (0.0004883) to be more significant than machine precision, but that's obviously just my opinion. Should the standard floating point registers and the SSE registers be producing results that are that different?
It should be noted that when I compile the same code with the 12.0.0 version of the compiler, it uses the SSE registers for all math operations, irrespective of the -g flag (this is how we discovered this issue: trying to explain the differences between our programs when compiled the 11.x and 12.x versions).
Thoughts?
P.S. -- The UNIONs in the sample file is so I could load the exact value that was causing the issue in our sample program, so I could be sure I was accurately reproducing the issue.
I have a small program that I wrote that is producing different results based on whether or not the -g flag is passed to the compiler. I boiled down the compiler flags and narrowed it down to the -g flag producing the difference. When compiled with debugging symbols, the assembler output indicates it is using the standard floating point registers (using simple "flds", "fmulp", etc instructions), however without the -g flag it is using the SSE registers (%xmm1, %xmm0, etc) instead, which are producing drastically different results. I'm not sure if this is a compiler issue or an SSE issue (or something I'm doing), but the output of compiling the following files as such is:
ifort -g -o test_math test_math.for
./test_math
RESULT OF MATH OPERATION 6758.8686523
ifort -o test_math test_math.for
./test_math
RESULT OF MATH OPERATION 6758.8691406
I would consider the difference between those two operations (0.0004883) to be more significant than machine precision, but that's obviously just my opinion. Should the standard floating point registers and the SSE registers be producing results that are that different?
It should be noted that when I compile the same code with the 12.0.0 version of the compiler, it uses the SSE registers for all math operations, irrespective of the -g flag (this is how we discovered this issue: trying to explain the differences between our programs when compiled the 11.x and 12.x versions).
Thoughts?
P.S. -- The UNIONs in the sample file is so I could load the exact value that was causing the issue in our sample program, so I could be sure I was accurately reproducing the issue.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
It's not unusual.
Check:
http://software.intel.com/en-us/articles/consistency-of-floating-point-results-using-the-intel-compiler/
You should find that without -g, but with -fp-model precise, you get the same answer. Speed vs. accuracy is the tradeoff there, and each application needs to decide which is more important.
Tim
It's not unusual.
Check:
http://software.intel.com/en-us/articles/consistency-of-floating-point-results-using-the-intel-compiler/
You should find that without -g, but with -fp-model precise, you get the same answer. Speed vs. accuracy is the tradeoff there, and each application needs to decide which is more important.
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
-fp-model precise doesn't necessarily make x87 extended precision results the same as with an SSE compilation, as x87 mode involves double precision evaluation. As the effect of -g without a -O specification is to set -O0, the double precision effect isn't taken as far as it would be with -O.
It's still a good idea to set one of the math correctness options (-assume protect_parens or -fp-model .....). If your SSE2 results aren't acceptably close to your IA32 compilation results, you should also look into whether you need explicit promotion of some expressions to double precision.
It's still a good idea to set one of the math correctness options (-assume protect_parens or -fp-model .....). If your SSE2 results aren't acceptably close to your IA32 compilation results, you should also look into whether you need explicit promotion of some expressions to double precision.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page