Visible to Intel only — GUID: GUID-63514789-6BE7-4FA8-9389-F3B618A2EE1A
Visible to Intel only — GUID: GUID-63514789-6BE7-4FA8-9389-F3B618A2EE1A
fp-model, fp
Controls the semantics of floating-point calculations.
Linux: |
-fp-model=keyword |
macOS: |
-fp-model=keyword |
Windows: |
/fp:keyword |
keyword |
Specifies the semantics to be used. Possible values are:
|
-fp-model=fast |
The compiler uses more aggressive optimizations on floating-point calculations. |
This option controls the semantics of floating-point calculations.
The keywords can be considered in groups:
Group A: precise, fast, strict
Group B: source
Group C: except (or negative forms -no-except or /except-)
Group D: consistent
You can specify more than one keyword. However, the following rules apply:
You cannot specify fast and except together in the same compilation. You can specify any other combination of group A, group B, and group C.
Since fast is the default, you must not specify except without a group A or group B keyword.You should specify only one keyword from group A and only one keyword from group B. If you try to specify more than one keyword from either group A or group B, the last (rightmost) one takes effect.
If you specify except more than once, the last (rightmost) one takes effect.
If you specify consistent and any other keyword from another group, the last (rightmost) one may not fully override the heuristics set by consistent.
The fp-model=fast (or /fp:fast) options and the fp-model=fast=2 (or /fp:fast=2) options behave differently with ifx and ifort.
With ifort, floating-point compares happen as specified by the IEEE floating-point standard, in that the code sequence generated for them assumes a compare can involve a NaN.
ifx does not generate the check for NaN operands. If you want to use option fp-model=fast (or /fp:fast) or option fp-model=fast=2 (or /fp:fast=2) with ifx and you want NaN compares to match ifort’s behavior, specify option assume nan_compares on the command line.
The floating-point (FP) environment is a collection of registers that control the behavior of FP machine instructions and indicate the current FP status. The floating-point environment may include rounding-mode controls, exception masks, flush-to-zero controls, exception status flags, and other floating-point related features.
Option |
Description |
---|---|
-fp-model=precise or /fp:precise |
Tells the compiler to strictly adhere to value-safe optimizations when implementing floating-point calculations. It disables optimizations that can change the result of floating-point calculations. These semantics ensure the reproducibility of floating-point computations for serial code, including code vectorized or auto-parallelized by the compiler, but they may slow performance. They do not ensure value safety or run-to-run reproducibility of other parallel code. Run-to-run reproducibility for floating-point reductions in OpenMP* code may be obtained for a fixed number of threads through the KMP_DETERMINISTIC_REDUCTION environment variable. For more information about this environment variable, see topic "Supported Environment Variables". The compiler assumes the default floating-point environment; you are not allowed to modify it. Note that option fp-model=precise implies fp-model=source and option fp:precise implies fp:source. Floating-point exception semantics are disabled by default. To enable these semantics, you must also specify -fp-model=except or /fp:except. |
-fp-model=fast[=1|2] or /fp:fast[=1|2] |
Tells the compiler to use more aggressive optimizations when implementing floating-point calculations. These optimizations increase speed, but may affect the accuracy or reproducibility of floating-point computations. Specifying fast is the same as specifying fast=1. fast=2 may produce faster and less accurate results. fast=2 sets assume nonan_compares for ifx, while it does not for ifort. To get ifort's behavior when compiling with ifx and fast=2, explicitly set the assume nan_compares option. Floating-point exception semantics are disabled by default. To enable these semantics, you must also specify -fp-model=except or /fp:except. |
-fp-model=consistent or /fp:consistent (ifort only) |
The compiler uses default heuristics to generate code that will determine results for different optimization levels or between different processors of the same architecture. For more information, see the article titled: Consistency of Floating-Point Results using the Intel® Compiler. |
-fp-model=strict or /fp:strict |
Tells the compiler to strictly adhere to value-safe optimizations when implementing floating-point calculations and enables floating-point exception semantics. This is the strictest floating-point model. The compiler does not assume the default floating-point environment; you are allowed to modify it. Floating-point exception semantics can be disabled by explicitly specifying -fp-model=no-except or /fp:except-. |
-fp-model=source or /fp:source (ifort only) |
This option causes intermediate results to be rounded to the precision defined in the source code. It also implies keyword precise unless it is overridden by a keyword from Group A. The compiler assumes the default floating-point environment; you are not allowed to modify it. |
-fp-model=except or /fp:except (ifort only) |
Tells the compiler to follow strict floating-point exception semantics. |
The -fp-model and /fp options determine the setting for the maximum allowable relative error for math library function results (max-error) if none of the following options are specified (the following options are only available for ifort):
-fimf-accuracy-bits (Linux* and macOS) or /Qimf-accuracy-bits (Windows*)
-fimf-max-error (Linux and macOS) or /Qimf-max-error (Windows)
-fimf-precision (Linux and macOS) or /Qimf-precision (Windows)
[Q]fast-transcendentals
Option -fp-model=fast (and /fp:fast) sets option -fimf-precision=medium (/Qimf-precision:medium) and option -fp-model=precise (and /fp:precise); it implies -fimf-precision=high (and /Qimf-precision:high).
Option -fp-model=fast=2 (and /fp:fast2) sets option -fimf-precision=medium (and /Qimf-precision:medium) and option -fimf-domain-exclusion=15 (and /Qimf-domain-exclusion=15).
This option cannot be used to change the default (source) precision for the calculation of intermediate results.
In Microsoft* Visual Studio, when you create a Visual Studio* Fortran project, option /fp:fast is set by default. It sets the floating-point model to use more aggressive optimizations when implementing floating-point calculations, which increase speed, but may affect the accuracy or reproducibility of floating-point computations. /fp:fast is the general default for the IDE project property for Floating Point Model.
Product and Performance Information |
---|
Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex. Notice revision #20201201 |
Visual Studio: Floating Point > Floating Point Model
Floating Point > Reliable Floating Point Exceptions Model
None
See Also
The article titled: Consistency of Floating-Point Results using the Intel® Compiler