Threading Control
Intel® oneAPI Math Kernel Library
If
operates within the Intel® Threading Building Blocks (Intel® TBB) execution environment, the environment variables for OpenMP* threading control, such as 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
Intel® oneAPI Math Kernel Library
OMP_NUM_THREADS
, and
Intel® oneAPI Math Kernel Library
tbb::task_scheduler_init
class at
https://www.threadingbuildingblocks.org/documentation to find out how to specify the number of Intel TBB threads.
If
operates within an OpenMP* execution environment, you can control the number of threads for
using OpenMP* run-time library routines and environment variables (see the OpenMP* specification for details). Additionally
provides and to control dynamic adjustment of the number of threads threading control functions and environment variables do not affect OpenMP* settings but take precedence over them.
Intel® oneAPI Math Kernel Library
Intel® oneAPI Math Kernel Library
Intel® oneAPI Math Kernel Library
optional
threading control functions and environment variables that enable you to specify the number of threads for
Intel® oneAPI Math Kernel Library
independently
of the OpenMP* settings. The settings made with the
Intel® oneAPI Math Kernel Library
If none of the threading control functions is used,
environment variables may control
threading. For details of those environment variables, see the Developer Guide.
Intel® oneAPI Math Kernel Library
Intel® oneAPI Math Kernel Library
Intel® oneAPI Math Kernel Library
You can specify the number of threads for
function domains with themkl_set_num_threads or
mkl_domain_set_num_threads function. While
,
Intel® oneAPI Math Kernel Library
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.
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 | 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
from all applications threads. Use themkl_set_num_threads_localfunction to specify different numbers of threads for
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
and
mkl_domain_set_num_threads
functions set the number of threads for all subsequent calls to
Intel® oneAPI Math Kernel Library
Intel® oneAPI Math Kernel Library
mkl_set_num_threads_local
function for details).
By default,
canadjust the specified number of threads dynamically. For example,
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
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,
attempts to use the specified number of threads in internal parallel regions (for more information, see the Developer Guide). Use the
mkl_set_dynamic function to control dynamic adjustment of the number of threads.
Intel® oneAPI Math Kernel Library
Intel® oneAPI Math Kernel Library
Intel® oneAPI Math Kernel Library
Intel® oneAPI Math Kernel Library
Intel® oneAPI Math Kernel Library