|On this page
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).
MKL_CBWR environment variable
The possible values for the environment variable, from slowest/most compatible to fastest/least compatible, are
Setting the variable to
AUTOuses the best instructions available on the current computer.
For non-Intel x86 processors (Ryzen), you can only set the variable to
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
,STRICTto 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.