Developer Reference

  • 2021.1
  • 12/04/2020
  • Public Content

Usage Examples for CNR Support Functions

The following examples illustrate usage of support functions for conditional numerical reproducibility.

Setting Automatically Detected CNR Branch

#include <mkl.h> int main(void) { int my_cbwr_branch; /* Find the available MKL_CBWR_BRANCH automatically */ my_cbwr_branch = mkl_cbwr_get_auto_branch(); /* User code without Intel MKL calls */ /* Piece of the code where CNR of Intel MKL is needed */ /* The performance of Intel MKL functions might be reduced for CNR mode */ if (mkl_cbwr_set(my_cbwr_branch)!=MKL_CBWR_SUCCESS) { printf("Error in setting MKL_CBWR_BRANCH! Aborting…\n"); return; } /* CNR calls to Intel MKL + any other code */ }

Use of the

#include <mkl.h> int main(void) { int my_cbwr_branch; /* Piece of the code where CNR of Intel MKL is analyzed */ my_cbwr_branch = mkl_cbwr_get(MKL_CBWR_BRANCH); switch (my_cbwr_branch) { case MKL_CBWR_AUTO: /* actions in case of automatic mode */ break; case MKL_CBWR_SSSE3: /* actions for SSSE3 code */ break; default: /* all other cases */ } /* User code */ }
Optimization Notice
Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.
Notice revision #20110804
This notice covers the following instruction sets: SSE2, SSE4.2, AVX2, AVX-512.

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at