Calling Intel MKL Functions from Multi-threaded Applications

This section summarizes typical usage models and available options for calling Intel MKL functions from multi-threaded applications. These recommendations apply to any multi-threading environments: OpenMP*, Intel® Threading Building Blocks, Windows* threads, and others.

Usage model: disable Intel MKL internal threading for the whole application

When used: Intel MKL internal threading interferes with application's own threading or may slow down the application.

Example: the application is threaded at top level, or the application runs concurrently with other applications.

Options:

  • Link statically or dynamically with the sequential library

  • Link with the Single Dynamic Library mkl_rt.lib and select the sequential library using an environment variable or a function call:

    • Set MKL_THREADING_LAYER=sequential

    • Call mkl_set_threading_layer(MKL_THREADING_SEQUENTIAL)

  • Link with a threading library, but disable Intel MKL threading using an environment variable or a function call:

    • set MKL_NUM_THREADS=1

    • call mkl_set_num_threads(1).

      In particular, use to temporarily disable Intel MKL threading at run time.

  • Link with the Single Dynamic Library mkl_rt.lib and select a threading library using an environment variable or a function call below, but disable threading as in the case above:

    • set MKL_THREADING_LAYER=intel

    • call mkl_set_threading_layer(MKL_THREADING_INTEL)

For details of the mentioned functions, see the Support Functions section of the Intel MKL Reference Manual, available in the Intel Software Documentation Library.

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

For more complete information about compiler optimizations, see our Optimization Notice.