My Intel Fortran application which uses MKL functions Pardiso and Feast to solve large matrices (of the order of 30,000 rows) only lights up 4 of the 8 threads on an Intel i7-870 processor, whereas an MS-C# application doing non-matrix things lights up all 8 threads. The processor is quite old (2009) and has 4 cores with 8 threads.
Does anyone know why the ifort is only using 4 threads and whether or not I could change a setting when compiling to get it to use all 8 threads? I realise that if all 4 cores are fully busy with 4 threads then the other 4 threads won't help, but I'm just wondering if anyone could shed some more light on the issue.
You may refer to the MKL userguide. There are some tips to talking about the MKL thread and how to set the thread based on your request.
The library uses OpenMP* threading software, so you can use the environment variable
OMP_NUM_THREADS to specify the number of threads or the equivalent OpenMP run-time function calls. Intel MKL also offers variables that are independent of OpenMP, such as
MKL_NUM_THREADS, and equivalent Intel MKL functions for thread management. The Intel MKL variables are always inspected first, then the OpenMP variables are examined, and if neither is used, the OpenMP software chooses the default number of threads.
By default, Intel MKL uses the number of threads equal to the number of physical cores on the system. (generally, for the HT machine, like i7-870 processor, MKL use 4 thread by design for high performance, please see the below article)
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.
If you'd like to try other thread number, you can set the number of threads to the number of processors or physical cores, as summarized in Techniques to Set the Number of Threads.