mkl_set_num_threads
mkl_set_num_threads
Specifies the number of OpenMP* threads to use.
Syntax
void mkl_set_num_threads
(
int
nt
)
;
Include Files
- mkl.h
Input Parameters
Name | Type | Description |
---|---|---|
nt | int | nt > 0 - The number of threads suggested by the user.nt ≤ 0 - Invalid value, which is ignored. |
Description
This function enables you to specify how many OpenMP threads should use for internal parallel regions. If this number is not set (default), functions use the default number of threads for the OpenMP run-time library. The specified number of threads applies:
Intel® oneAPI Math Kernel Library
Intel® oneAPI Math Kernel Library
- To allfunctions except the functions from the domains where the number of threads is set withmkl_domain_set_num_threadsIntel® oneAPI Math Kernel Library
- To all execution threads except the threads where the number of threads is set with mkl_set_num_threads_local
The number specified is a hint, and may actually use a smaller number.
Intel® oneAPI Math Kernel Library
This function takes precedence over the
MKL_NUM_THREADS
environment variable.Example
#include "mkl.h" … mkl_set_num_threads(4); my_compute_using_mkl(); // Intel MKL uses up to 4 OpenMP threads