<?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 Have you tried checking the # in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Switching-between-threaded-and-non-threaded-libraries/m-p/1029724#M20070</link>
    <description>&lt;P&gt;Have you tried checking the # of actual threads in your application using mkl_get_max_threads()?&lt;/P&gt;

&lt;P&gt;Can you disable dynamic threading using MKL_DYNAMIC to FALSE and setting the MKL_NUM_THREADS=1 even when you use threaded MKL functions?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;--vipin&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Jul 2015 09:14:34 GMT</pubDate>
    <dc:creator>VipinKumar_E_Intel</dc:creator>
    <dc:date>2015-07-29T09:14:34Z</dc:date>
    <item>
      <title>Switching between threaded and non-threaded libraries</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Switching-between-threaded-and-non-threaded-libraries/m-p/1029723#M20069</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have an application that uses Intel's MKL libraries. In some sections of this application calls to MKL are made in parallel areas. In these areas, I want to use the sequential version of the MKL libraries; at times I am not in a parallel area in my application, so I would like to use the threadedversion of the MKL libraries here.&lt;/P&gt;

&lt;P&gt;I understand I can only link my application with either the threaded or the sequential libraries. Given that I need to use the threaded version in certain places, I assume I must link with the threaded version. I set my environment variables OMP_NUM_THREADS and MKL_NUM_THREADS to 1. My understanding is that I should be able to call mkl_set_num_threads(n), where "n" is either 1 - in areas where I want to use MKL in sequential mode - or "&amp;gt;1", in threaded MKL calls.&lt;/P&gt;

&lt;P&gt;But if I bring the Windows task manager I notice that calling mkl_set_num_threads(1) when I'm using the threaded version of the MKL library still starts many threads. If I use the sequential version, on the other hand, this is not a problem. It appears that mkl_set_num_threads does not have the effect I expected.&lt;/P&gt;

&lt;P&gt;If I run my application entirely in sequential mode, then even if I call mkl_set_num_threads(1) I still see multiple threads running when MKL is being called. Since I know the threading is not coming from my application, it must be from MKL.&lt;/P&gt;

&lt;P&gt;Is there a way to force MKL to run in sequential mode - even if I'm linking with the threaded MKL library?&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2015 19:04:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Switching-between-threaded-and-non-threaded-libraries/m-p/1029723#M20069</guid>
      <dc:creator>mullervki</dc:creator>
      <dc:date>2015-07-28T19:04:59Z</dc:date>
    </item>
    <item>
      <title>Have you tried checking the #</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Switching-between-threaded-and-non-threaded-libraries/m-p/1029724#M20070</link>
      <description>&lt;P&gt;Have you tried checking the # of actual threads in your application using mkl_get_max_threads()?&lt;/P&gt;

&lt;P&gt;Can you disable dynamic threading using MKL_DYNAMIC to FALSE and setting the MKL_NUM_THREADS=1 even when you use threaded MKL functions?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;--vipin&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2015 09:14:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Switching-between-threaded-and-non-threaded-libraries/m-p/1029724#M20070</guid>
      <dc:creator>VipinKumar_E_Intel</dc:creator>
      <dc:date>2015-07-29T09:14:34Z</dc:date>
    </item>
    <item>
      <title>Vipin,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Switching-between-threaded-and-non-threaded-libraries/m-p/1029725#M20071</link>
      <description>&lt;P&gt;Vipin,&lt;/P&gt;

&lt;P&gt;Thanks for the reply. I'll give your suggestion a try. I'm not familiar with MKL_DYNAMIC (I'm rather new to this issue). I assume this is an environment variable to be set to FALSE also.&lt;/P&gt;

&lt;P&gt;I did some reading on MKL_DYNAMIC (https://software.intel.com/en-us/node/528547) and was surprised by the comment "Note also that if Intel MKL is called in a parallel region, it will use only one thread by default."&lt;/P&gt;

&lt;P&gt;Does this mean I have no need to call mkl_set_num_threads at all? If you are familiar with the underlying reasons for the comment above, could you elaborate on it? Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2015 14:57:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Switching-between-threaded-and-non-threaded-libraries/m-p/1029725#M20071</guid>
      <dc:creator>mullervki</dc:creator>
      <dc:date>2015-07-29T14:57:07Z</dc:date>
    </item>
    <item>
      <title>  Hi,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Switching-between-threaded-and-non-threaded-libraries/m-p/1029726#M20072</link>
      <description>&lt;P&gt;&amp;nbsp; Hi,&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp; Yes, that's the environment variable.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; That note is about when you call an MKL routine from a parallel region, say an OpenMP parallel region to have nested parallelism like, here&lt;/P&gt;

&lt;P&gt;&amp;nbsp; #pragma omp parallel for&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp; for (int i; i &amp;lt; n; i++) {&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mkl_function();&lt;/P&gt;

&lt;P&gt;&amp;nbsp; }&lt;/P&gt;

&lt;P&gt;&amp;nbsp; by default, mkl will use single thread.&amp;nbsp; If you still want to have nested parallelism, then you can try with MKL_DYNAMC to FALSE, and manually set the # of threads than MKL to decide it. Also, please note, you are using the same&amp;nbsp;omp&amp;nbsp;compiler as MKL is using as mentioned there.&lt;/P&gt;

&lt;P&gt;Vipin&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 05:42:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Switching-between-threaded-and-non-threaded-libraries/m-p/1029726#M20072</guid>
      <dc:creator>VipinKumar_E_Intel</dc:creator>
      <dc:date>2015-07-30T05:42:39Z</dc:date>
    </item>
    <item>
      <title>Vipin,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Switching-between-threaded-and-non-threaded-libraries/m-p/1029727#M20073</link>
      <description>&lt;P&gt;Vipin,&lt;/P&gt;

&lt;P&gt;You've been most helpful. Thanks.&lt;/P&gt;

&lt;P&gt;I'm multi-threading the application using Windows threads, not OpenMP. I think I may have found the problem: running the application from the command line seems to work as expected if the environment variables are set at the command prompt. So I started Visual Studio (devenv) from the command line to make sure the environment variables were properly set (I chose not to change the environment variable globally at this point).&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 16:06:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Switching-between-threaded-and-non-threaded-libraries/m-p/1029727#M20073</guid>
      <dc:creator>mullervki</dc:creator>
      <dc:date>2015-07-30T16:06:44Z</dc:date>
    </item>
  </channel>
</rss>

