| Last Modified On : | September 18, 2009 5:33 PM PDT |
Rate |
|
Consistency of Floating-Point Results using the Intel® Compiler
or
Why doesn’t my application always give the same answer?
Dr. Martyn J. Corden
David Kreitzer
Software Solutions Group
Intel Corporation
Introduction
Binary floating-point [FP] representations of most real numbers are inexact, and there is an inherent uncertainty in the result of most calculations involving floating-point numbers. Programmers of floating-point applications typically have the following objectives:
• Accuracy
o Produce results that are “close” to the result of the exact calculation
- Usually measured in fractional error, or sometimes “units in the last place” (ulp).
• Reproducibility
o Produce consistent results:
- From one run to the next;
- From one set of build options to another;
- From one compiler to another
- From one processor or operating system to another
• Performance
o Produce an application that runs as fast as possible
These objectives usually conflict! However, good programming practices and judicious use of compiler options allow you to control the tradeoffs.
For example, it is sometimes useful to have a degree of reproducibility that goes beyond the inherent accuracy of a computation. Some software quality assurance tests may require close, or even bit-for-bit, agreement between results before and after software changes, even though the mathematical uncertainty in the result of the computation may be considerably larger. The right compiler options can deliver consistent, closely reproducible results while preserving good (though not optimal) performance.
....................<omitted>........................
Bottom Line
Compiler options let you control the tradeoffs between accuracy, reproducibility and performance. Use /fp:precise /fp:source (Windows) or –fp-model precise –fp-model source (Linux or Mac OS X) to improve the consistency and reproducibility of floating-point results while limiting the impact on performance.
For the complete article, please open the attached PDF file.
You can't download and save it directly, but you may save it after having opened it.

English | 中文 | Русский | Français
Martyn Corden (Intel)
|
tim18
68,747
Status Points:
68,747
Future CPUs are planned to correct many of the performance problems associated with IEEE gradual underflow.
One of the more significant and less risky optimizations removed by -fp:source is "vectorized" sum or dot product reduction.
ifort has compatibility options not available in Intel C/C++:
-assume:protect_parens,minus0
The combination ifort -assume:protect_parens,minus0 -Qprec-div -Qprec-sqrt (slight changes in spellings for linux/Mac) removes some of the more standards-incompliant features without disabling important optimizations. protect_parens (like -fp-source) requires compliance with parentheses; -minus0 set compliance with f95 and f2003 standard on treatment of negative 0
Setting compatibility options in ifort.cfg, icc.cfg, icpc.cfg in the compiler installation may be helpful in avoiding problems without having to remember to set the options every time.