Contents

Threading Control

Intel® oneAPI Math Kernel Library
provides functions for OpenMP* threading control, discussed in this section.
If
Intel® oneAPI Math Kernel Library
operates within the Intel® Threading Building Blocks (Intel® TBB) execution environment, the environment variables for OpenMP* threading control, such as
OMP_NUM_THREADS
, and
Intel® oneAPI Math Kernel Library
functions discussed in this section have no effect. If the Intel TBB threading technology is used, control the number of threads through the Intel TBB application programming interface. Read the documentation for the
tbb::task_scheduler_init
class at https://www.threadingbuildingblocks.org/documentation to find out how to specify the number of Intel TBB threads.
If
Intel® oneAPI Math Kernel Library
operates within an OpenMP* execution environment, you can control the number of threads for
Intel® oneAPI Math Kernel Library
using OpenMP* run-time library routines and environment variables (see the OpenMP* specification for details). Additionally
Intel® oneAPI Math Kernel Library
provides
optional
threading control functions and environment variables that enable you to specify the number of threads for
Intel® oneAPI Math Kernel Library
and to control dynamic adjustment of the number of threads
independently
of the OpenMP* settings. The settings made with the
Intel® oneAPI Math Kernel Library
threading control functions and environment variables do not affect OpenMP* settings but take precedence over them.
If none of the threading control functions is used,
Intel® oneAPI Math Kernel Library
environment variables may control
Intel® oneAPI Math Kernel Library
threading. For details of those environment variables, see the
Intel® oneAPI Math Kernel Library
Developer Guide
.
You can specify the number of threads for
Intel® oneAPI Math Kernel Library
function domains with themkl_set_num_threads or mkl_domain_set_num_threads function. While
mkl_set_num_threads
specifies the number of threads for the entire
Intel® oneAPI Math Kernel Library
,
mkl_domain_set_num_threads
does it for a specific function domain. The following table lists the function domains that support independent threading control. The table also provides named constants to pass to threading control functions as a parameter that specifies the function domain.
oneMKL
Function Domains
Function Domain
Named Constant
Basic Linear Algebra Subroutines (BLAS)
MKL_DOMAIN_BLAS
Fast Fourier Transform (FFT) functions, except Cluster FFT functions
MKL_DOMAIN_FFT
Vector Math (VM) functions
MKL_DOMAIN_VML
Parallel Direct Solver (PARDISO) functions
MKL_DOMAIN_PARDISO
All
Intel® oneAPI Math Kernel Library
functions except the functions from thedomains where the number of threads is set explicitly
MKL_DOMAIN_ALL
Do not increase the number of OpenMP threads used for cluster_sparse_solver between the first call and the factorization or solution phase. Because the minimum amount of memory required for out-of-core execution depends on the number of OpenMP threads, increasing it after the initial call can cause incorrect results.
Both
mkl_set_num_threads
and
mkl_domain_set_num_threads
functions set the number of threads for all subsequent calls to
Intel® oneAPI Math Kernel Library
from all applications threads. Use themkl_set_num_threads_localfunction to specify different numbers of threads for
Intel® oneAPI Math Kernel Library
on different execution threads of your application. The thread-local settings take precedence over the global settings. However, the thread-local settings may have undesirable side effects (see the description of the
mkl_set_num_threads_local
function for details).
By default,
Intel® oneAPI Math Kernel Library
canadjust the specified number of threads dynamically. For example,
Intel® oneAPI Math Kernel Library
may use fewer threads if the size of the computation is not big enough or not create parallel regions when running within an OpenMP* parallel region. Although
Intel® oneAPI Math Kernel Library
may actually use a different number of threads from the number specified, the library does not create parallel regions with more threads than specified. If dynamic adjustment of the number of threads is disabled,
Intel® oneAPI Math Kernel Library
attempts to use the specified number of threads in internal parallel regions (for more information, see the
Intel® oneAPI Math Kernel Library
Developer Guide
). Use the mkl_set_dynamic function to control dynamic adjustment of the number of threads.

Product and Performance Information

1

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