Developer Guide

Developer Guide for Intel® oneAPI Math Kernel Library Windows*

ID 766692
Date 6/24/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Linking with Threading Libraries

Intel® oneAPI Math Kernel Library (oneMKL) threading layer defines how Intel® oneAPI Math Kernel Library (oneMKL) functions utilize multiple computing cores of the system that the application runs on. You must link your application with one appropriate Intel® oneAPI Math Kernel Library (oneMKL) library in this layer, as explained below. Depending on whether this is a threading or a sequential library, Intel® oneAPI Math Kernel Library (oneMKL) runs in a parallel or sequential mode, respectively.

In the parallel mode, Intel® oneAPI Math Kernel Library (oneMKL) utilizes multiple processor cores available on your system, uses the OpenMP*or Intel TBB threading technology, and requires a proper threading runtime library (RTL) to be linked with your application. Independently of use of Intel® oneAPI Math Kernel Library (oneMKL), the application may also require a threading RTL. You should link not more than one threading RTL to your application. Threading RTLs are provided by your compiler. Intel® oneAPI Math Kernel Library (oneMKL) provides several threading libraries, each dependent on the threading RTL of a certain compiler, and your choice of the Intel® oneAPI Math Kernel Library (oneMKL) threading library must be consistent with the threading RTL that you use in your application.

The OpenMP RTL of the Intel® compiler is the libiomp5md.lib library, located under <parent directory>\compiler\lib. You can find additional information about the Intel OpenMP RTL at https://www.openmprtl.org.

The Intel TBB RTL of the Intel® compiler is the tbb12.lib library, located under <parent directory>\tbb\lib. You can find additional information about the Intel TBB RTL at https://www.threadingbuildingblocks.org.

In the sequential mode, Intel® oneAPI Math Kernel Library (oneMKL) runs unthreaded code, does not require an threading RTL, and does not respond to environment variables and functions controlling the number of threads. Avoid using the library in the sequential mode unless you have a particular reason for that, such as the following:

  • Your application needs a threading RTL that none of Intel® oneAPI Math Kernel Library (oneMKL) threading libraries is compatible with
  • Your application is already threaded at a top level, and using parallel Intel® oneAPI Math Kernel Library (oneMKL) only degrades the application performance by interfering with that threading
  • Your application is intended to be run on a single thread, like a message-passing interface (MPI) application

It is critical to link the application with the proper RTL. The table below explains what library in the Intel® oneAPI Math Kernel Library (oneMKL) threading layer and whatthreading RTL you should choose under different scenarios:

Application

Intel® oneAPI Math Kernel Library (oneMKL)

RTL Required

Uses OpenMP Compiled with

Execution Mode

Threading Layer

no

any compiler

parallel

Static linking:

mkl_intel_thread.lib

Dynamic linking:

mkl_intel_thread_dll.lib

libiomp5md.lib

no

any compiler

parallel

Static linking:

mkl_tbb_thread.lib

Dynamic linking:

mkl_tbb_thread_dll.lib

tbb12.lib

no

any compiler

sequential

Static linking:

mkl_sequential.lib

Dynamic linking:

mkl_sequential_dll.lib

none

yes

Intel compiler

parallel

Static linking:

mkl_intel_thread.lib

Dynamic linking:

mkl_intel_thread_dll.lib

libiomp5md.lib

yes

PGI* compiler

parallel

Static linking:

mkl_pgi_thread.lib (DEPRECATED)

Dynamic linking:

mkl_pgi_thread_dll.lib (DEPRECATED)

PGI OpenMP RTL

yes

any other compiler

parallel

Not supported. Use Intel® oneAPI Math Kernel Library (oneMKL) in the sequential mode.

 

Product and Performance Information

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.

Notice revision #20201201