<?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 very much, Khan. in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/CPU-Execution-Time/m-p/1157747#M27685</link>
    <description>&lt;P&gt;Thank you very much, Khan. Your points are really helpful.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Nov 2018 02:17:51 GMT</pubDate>
    <dc:creator>Ahmadi__Afshin</dc:creator>
    <dc:date>2018-11-15T02:17:51Z</dc:date>
    <item>
      <title>CPU Execution Time</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/CPU-Execution-Time/m-p/1157741#M27679</link>
      <description>&lt;P&gt;I am using mkl_get_cpu_clocks() function to measure the CPU execution time of LAPACKE_dgesv. My code is like:&lt;/P&gt;
&lt;PRE class="brush:cpp; class-name:dark;"&gt;unsigned MKL_INT64 t1,t2;
mkl_get_cpu_clocks(&amp;amp;t1);
run LAPACKE_dgesv()
mkl_get_cpu_clocks(&amp;amp;t2);
printf("Elapsed MKL: %lf  \n", (double)(t2-t1)/1000000000);&lt;/PRE&gt;

&lt;P&gt;However, the returned elapsed time is not even close to the execution time. The actual execution time is about 27 seconds while the returned time is about 64 seconds!&lt;/P&gt;
&lt;P&gt;I checked the Intel MKL manual and unfortunately there is not enough discussion about mkl_get_cpu_clocks. Can you please help? Thank you.&lt;/P&gt;
&lt;P&gt;Intel MKL version: 18 update 3&lt;/P&gt;
&lt;P&gt;OS: Linux&lt;/P&gt;
&lt;P&gt;-Afshin&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2018 21:40:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/CPU-Execution-Time/m-p/1157741#M27679</guid>
      <dc:creator>Ahmadi__Afshin</dc:creator>
      <dc:date>2018-11-13T21:40:45Z</dc:date>
    </item>
    <item>
      <title>Hi Afshin,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/CPU-Execution-Time/m-p/1157742#M27680</link>
      <description>&lt;P&gt;Hi Afshin,&lt;/P&gt;&lt;P&gt;If you want to get the CPU execution time, you can use the mkl function "dsecnd" to measure the elapsed time in seconds.&lt;/P&gt;&lt;P&gt;mkl_get_cpu_clocks will return the elapsed time in CPU clocks, not in seconds.&amp;nbsp; If you want the result in seconds then you need to divide the result by the CPU frequency which can be obtained by calling the mkl function mkl_get_cpu_frequency.&lt;/P&gt;&lt;P&gt;I would suggest replacing the number 1000.... in your printing statement with this function call: mkl_get_cpu_frequency().&lt;/P&gt;&lt;P&gt;Which function did you use to get the result of 27 seconds?&lt;/P&gt;&lt;P&gt;The results I got from using the functions dsecnd and mkl_get_clocks are very close to each other.&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Khang&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 00:45:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/CPU-Execution-Time/m-p/1157742#M27680</guid>
      <dc:creator>Khang_N_Intel</dc:creator>
      <dc:date>2018-11-14T00:45:53Z</dc:date>
    </item>
    <item>
      <title>Quote:Nguyen, Khang T (Intel)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/CPU-Execution-Time/m-p/1157743#M27681</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Nguyen, Khang T (Intel) (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi Afshin,&lt;/P&gt;&lt;P&gt;If you want to get the CPU execution time, you can use the mkl function "dsecnd" to measure the elapsed time in seconds.&lt;/P&gt;&lt;P&gt;mkl_get_cpu_clocks will return the elapsed time in CPU clocks, not in seconds.&amp;nbsp; If you want the result in seconds then you need to divide the result by the CPU frequency which can be obtained by calling the mkl function mkl_get_cpu_frequency.&lt;/P&gt;&lt;P&gt;I would suggest replacing the number 1000.... in your printing statement with this function call: mkl_get_cpu_frequency().&lt;/P&gt;&lt;P&gt;Which function did you use to get the result of 27 seconds?&lt;/P&gt;&lt;P&gt;The results I got from using the functions dsecnd and mkl_get_clocks are very close to each other.&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Khang&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi Khang,&lt;/P&gt;&lt;P&gt;Thank you for your reply. I replace the 1000.. in my code with (mkl_get_cpu_frequency()*1e9), but is the mkl_get_cpu_frequency function accurate enough? Because every time I run my program it returns a different value (2.7GHz, 3.1GHz, etc) which directly affects the execution time measurement. I also tried mkl_get_clocks_frequency() which gave me better results but sometimes it is slightly higher than what dsecnd returned.&lt;/P&gt;&lt;P&gt;Does dsecnd return the CPU time or wall time?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 19:30:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/CPU-Execution-Time/m-p/1157743#M27681</guid>
      <dc:creator>Ahmadi__Afshin</dc:creator>
      <dc:date>2018-11-14T19:30:00Z</dc:date>
    </item>
    <item>
      <title>Hi Afshin,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/CPU-Execution-Time/m-p/1157744#M27682</link>
      <description>&lt;P&gt;Hi Afshin,&lt;/P&gt;&lt;P&gt;The function mkl_get_cpu_frequency() will provide the cpu frequency at that instant.&amp;nbsp; The cpu frequency is not fixed.&amp;nbsp; It will vary depending on the current state of your machine.&amp;nbsp; There are many factors that can affect the cpu frequency.&amp;nbsp; That is the reason why your code returns different value every time you run.&lt;/P&gt;&lt;P&gt;According to the Intel(R) MKL manual, the dsecnd() function returns the cpu&amp;nbsp;time. It&amp;nbsp;gets the time from the elapsed cpu&amp;nbsp;clocks divided by frequency. Obtaining the frequency may take some time when the&amp;nbsp;second/dsecnd&amp;nbsp;function runs for the first time. To eliminate the effect of this extra time on your measurements, make the first call to dsecnd&amp;nbsp;in advance.&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Khang&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 20:49:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/CPU-Execution-Time/m-p/1157744#M27682</guid>
      <dc:creator>Khang_N_Intel</dc:creator>
      <dc:date>2018-11-14T20:49:07Z</dc:date>
    </item>
    <item>
      <title>Hi Afshin,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/CPU-Execution-Time/m-p/1157745#M27683</link>
      <description>&lt;P&gt;Hi Afshin,&lt;/P&gt;&lt;P&gt;I guess you might already knew about this. Just in case, you are not aware of:&lt;/P&gt;&lt;P&gt;1) To ensure consistency, make sure to get rid or stop all other non-necessary programs when you run your code.&lt;/P&gt;&lt;P&gt;2) Keep the same system configuration every time you run your code.&lt;/P&gt;&lt;P&gt;3) Do not run your code immediately one after another.&amp;nbsp; Depending on the situation, you might let the system running for 5 or 15 minutes before running the code again.&lt;/P&gt;&lt;P&gt;Doing the above steps, although no guarantee,&amp;nbsp;&amp;nbsp;would minimize the chance the cpu frequency would vary and to ensure the system stabilization between each run.&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Khang&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 21:53:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/CPU-Execution-Time/m-p/1157745#M27683</guid>
      <dc:creator>Khang_N_Intel</dc:creator>
      <dc:date>2018-11-14T21:53:09Z</dc:date>
    </item>
    <item>
      <title>Oooops!, correction on item</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/CPU-Execution-Time/m-p/1157746#M27684</link>
      <description>&lt;P&gt;Oooops!, correction on item #3, let the system running idle for 5 or 15 minutes before running the code again.&lt;/P&gt;&lt;P&gt;I apologize for the error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Khang&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 21:55:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/CPU-Execution-Time/m-p/1157746#M27684</guid>
      <dc:creator>Khang_N_Intel</dc:creator>
      <dc:date>2018-11-14T21:55:02Z</dc:date>
    </item>
    <item>
      <title>Thank you very much, Khan.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/CPU-Execution-Time/m-p/1157747#M27685</link>
      <description>&lt;P&gt;Thank you very much, Khan. Your points are really helpful.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 02:17:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/CPU-Execution-Time/m-p/1157747#M27685</guid>
      <dc:creator>Ahmadi__Afshin</dc:creator>
      <dc:date>2018-11-15T02:17:51Z</dc:date>
    </item>
    <item>
      <title>Hi Afshin,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/CPU-Execution-Time/m-p/1157748#M27686</link>
      <description>&lt;P&gt;Hi Afshin,&lt;/P&gt;&lt;P&gt;You are very welcome!&lt;/P&gt;&lt;P&gt;Let me know if you have any other questions about Intel(R) MKL.&lt;/P&gt;&lt;P&gt;Best Regards,&lt;BR /&gt;Khang&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 03:13:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/CPU-Execution-Time/m-p/1157748#M27686</guid>
      <dc:creator>Khang_N_Intel</dc:creator>
      <dc:date>2018-11-15T03:13:25Z</dc:date>
    </item>
  </channel>
</rss>

