Developer Reference for Intel® oneAPI Math Kernel Library for Fortran

ID 766686
Date 11/07/2023
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_set_num_threads

Specifies the number of OpenMP* threads for a particular function domain.

Syntax

ierr = mkl_domain_set_num_threads( nt, domain )

Fortran Include Files/Modules

  • Include file: mkl.fi
  • Module (compiled): mkl_service.mod
  • Module (source): mkl_service.f90

Input Parameters

Name

Type

Description

nt

INTEGER

nt > 0 - The number of threads suggested by the user.

nt = 0 - The default number of threads for the OpenMP run-time library.

nt < 0 - Invalid value, which is ignored.

domain

INTEGER

The named constant that defines the targeted domain.

Description

This function specifies how many OpenMP threads a particular function domain of Intel® oneAPI Math Kernel Library (oneMKL) should use. If this number is not set (default) or if it is set to zero in a call to this function, Intel® oneAPI Math Kernel Library (oneMKL) uses the default number of threads for the OpenMP run-time library. The number of threads specified applies to the specified function domain on all execution threads except the threads where the number of threads is set withmkl_set_num_threads_local. For a list of supported values of the domain argument, see Table "Intel MKL Function Domains".

The number of threads specified is only a hint, and Intel® oneAPI Math Kernel Library (oneMKL) may actually use a smaller number.

NOTE:

This function takes precedence over the MKL_DOMAIN_NUM_THREADS environment variable.

Return Values

Name

Type

Description

ierr

INTEGER

1 - Indicates no error, execution is successful.

0 - Indicates a failure, possibly because of invalid input parameters.

Example

use mkl_service
integer(4) :: status
…
status = mkl_domain_set_num_threads(4, MKL_DOMAIN_BLAS)
call my_compute_with_mkl_blas()	!Intel MKL BLAS functions use up to 4 threads
call my_compute_with_mkl_dft()	 !Intel MKL FFT functions use the default number of threads