Getting Started with Conditional Numerical Reproducibility
Intel® oneAPI Math Kernel Library
Intel® oneAPI Math Kernel Library
The following specific examples introduce you to the conditional numerical reproducibility.
While these examples recommend aligning input and output data, you can supply unaligned data to
functions running in the CNR mode, but refer toReproducibility Conditions for details related to data alignment.
Intel® oneAPI Math Kernel Library
Intel CPUs supporting Intel AVX2
To ensure
calls return the same results on every Intel CPU supporting Intel AVX2 instructions:
Intel® oneAPI Math Kernel Library
- Make sure that your application uses a fixed number of threads
- (Recommended) Properly align input and output arrays infunction callsIntel® oneAPI Math Kernel Library
- Do either of the following:
- Callmkl_cbwr_set(MKL_CBWR_AVX2)
- Set the environment variable:export MKL_CBWR = AVX2
On non-Intel CPUs and on Intel CPUs that do not support Intel AVX2, this environment setting may cause results to differ because the
AUTO
branch is used instead, while the above function call returns an error and does not enable the CNR mode.
Intel CPUs supporting Intel SSE2
To ensure
calls return the same results on every Intel CPU supporting Intel SSE2instructions:
Intel® oneAPI Math Kernel Library
- Make sure that your application uses a fixed number of threads
- (Recommended) Properly align input and output arrays infunction callsIntel® oneAPI Math Kernel Library
- Do either of the following:
- Callmkl_cbwr_set(MKL_CBWR_SSE2)
- Set the environment variable:export MKL_CBWR = SSE2
On non-Intel CPUs, this environment setting may cause results to differ because the
AUTO
branch is used instead, while the above function call returns an error and does not enable the CNR mode.
Intel or Intel compatible CPUs supporting Intel SSE2
On non-Intel CPUs, only the
MKL_CBWR_AUTO
and
MKL_CBWR_COMPATIBLE
options are supported for function calls and only
AUTO
and
COMPATIBLE
options for environment settings.
To ensure
calls return the same results on all Intel or Intel compatible CPUs supporting Intel SSE2
instructions:
Intel® oneAPI Math Kernel Library
- Make sure that your application uses a fixed number of threads
- (Recommended) Properly align input and output arrays infunction callsIntel® oneAPI Math Kernel Library
- Do either of the following:
- Callmkl_cbwr_set(MKL_CBWR_COMPATIBLE)
- Set the environment variable:export MKL_CBWR = COMPATIBLE
The special
does not use these instructions and forces a single Intel SSE2 only code path to be executed.
MKL_CBWR_COMPATIBLE/COMPATIBLE
option is provided because Intel and Intel compatible CPUs have a few instructions, such as approximation instructions rcpps/rsqrtps, that may return different results. This option ensures that
Intel® oneAPI Math Kernel Library
Next steps
- for details of specifying the branch using environment variables.
See the following sections in the
Developer Reference:
Intel® oneAPI Math Kernel Library
- Support Functions for Conditional Numerical Reproducibility
- for how to configure the CNR mode ofusing functions.Intel® oneAPI Math Kernel Library
- PARDISO - Parallel Direct Sparse Solver InterfaceIntel® oneAPI Math Kernel Library
- for how to configure the CNR mode for PARDISO.
Product and Performance Information
|
---|
Performance varies by use, configuration and other factors. Learn more at
www.Intel.com/PerformanceIndex.
Notice revision #20201201
|