<?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 So, Paresh - you want to set in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/User-created-threads-and-MKL-internal-threads/m-p/1139450#M26205</link>
    <description>&lt;P&gt;So, Paresh - you want to set the number of threads once and use those threads for everything? Rather than setting the number of threads before each ?gemm call - like: &lt;A href="https://software.intel.com/en-us/mkl-linux-developer-guide-changing-the-number-of-openmp-threads-at-run-time" target="_blank"&gt;https://software.intel.com/en-us/mkl-linux-developer-guide-changing-the-number-of-openmp-threads-at-run-time&lt;/A&gt;?&lt;/P&gt;&lt;P&gt;Pamela&lt;/P&gt;</description>
    <pubDate>Wed, 15 May 2019 20:53:52 GMT</pubDate>
    <dc:creator>Pamela_H_Intel</dc:creator>
    <dc:date>2019-05-15T20:53:52Z</dc:date>
    <item>
      <title>User-created threads and MKL internal threads</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/User-created-threads-and-MKL-internal-threads/m-p/1139449#M26204</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;Suppose I create an openmp region with say, 2 threads.&amp;nbsp; And somewhere in that region I have a call to MKL, say DGEMM.&amp;nbsp; Now, is it possible to force this DGEMM&amp;nbsp; call to use exactly my 2 threads ?&amp;nbsp; ( Note:&amp;nbsp; I want DGEMM to use more than 1 thread but I don't want it to create threads of its own).&amp;nbsp; Are there directives/settings to do this ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;My suspect that I can't but would be quite happy if I could.&lt;/P&gt;&lt;P&gt;If not, can TBB do this ?&amp;nbsp; If so,&amp;nbsp; How much effort is it to switch from using openmp to TBB ?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Paresh&lt;/P&gt;</description>
      <pubDate>Sat, 04 May 2019 12:56:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/User-created-threads-and-MKL-internal-threads/m-p/1139449#M26204</guid>
      <dc:creator>Murthy__Paresh</dc:creator>
      <dc:date>2019-05-04T12:56:06Z</dc:date>
    </item>
    <item>
      <title>So, Paresh - you want to set</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/User-created-threads-and-MKL-internal-threads/m-p/1139450#M26205</link>
      <description>&lt;P&gt;So, Paresh - you want to set the number of threads once and use those threads for everything? Rather than setting the number of threads before each ?gemm call - like: &lt;A href="https://software.intel.com/en-us/mkl-linux-developer-guide-changing-the-number-of-openmp-threads-at-run-time" target="_blank"&gt;https://software.intel.com/en-us/mkl-linux-developer-guide-changing-the-number-of-openmp-threads-at-run-time&lt;/A&gt;?&lt;/P&gt;&lt;P&gt;Pamela&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 20:53:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/User-created-threads-and-MKL-internal-threads/m-p/1139450#M26205</guid>
      <dc:creator>Pamela_H_Intel</dc:creator>
      <dc:date>2019-05-15T20:53:52Z</dc:date>
    </item>
    <item>
      <title>Hi Pamela, Yes I want to set</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/User-created-threads-and-MKL-internal-threads/m-p/1139451#M26206</link>
      <description>&lt;P&gt;Hi Pamela, Yes I want to set the number of threads once.&amp;nbsp; The full code is quite messy so below is an abstraction of what I have now.&amp;nbsp; I can't remove the "omp single" below -- if I do that then every thread seems to do the same sgemm one after the other and that is wasteful.&amp;nbsp; Ideally, I would like sgemm to use my number_of_threads and not create its own.&amp;nbsp; I thought I tried using omp_set_nested( false ) but i no longer remember much about that effort.&amp;nbsp; I will try that again but meanwhile I post this ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;number_of_threads = omp_get_max_threads() / 2; &amp;nbsp; // HALF THE MAX NUMBER OF THREADS POSSIBLE&lt;/P&gt;&lt;P&gt;mkl_set_num_threads( number_of_threads ); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // USE THE SAME NUMBER INSIDE SGEMM below&lt;/P&gt;&lt;P&gt;#pragma omp parallel num_threads( number_of_threads )&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (.. parallel region ... )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; begin loop over pieces of data until "done"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; #pragma omp single&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; sgemm( multiply the pieces of data ); // MKL will create NEW number_of_threads internally.&amp;nbsp; So, while sgemm is running&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // omp_get_max_threads() = 2 * number_of_threads&amp;nbsp; will exist on the machine&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } // end single ( wait till my (number_of_threads) threads arrive here )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; ( .. continue parallel region with number_of_threads ... )&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; end loop over pieces of data (all threads will loop as we will flush "done" or "not done" )&lt;/P&gt;&lt;P&gt;} // end parallel region&lt;/P&gt;&lt;P&gt;--------------------------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 15:21:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/User-created-threads-and-MKL-internal-threads/m-p/1139451#M26206</guid>
      <dc:creator>Murthy__Paresh</dc:creator>
      <dc:date>2019-05-16T15:21:42Z</dc:date>
    </item>
  </channel>
</rss>

