On this page |
Overview ¶
Generating effects using floating-point math creates the challenge of being fast while producing exactly the same results across every run (reproducibility).
The main thing affecting reproducible results is the non-associativity of most floating point operations, however different runtimes, selectable optimized code paths, non-deterministic threading and parallelism, array alignment, and hardware floating-point control settings can all affect it.
Several nodes use Intel’s Math Kernel Library to speed up common floating-point operations using processor extensions such as SSE and AVX. On Intel and compatible processors, you can use the MKL_CBWR
environment variable to control how the library balances speed and reproducible results.
For more information see Intel’s white paper on MKL and reproducibility (PDF).
Setting the MKL_CBWR
environment variable
¶
-
The possible values for the environment variable, from slowest/most compatible to fastest/least compatible, are
COMPATIBLE
,SSE2
,SSE4_2
,AVX
, andAUTO
. -
Setting the variable to
AUTO
uses the best instructions available on the current computer. -
For non-Intel x86 processors (Ryzen), you can only set the variable to
AUTO
orCOMPATIBLE
modes. -
For Intel processors, you set the variable to choose a specific ISA extension level. This lets you set up a group of computers with different processors to use the same lowest common set of extensions, increasing reproducibility between those machines.
See spcifying code branches in Intel’s library documentation.
-
You can increase reproducibility at the expense of speed by appending
,STRICT
to the variable value. This switches some (but not all) library functions to implementations that are slower but more reproducible.See the reproducibility conditions in Intel’s library documentation.
See also |