Developer Reference for Intel® oneAPI Math Kernel Library for Fortran

ID 766686
Date 12/16/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

mkl_domain_get_max_threads

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

Syntax

nt = mkl_domain_get_max_threads( domain )

Fortran Include Files/Modules
  • Include file: mkl.fi
  • Module (compiled): mkl_service.mod
  • Module (source): mkl_service.f90
Input Parameters

Name

Type

Description

domain

INTEGER

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:

  • A call to mkl_set_num_threads_local

  • The last of the calls to mkl_set_num_threads or mkl_domain_set_num_threads( …, MKL_DOMAIN_ALL)

  • A call to mkl_domain_set_num_threads( …, domain)

  • The MKL_DOMAIN_NUM_THREADS environment variable with the MKL_DOMAIN_ALL tag

  • The MKL_DOMAIN_NUM_THREADS environment variable (with the specific domain tag)

  • The MKL_NUM_THREADS environment variable

  • A call to omp_set_num_threads

  • The OMP_NUM_THREADS environment variable

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

INTEGER*4

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
use mkl_service
…
if (1 < mkl_domain_get_max_threads(MKL_DOMAIN_BLAS)) then
print *, "Intel MKL BLAS functions employ threading"
end if