Developer Reference

  • 2020.2
  • 07/15/2020
  • Public Content
Contents

mkl_set_dynamic

Enables
Intel® MKL
to dynamically change the number of OpenMP* threads.

Syntax

call mkl_set_dynamic
(
flag
)
Fortran Include Files/Modules
  • Include file:
    mkl.fi
  • Module (compiled):
    mkl_service.mod
  • Module (source):
    mkl_service.f90
Input Parameters
Name
Type
Description
flag
INTEGER
flag
= 0 - Requests disabling dynamic adjustment of the number of threads.
flag
0 - Requests enabling dynamic adjustment of the number of threads.
Description
This function indicates whether
Intel® MKL
can dynamically change the number of OpenMP threads or should avoid doing this. The setting applies to all
Intel® MKL
functions on all execution threads. This function takes precedence over the
MKL_DYNAMIC
environment variable.
Dynamic adjustment of the number of threads is enabled by default. Specifically,
Intel® MKL
may use fewer threads in parallel regions than the number returned by themkl_get_max_threadsfunction. Disabling dynamic adjustment of the number of threads does not ensure that
Intel® MKL
actually uses the specified number of threads, although the library attempts to use that number.
If you call
Intel® MKL
from within an OpenMP parallel region and want to create internal parallel regions, either disable dynamic adjustment of the number of threads or set the thread-local number of threads (seemkl_set_num_threads_local for how to do it).

Example

use mkl_service … call mkl_set_num_threads( 8 ) !$omp parallel call my_compute_with_mkl ! Intel MKL uses 1 thread, being called from OpenMP parallel region
call mkl_set_dynamic(0) ! disable adjustment of the number of threads
call my_compute_with_mkl ! Intel MKL uses 8 threads !$omp end parallel

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804