The options described in this section all provide optimizations with varying degrees of precision in floating-point (FP) arithmetic for IA-32 and ItaniumŪ compilers.
The -mp1 (IA-32 only) and -mp options improve floating-point precision, but also affect the application performance. See more details about these options in Improving/Restricting FP Arithmetic Precision.
The FP options provide optimizations with varying degrees of precision in floating-point arithmetic. The option that disables these optimizations is -O0.
Use -mp to limit floating-point optimizations and maintain declared precision. For example, the IntelŪ Fortran Compiler can change floating-point division computations into multiplication by the reciprocal of the denominator. This change can alter the results of floating point division computations slightly. The -mp switch may slightly reduce execution speed. See Improving/Restricting FP Arithmetic Precision for more detail.
Use the -mp1 option to restrict floating-point precision to be closer to declared precision with less impact to performance than with the -mp option. The option will ensure the out-of-range check of operands of transcendental functions and improve accuracy of floating-point compares.
Option -ftz[-] flushes denormal results to zero when the application is in the gradual underflow mode. Flushing the denormal values to zero with -ftz may improve performance of your application.
The default status of -ftz[-] is OFF. By default, the compiler lets results gradually underflow. With the default -O2 option, -ftz[-] is OFF.
On Itanium-based systems only, the -O3 option turns on -ftz.
If the -ftz option produces undesirable results of the numerical behavior of your program, you can turn the FTZ mode off by using -ftz- in the command line while still benefiting from the -O3 optimizations:
ifort -O3 -ftz- myprog.f
Use this option if the denormal values are not critical to application behavior.
-ftz[-] only needs to be used on the source that contains the main() program to turn the FTZ mode on. The initial thread, and any threads subsequently created by that process, will operate in FTZ mode.
The -ftz[-] option affects the results of floating underflow as follows:
-ftz- results in gradual underflow to 0: the result of a floating underflow is a denormalized number or a zero.
-ftz results in abrupt underflow to 0: the result of a floating underflow is set to zero and execution continues. -ftz also makes a denormal value used in a computation be treated as a zero so no floating invalid exception occurs. On Itanium-based systems, the -O3 option sets the abrupt underflow to zero (-ftz is on). At lower optimization levels, gradual underflow to 0 is the default on the Itanium-based systems.
On IA-32, setting abrupt underflow by -ftz may improve performance of SSE/SSE2 instructions, while it does not affect either performance or numerical behavior of x87 instructions. Thus, -ftz will have no effect unless you select -x{} or -ax{} options, which activate instructions of the more recent IA-32 Intel processors.
On Itanium-based processors, gradual underflow to 0 can degrade performance.
Using higher optimization levels to get the default abrupt underflow or
explicitly setting -ftz improves performance.
-ftz may improve performance on ItaniumŪ 2 processor,
even in the absence of actual underflow, most frequently for single-precision
code.
Use the -fpe n option to control the handling of exceptions. The -fpe n option controls floating-point exceptions according to the value of n.
The following are the kinds of floating-point exceptions:
Floating overflow: the result of a computation is too large for the floating-point data type. The result is replaced with the exceptional value Infinity with the proper "+" or "-" sign. For example, 1E30 * 1E30 overflows single-precision floating-point value and results in a +Infinity; -1E30 * 1E30 results in a -Infinity.
Floating divide-by-zero: if the computation is 0.0 / 0.0, the result is the exceptional value NaN (Not a Number), a value that means the computation was not successful. If the numerator is not 0.0, the result is a signed Infinity.
Floating underflow: the result of a computation is too small for the floating-poinit type. Each floating-point type (32-, 64-, and 128-bit) has a denormalized range where very small numbers can be represented with some loss of precision. For example, the lower bound for normalized single-precision floating-point value is approximately 1E-38; the lower bound for denormalized single-precision floating-point value is 1E-45. 1E-30 / 1E10 underflows the normalized range but not the denormalized range so the result is the denormal exceptional value 1E-40. 1E-30 / 1E30 underflows the entire range and the result is zero. This is known as gradual underflow to 0.
Floating invalid: when the exceptional value (signed Infinities, NaN, denormal) is used as input to a computation, the result is also a NaN.
The -fpen option allows some control over the results of floating-point exception handling at run time for the main program.
-fpe0 restricts floating-point exceptions as follows:
Floating overflow, floating divide-by-zero, and floating invalid cause the program to print an error message and abort.
If a floating underflow occurs, the result is set to zero and execution continues. This is called abrupt underflow to 0.
-fpe1 restricts only floating underflow:
Floating overflow, floating divide-by-zero, and floating invalid produce exceptional values (NaN and signed Infinities) and execution continues.
If a floating underflow occurs, the result is set to zero and execution continues.
The default is -fpe3 on both IA-32 and Itanium-based processors. This allows full floating-point exception behavior:
Floating overflow, floating divide-by-zero, and floating invalid produce exceptional values (NaN and signed Infinities) and execution continues.
Floating underflow is gradual: denormalized values are produced until the result becomes 0.
The -fpen only affects the Fortran main program. The floating-point exception behavior set by the Fortran main program is in effect throughout the execution of the entire program. If the main program is not Fortran, you can use the Fortran intrinsic FOR_SET_FPE to set the floating-point exception behavior.
When compiling different routines in a program separately, you should use the same value of n in -fpen.
For more information, refer to the Intel Fortran Compiler User's Guide for Linux* Systems, Volume I, section "Controlling Floating-point Exceptions."