Intel® oneAPI Math Kernel Library Developer Reference - C

mkl_domain_get_max_threads

Gets the number of OpenMP* threads targeted for parallelism for a particular function domain.

Syntax

int mkl_domain_get_max_threads (int domain);

Include Files

Input Parameters

Name

Type

Description

domain

int

The named constant that defines the targeted domain.

Description

Computational functions of the Intel® oneAPI Math Kernel Library function domain defined by thedomain parameter use the value returned by this function as a limit of the number of OpenMP threads they should request for parallel computations. The mkl_domain_get_max_threads function returns the thread-local number of threads or, if that value is zero or not set, the global number of threads. To determine this number, the function inspects the environment settings and return values of the function calls below in the order they are listed until it finds a non-zero value:

Actual number of threads used by the Intel® oneAPI Math Kernel Library computational functions may vary depending on the problem size and on whether dynamic adjustment of the number of threads is enabled (see the description ofmkl_set_dynamic). For a list of supported values of the domain argument, see Table "Intel MKL Function Domains".

Return Values

Name

Type

Description

nt

int

The maximum number of threads for Intel® oneAPI Math Kernel Library functions from a given domain to use in internal parallel regions.

If an invalid value of domain is supplied, the function returns the number of threads for MKL_DOMAIN_ALL

Example

#include "mkl.h"
…
if (1 < mkl_domain_get_max_threads(MKL_DOMAIN_BLAS)) 
puts("Intel MKL BLAS functions employ threading");