Intel® Math Kernel Library 2018 Developer Reference - C
Sets the maximum number of OpenMP* threads to use on an Intel Xeon Phi coprocessor for the Automatic Offload computations.
int mkl_mic_set_device_num_threads (MKL_MIC_TARGET_TYPE target_type, int target_number, int num_threads);
Name |
Type |
Description |
---|---|---|
target_type |
MKL_MIC_TARGET_TYPE |
Type of the target device. Use the value of |
target_number |
int |
The coprocessor number for which the maximum number of threads to be used for Automatic Offload computations is set. Takes the following values:
|
num_threads |
int |
The number of threads to use for Automatic Offload computations on the target_number coprocessor. Must be greater than 0. |
The mkl_mic_set_device_num_threads function enables you to limit the number of OpenMP threads to use for Automatic Offload computations on a specific Intel Xeon Phi coprocessor.
This function takes precedence over the MIC_OMP_NUM_THREADS and MKL_MIC_<number>_OMP_NUM_THREADS environment variables (see the Intel MKL Developer Guide for details).
Unless the maximum number of threads is set by the environment variables or this function, Intel MKL uses all coprocessor cores.
Call mkl_mic_set_device_num_threads before initialization of Automatic Offload mode. Otherwise the function returns -1 without setting the number of threads.
Automatic Offload mode can be initialized as follows:
explicitly, in a call to the mkl_mic_enable function.
implicitly, in the first call to an Intel MKL function that does Automatic Offload computations (for example: ?GEMM). See the Intel MKL Release Notes for which functions support Automatic Offload mode.
The mkl_mic_set_device_num_threads function sets the maximum number of threads to use for the Automatic Offload computations on Intel Xeon Phi coprocessors only. To control host CPU threading, use general threading control functions and see "Using Additional Threading Control" in the Intel MKL Developer Guide for more information.
Name |
Type |
Description |
---|---|---|
ierr |
int |
Result status: = 0 Indicates that the number of threads is set successfully. < 0 Indicates a failure to set the number of threads. |