Developer Reference for Intel® oneAPI Math Kernel Library for C
Getting Started with Conditional Numerical Reproducibility
Intel® oneAPI Math Kernel Library (oneMKL) offers functions and environment variables to help you get reproducible results. You can configure Intel® oneMKL using functions or environment variables, but the functions provide more flexibility.
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 Intel® oneMKL functions running in the CNR mode, but refer to Reproducibility Conditions for details related to data alignment.
Intel CPUs Supporting Intel AVX2
To ensure Intel® oneMKL calls return the same results on every Intel CPU supporting Intel AVX2 instructions:
Make sure that your application uses a fixed number of threads
(Recommended) Properly align input and output arrays in Intel® oneMKL function calls
-
- Do either of the following:
-
Call mkl_cbwr_set(MKL_CBWR_AVX2)
-
- Set the environment variable:
-
Linux: export MKL_CBWR = AVX2
Windows: set MKL_CBWR = AVX2
Intel CPUs Supporting Intel SSE2
To ensure Intel® oneMKL calls return the same results on every Intel CPU supporting Intel SSE2 instructions:
Make sure that your application uses a fixed number of threads
(Recommended) Properly align input and output arrays in Intel® oneMKL function calls
-
- Do either of the following:
-
Call mkl_cbwr_set(MKL_CBWR_SSE2)
-
- Set the environment variable:
-
Linux: export MKL_CBWR = SSE2
Windows: set MKL_CBWR = SSE2
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 Intel® oneMKL calls return the same results on all Intel or Intel compatible CPUs supporting Intel SSE2 instructions:
Make sure that your application uses a fixed number of threads
(Recommended) Properly align input and output arrays in Intel® oneMKL function calls
-
- Do either of the following:
-
Call mkl_cbwr_set(MKL_CBWR_COMPATIBLE)
-
- Set the environment variable:
-
Linux: export MKL_CBWR = COMPATIBLE
Windows: set MKL_CBWR = COMPATIBLE
Intel GPUs
To ensure that selected oneMKL calls return the same results on every Intel GPU, do either of the following:
Call mkl_cbwr_set(MKL_CBWR_AUTO) .
-
- Set the following environment variable:
-
Linux: export MKL_CBWR = AUTO
Windows: set MKL_CBWR=AUTO .
Next Steps
See Setting the Environment Variable for Conditional Numerical Reproducibility for details of specifying the branch using environment variables.
See the following sections in the Intel® oneMKL Developer Reference:
Support Functions for Conditional Numerical Reproducibility for how to configure the CNR mode of Intel® oneMKL using functions.
Intel® oneMKL PARDISO - Parallel Direct Sparse Solver Interface 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 |