Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6981 Discussions

Intel MKL threading behavior on Hyper-Threading systems

Chao_Y_Intel
Moderator
1,598 Views


Hyper-Threading Technology (HT Technology) is especially effective when each thread is performing different types of operations and when there are under-utilized resources on the processor. Intel MKL fits neither of these criteria as the threaded portions of the library execute at high efficiencies using most of the available resources and perform identical operations on each thread. You may obtain higher performance when using Intel MKL without HT Technology enabled.


If the requested number of threads exceeds the number of physical cores (perhaps because of hyper-threading), and MKL_DYNAMIC is not changed from its default value (the default is TRUE), Intel MKL will scale down the number of threads to the number of physical cores. In some hyper-threading system, users may find Intel MKL may run with only half of total LOGICAL threadings. If users want to control the total threading numbers, users can change

MKL_DYNAMIC=FALSE
MKL_NUM_THREADS= number of the threadings.



Moreover, whenrun MKL at Hyper-Threading systems, there are two threads to every physical core, the thread scheduler may assign two threads to some cores and ignore the other ones altogether. You can check the document of OpenMP* library to set the thread affinity interface to avoid this situation. For Intel MKL, you are recommended to set:

KMP_AFFINITY=granularity=fine,compact,1,0.


To find more information on MKL threading, users can check the following two article on MKL threading:

Intel MKL 10.0 threading:
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-intel-mkl-100-threading/

Setting thread affinity on SMT or HT enabled systems for better performance:
http://software.intel.com/en-us/articles/setting-thread-affinity-on-smt-or-ht-enabled-systems/


0 Kudos
1 Reply
woshiwuxin
Novice
1,598 Views
I'm really glad to read this post!
I recently bought an Intel i3 laptop, and was confused about only two threads were launched automatically.
Yes, setting up 4 threads does NOT help!
0 Kudos
Reply