topic threading problem in MKL in IntelĀ® oneAPI Math Kernel Library & IntelĀ® Math Kernel Library
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/threading-problem-in-MKL/m-p/813247#M4074
Hi, m<SPAN style="font-family: verdana, sans-serif;">y 2 cents in addition to the previous comments.</SPAN><DIV></DIV><DIV>Yes, it's correct that MKL hardly benefits form Heper-Threading, but if you want (just to compare) you may force MKL to use 4 threads:</DIV><DIV></DIV><DIV>mkl_set_num_threads(4);<BR />mkl_set_dynamic(0);</DIV><DIV></DIV><DIV>The point is that if mkl_dynamic is 1, than MKL will reduce the number of threads down to 2 (a number of physical cores) due to perfromance considerations. And if mkl_dynamic is diasabled than MKL [theoretically] doesn't permitted to make it.</DIV><DIV></DIV><DIV>Regards,</DIV><DIV>Konstantin</DIV>Wed, 20 Oct 2010 05:11:18 GMTKonstantin_A_Intel2010-10-20T05:11:18Zthreading problem in MKL
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/threading-problem-in-MKL/m-p/813243#M4070
Dear all,<BR /><BR />I am using MKL, version 10.2.3 Product Build 20091130 on a Intel 64 Linux machine. My system is a dual core system but using Intel Hyper Threading, it appears that four processors are available. The problem is that when I run my code on this machine, MKL parts always use only two cores, and the two other processors are always idle. The core that I run to initialize MKL is as below:<BR /><BR /> procs=omp_get_num_procs();<BR /> omp_set_num_threads(procs);<BR /><BR /> mkl_set_num_threads(procs);<BR /> mkl_set_dynamic(1);<BR /><BR /><BR /><BR />I would like to know, why the code doesn't use all processors when it is running. I also know that I can force it to use e.g. only one processor by setting number of omp processors to one as:<BR /><BR /> omp_set_num_threads(1);<BR /><BR />if I am right! Any help would be appreciated.<BR /><BR />Regards,<BR /><BR />D.<BR /><BR />Sun, 03 Oct 2010 22:04:38 GMThttps://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/threading-problem-in-MKL/m-p/813243#M4070Dan42010-10-03T22:04:38Zthreading problem in MKL
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/threading-problem-in-MKL/m-p/813244#M4071
Hyperthreading can improve throughput if there exist CPU resources that are underutilized without hyperthreading enabled. However, if you try to push the same calculation through all threads in a dual-core CPU with four hyperthreads instead of two, hyperthreading can actually slow down your program. Hyperthreading is not a technique that can materialize, from thin air, non-existent pipelines, internal register files and execution units.<BR /><BR />Read this informative post: <A href="http://software.intel.com/en-us/forums/showthread.php?t=67622">should hyperthreading be used?</A>Mon, 04 Oct 2010 00:14:33 GMThttps://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/threading-problem-in-MKL/m-p/813244#M4071mecej42010-10-04T00:14:33Zthreading problem in MKL
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/threading-problem-in-MKL/m-p/813245#M4072
Hi Dan,<SPAN style="font-family: verdana, sans-serif; font-size: 10.8333px;">mesei4 is absolutely right with his answer.and these are my 2 cents into this thread: yes can push MKL to run with 1 thread by calling omp_set_num_threads(1) or mkl_set_num_threads(1) routines. Please reember for this case, that mkl_set_num_threads() does have precedence over omp_set_num_threads().</SPAN><DIV><SPAN style="font-family: verdana, sans-serif; font-size: 10.8333px;">--Gennady</SPAN></DIV>Mon, 04 Oct 2010 05:28:34 GMThttps://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/threading-problem-in-MKL/m-p/813245#M4072Gennady_F_Intel2010-10-04T05:28:34Zthreading problem in MKL
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/threading-problem-in-MKL/m-p/813246#M4073
In the reference, the recommendation<BR />KMP_AFFINITY=granularity=fine,compact,1,0<BR />must assume a BIOS in which even-odd pairs of logicals (e.g. 0,1) share the same core. This is not always the way it's done, although it seems common lately for single and dual socket platforms.<BR />I was surprised again how important these settings are when HyperThreading is enabled, even on a current single socket platform which has this expected assignment of logicals, where KMP_AFFINITY=compact,1 is correct, but must be specified, along with corresponding NUM_THREADS.Mon, 04 Oct 2010 10:40:11 GMThttps://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/threading-problem-in-MKL/m-p/813246#M4073TimP2010-10-04T10:40:11Zthreading problem in MKL
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/threading-problem-in-MKL/m-p/813247#M4074
Hi, m<SPAN style="font-family: verdana, sans-serif;">y 2 cents in addition to the previous comments.</SPAN><DIV></DIV><DIV>Yes, it's correct that MKL hardly benefits form Heper-Threading, but if you want (just to compare) you may force MKL to use 4 threads:</DIV><DIV></DIV><DIV>mkl_set_num_threads(4);<BR />mkl_set_dynamic(0);</DIV><DIV></DIV><DIV>The point is that if mkl_dynamic is 1, than MKL will reduce the number of threads down to 2 (a number of physical cores) due to perfromance considerations. And if mkl_dynamic is diasabled than MKL [theoretically] doesn't permitted to make it.</DIV><DIV></DIV><DIV>Regards,</DIV><DIV>Konstantin</DIV>Wed, 20 Oct 2010 05:11:18 GMThttps://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/threading-problem-in-MKL/m-p/813247#M4074Konstantin_A_Intel2010-10-20T05:11:18Z