Intel® Math Kernel Library 2018 Developer Reference - C

mkl_mic_set_device_num_threads

Sets the maximum number of OpenMP* threads to use on an Intel Xeon Phi coprocessor for the Automatic Offload computations.

Syntax

int mkl_mic_set_device_num_threads (MKL_MIC_TARGET_TYPE target_type, int target_number, int num_threads);

Include Files

Input Parameters

Name

Type

Description

target_type

MKL_MIC_TARGET_TYPE

Type of the target device. Use the value of
MKL_TARGET_MIC - Intel Xeon Phi coprocessor, default.

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:

  • 0. Specifies execution on a specific coprocessor. The coprocessor is determined by target_number modulo the number of Intel Xeon Phi coprocessors on the system as returned by mkl_mic_get_device_count(). For example: for a system with 4 Intel Xeon Phi coprocessors, target_number = 6 determines the coprocessor number 2.

  • <0. Reserved.

num_threads

int

The number of threads to use for Automatic Offload computations on the target_number coprocessor. Must be greater than 0.

Description

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.

Note

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.

Return Values

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.

See Also