Recommended settings for calling Intel MKL routines from multi-threaded1 applications.
Choose linking model
Set additional parameters2
Link with sequential threading layer of MKL.
MKL threading is not needed.
Example: you believe the threads of your application utilize all physical cores of the system, or MKL threading will lead to oversubscription3.
Link with parallel threading layer of MKL.
MKL_NUM_THREADS = 1
Use parameters below to enable MKL threading inside the threading of your application.
Enable MKL threading - use when you are sure that there are enough resources (physical cores) for MKL threading in addition to your own threads. Choose N carefully.
application has 2 threads, each thread calls MKL and the system has 8 cores: it's reasonable to set MKL_NUM_THREADS=4.
MKL function is called from a critical section of a parallel region - set MKL_NUM_THREADS=N, where N is the number of physical cores in the system ( or use mkl_set_num_thread( N) routine ) .
set additional options when the application is based on OpenMP* threads.
Apply these options if MKL is called from an OpenMP* parallel region and you want to enable both OpenMP* and MKL threading.
MKL_DOMAIN_NUM_THREADS = "DOMAIN=N"
The MKL_DOMAIN_ALL variable affects on all MKL routines.
|This option may reduce possible oversubscription from MKL threading. This option leads to a dynamic reduction of number of OpenMP* threads based on analysis of system workload.|
Available in the Intel® OpenMP* (libiomp5 library).
For Environment settings and best known methods of using Intel MKL on Intel® Xeon Phi™ coprocessor, refer to the Article Environment Settings on Intel® Xeon Phi™ Coprocessor