Intel MKL threading behavior on Hyper-Threading systems

Intel MKL threading behavior on Hyper-Threading systems

Chao Y (Intel)'s picture

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...

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

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
woshiwuxin's picture

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!

CPU: Intel Core 2 Duo 2.4 GHz OS: Mac OS X 10.5.8 Linux: Debian 5.0 x86_64 Compiler: Intel Fortran Compiler 11.1 & Intel C++ Compiler 11.1 (with Intel MKL included)

Login to leave a comment.