<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Thank you all for your in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-set-affinity-while-using-MKl-in-sequential-mode/m-p/965468#M16183</link>
    <description>&lt;P&gt;Thank you all for your valuable comments.&lt;/P&gt;
&lt;P&gt;I finally resolved my problem. Instead of using sequential, I compiled the code using openmp (threaded version). Then I set &lt;STRONG&gt;KMP_AFFINITY&lt;/STRONG&gt; to disabled. Finally, I used&amp;nbsp;&lt;STRONG&gt;sched_setaffinity&amp;nbsp;&lt;/STRONG&gt;to bind each thread to specific core. Now, it is working.&lt;/P&gt;
&lt;P&gt;Pouya&lt;/P&gt;</description>
    <pubDate>Fri, 02 Aug 2013 00:51:40 GMT</pubDate>
    <dc:creator>Pouya_Z_</dc:creator>
    <dc:date>2013-08-02T00:51:40Z</dc:date>
    <item>
      <title>How to set affinity while using MKl in sequential mode</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-set-affinity-while-using-MKl-in-sequential-mode/m-p/965465#M16180</link>
      <description>&lt;P&gt;I have written a multi-threaded code using pthread. Each thread calls an instance of dss_solve_real separately. I compile the code using following libraries to make sure that MKL works in sequential mode:&lt;/P&gt;
&lt;P&gt;$(MKLROOT)/lib/intel64/libmkl_intel_ilp64.a $(MKLROOT)/lib/intel64/libmkl_sequential.a $(MKLROOT)/lib/intel64/libmkl_core.a&amp;nbsp;&amp;nbsp;-lm -lpthread&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I have disabled KMP_AFFINITY using:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;env KMP_AFFINITY=disabled&lt;/P&gt;
&lt;P&gt;The number of threads for MKL is also manually determined in the code using:&lt;/P&gt;
&lt;P&gt;mkl_set_num_threads(1);&lt;/P&gt;
&lt;P&gt;I use the following code to set affinity for each thread. This piece code is executed at the beginning of each thread's function:&lt;/P&gt;
&lt;P&gt;pthread_t curThread = pthread_self();&lt;BR /&gt;cpu_set_t cpuset;&lt;BR /&gt;CPU_ZERO(&amp;amp;cpuset);&lt;BR /&gt;CPU_SET(threadCPUNum[threadData-&amp;gt;numOfCurThread], &amp;amp;cpuset);&lt;BR /&gt;sched_setaffinity(curThread, sizeof(cpuset), &amp;amp;cpuset);&lt;/P&gt;
&lt;P&gt;In this code,&amp;nbsp;threadCPUNum[threadData-&amp;gt;numOfCurThread] represents number of the CPU to which current thread will be binded to.&lt;/P&gt;
&lt;P&gt;In order to make sure that MKL respects my CPU affinity settings, I initially bind all the threads to CPU0 by setting all elements of&amp;nbsp;threadCPUNum array to zero. However, monitoring CPU utilization reveals that MKL does not pay attention to&amp;nbsp;sched_setaffinity and uses different processors.&lt;/P&gt;
&lt;P&gt;I would like to know what I am missing here and how I can force MKL function (dss_solve_real) to bind to a specific CPU.&lt;/P&gt;
&lt;P&gt;Thanks in advance for your help.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2013 22:33:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-set-affinity-while-using-MKl-in-sequential-mode/m-p/965465#M16180</guid>
      <dc:creator>Pouya_Z_</dc:creator>
      <dc:date>2013-07-31T22:33:40Z</dc:date>
    </item>
    <item>
      <title>&gt;&gt;...However, monitoring CPU</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-set-affinity-while-using-MKl-in-sequential-mode/m-p/965466#M16181</link>
      <description>&amp;gt;&amp;gt;...However, monitoring CPU utilization reveals that &lt;STRONG&gt;MKL does not pay attention to sched_setaffinity&lt;/STRONG&gt; and uses
&amp;gt;&amp;gt;different processors...

Please verify it by commenting all calls to MKL functions and use some for-loop based processing instead.</description>
      <pubDate>Thu, 01 Aug 2013 14:27:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-set-affinity-while-using-MKl-in-sequential-mode/m-p/965466#M16181</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2013-08-01T14:27:17Z</dc:date>
    </item>
    <item>
      <title>Hi Pouya,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-set-affinity-while-using-MKl-in-sequential-mode/m-p/965467#M16182</link>
      <description>&lt;P&gt;Hi Pouya,&lt;/P&gt;
&lt;P&gt;As sergey suggestion, how about if with some for-loop without MKL function?&lt;/P&gt;
&lt;P&gt;MKL is threaded internal by OpenMP. So&amp;nbsp;if you are linking threaded MKL library in each thread, then it is possible the the&amp;nbsp;OpenMP threads of MKL&amp;nbsp;are not limited by your pthread affinity.&amp;nbsp; But you mentioned, you are using sequential MKL library. so need to verify.&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Ying&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2013 00:48:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-set-affinity-while-using-MKl-in-sequential-mode/m-p/965467#M16182</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2013-08-02T00:48:10Z</dc:date>
    </item>
    <item>
      <title>Thank you all for your</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-set-affinity-while-using-MKl-in-sequential-mode/m-p/965468#M16183</link>
      <description>&lt;P&gt;Thank you all for your valuable comments.&lt;/P&gt;
&lt;P&gt;I finally resolved my problem. Instead of using sequential, I compiled the code using openmp (threaded version). Then I set &lt;STRONG&gt;KMP_AFFINITY&lt;/STRONG&gt; to disabled. Finally, I used&amp;nbsp;&lt;STRONG&gt;sched_setaffinity&amp;nbsp;&lt;/STRONG&gt;to bind each thread to specific core. Now, it is working.&lt;/P&gt;
&lt;P&gt;Pouya&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2013 00:51:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-set-affinity-while-using-MKl-in-sequential-mode/m-p/965468#M16183</guid>
      <dc:creator>Pouya_Z_</dc:creator>
      <dc:date>2013-08-02T00:51:40Z</dc:date>
    </item>
  </channel>
</rss>

