Setting thread affinity on SMT or HT enabled systems for better performance

Simultaneous MultiThreading (SMT) or 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.  However, Intel MKL fits neither of these criteria because 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 by disabling HT/SMT Technology.  See Using the Intel® MKL Parallelism for information on the default number of threads, changing this number, and other relevant details.

If you run with SMT/HT enabled, performance may be especially impacted if you run on fewer threads than physical cores.  Moreover, if, for example, there are two threads to every physical core, the thread scheduler may assign two threads to some cores and ignore the other ones altogether. If you are using the OpenMP* library of the Intel Compiler, read the respective User Guide on how to best set the thread affinity interface to avoid this situation.


For Intel MKL, you are recommended to set

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



Optimization Notice in English

Пожалуйста, обратитесь к странице Уведомление об оптимизации для более подробной информации относительно производительности и оптимизации в программных продуктах компании Intel.