<?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 mkl_mem_stat gives wrong statistics? in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-mem-stat-gives-wrong-statistics/m-p/776484#M1105</link>
    <description>I don't see problem with the latest 10.3 update9. using the snip code below:&lt;DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int allocated_buffers;&lt;/P&gt;&lt;P&gt;double* a =
(double*)MKL_malloc(n*n*sizeof(double),128);&lt;/P&gt;

&lt;P&gt;double* b = (double*)MKL_malloc(n*n*sizeof(double),128);&lt;/P&gt;

&lt;P&gt;double* c =
(double*)MKL_malloc(n*n*sizeof(double),128);&lt;/P&gt;

&lt;P&gt;call dgemm .&lt;/P&gt;

&lt;P&gt;allocated_bytes =
MKL_Mem_Stat(&amp;amp;allocated_buffers);&lt;/P&gt;

&lt;P&gt;printf(" Allocated MKL memory :%8ld bytes in%3d
buffers.\n",(long)allocated_bytes,(int)allocated_buffers);&lt;/P&gt;=========&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I 've got&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV id="_mcePaste"&gt;Allocated MKL memory :2400000432 bytes in 3 buffers.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;when n == 10000&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;and&lt;/DIV&gt;&lt;DIV&gt;wnen n == 1000&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Allocated MKL memory :24000432 bytes in 3 buffers.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;.....................&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;1)You can give us the example of your case for reproducing the problem?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;2)what do you mean "T&lt;SPAN style="color: #515357; font-family: Arial, sans-serif; line-height: 16px; text-align: left;"&gt;he official example is quitemisleading now&lt;/SPAN&gt;"?&lt;/DIV&gt;&lt;DIV&gt;Whic example do you mean? what is your suggestion to improve this example?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;--Gennady&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Sun, 08 Apr 2012 08:24:24 GMT</pubDate>
    <dc:creator>Gennady_F_Intel</dc:creator>
    <dc:date>2012-04-08T08:24:24Z</dc:date>
    <item>
      <title>mkl_mem_stat gives wrong statistics?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-mem-stat-gives-wrong-statistics/m-p/776483#M1104</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;We were using MKL_MemStat in MKL 10.1.1 . The system is Linux. If we use 1 thread, it works fine on all machines. But when we use 8 threads, it works on some machines and crashes on others.&lt;BR /&gt;&lt;BR /&gt;I recently downloaded MKL 10.3.7 and MKL 10.2. I tested it using the example on the website/manual. I noticed thatthe corresponding function mkl_mem_stat() gives thewhole memorythat has been allocates, which is not written any where...(The official example is quitemisleading now.)&lt;BR /&gt;&lt;BR /&gt;Whenweuseit in our program, it does not give the correct number of memory that's being used. For example, when we see the program is using 2G memory, mkl_mem_stat() says it uses 20M. We will do further test. Do you have any idea about this?&lt;BR /&gt;&lt;BR /&gt;Peng&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2012 18:07:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-mem-stat-gives-wrong-statistics/m-p/776483#M1104</guid>
      <dc:creator>Peng_Liang</dc:creator>
      <dc:date>2012-04-06T18:07:07Z</dc:date>
    </item>
    <item>
      <title>mkl_mem_stat gives wrong statistics?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-mem-stat-gives-wrong-statistics/m-p/776484#M1105</link>
      <description>I don't see problem with the latest 10.3 update9. using the snip code below:&lt;DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int allocated_buffers;&lt;/P&gt;&lt;P&gt;double* a =
(double*)MKL_malloc(n*n*sizeof(double),128);&lt;/P&gt;

&lt;P&gt;double* b = (double*)MKL_malloc(n*n*sizeof(double),128);&lt;/P&gt;

&lt;P&gt;double* c =
(double*)MKL_malloc(n*n*sizeof(double),128);&lt;/P&gt;

&lt;P&gt;call dgemm .&lt;/P&gt;

&lt;P&gt;allocated_bytes =
MKL_Mem_Stat(&amp;amp;allocated_buffers);&lt;/P&gt;

&lt;P&gt;printf(" Allocated MKL memory :%8ld bytes in%3d
buffers.\n",(long)allocated_bytes,(int)allocated_buffers);&lt;/P&gt;=========&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I 've got&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV id="_mcePaste"&gt;Allocated MKL memory :2400000432 bytes in 3 buffers.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;when n == 10000&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;and&lt;/DIV&gt;&lt;DIV&gt;wnen n == 1000&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Allocated MKL memory :24000432 bytes in 3 buffers.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;.....................&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;1)You can give us the example of your case for reproducing the problem?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;2)what do you mean "T&lt;SPAN style="color: #515357; font-family: Arial, sans-serif; line-height: 16px; text-align: left;"&gt;he official example is quitemisleading now&lt;/SPAN&gt;"?&lt;/DIV&gt;&lt;DIV&gt;Whic example do you mean? what is your suggestion to improve this example?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;--Gennady&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 08 Apr 2012 08:24:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-mem-stat-gives-wrong-statistics/m-p/776484#M1105</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2012-04-08T08:24:24Z</dc:date>
    </item>
    <item>
      <title>mkl_mem_stat gives wrong statistics?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-mem-stat-gives-wrong-statistics/m-p/776485#M1106</link>
      <description>Hi Gennady,&lt;BR /&gt;&lt;BR /&gt;Thanks so much for the quick reply! &lt;BR /&gt;&lt;BR /&gt;1) It is a little hard to give you an example to reproduce the bug, since it only appears when we run in in our program. I will try to find one example.&lt;BR /&gt;&lt;BR /&gt;2) I found the following example on Intel's website. The second part will display "Memory leak!" when it is not true. In MKL10.1, after mkl_free_buffers(),mkl_mem_stat() will give zero. But now it is non-zero. Also, inthe hearder file mkl_service.h, it says MKL_MenStat() will return the amount of the memory allocatd by Memory Manager, which I think is not accurate now.&lt;BR /&gt;&lt;BR /&gt;-----------------&lt;P&gt;#include &lt;STDIO.H&gt;&lt;/STDIO.H&gt;&lt;/P&gt;&lt;P&gt;#include &lt;MKL.H&gt;&lt;/MKL.H&gt;&lt;/P&gt;&lt;P&gt;int main(void) {&lt;/P&gt;&lt;P&gt;double *a, *b, *c;&lt;/P&gt;&lt;P&gt;int n, i;&lt;/P&gt;&lt;P&gt;double alpha, beta;&lt;/P&gt;&lt;P&gt;MKL_INT64 AllocatedBytes;&lt;/P&gt;&lt;P&gt;int N_AllocatedBuffers;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;alpha = 1.1; beta = -1.2;&lt;/P&gt;&lt;P&gt;n = 1000;&lt;/P&gt;&lt;P&gt;a = (double*)mkl_malloc(n*n*sizeof(double),128);&lt;/P&gt;&lt;P&gt;b = (double*)mkl_malloc(n*n*sizeof(double),128);&lt;/P&gt;&lt;P&gt;c = (double*)mkl_malloc(n*n*sizeof(double),128);&lt;/P&gt;&lt;P&gt;for (i=0;i&amp;lt;(n*n);i++) {&lt;/P&gt;&lt;P&gt;a&lt;I&gt; = (double)(i+1);&lt;/I&gt;&lt;/P&gt;&lt;P&gt;b&lt;I&gt; = (double)(-i-1);&lt;/I&gt;&lt;/P&gt;&lt;P&gt;c&lt;I&gt; = 0.0;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dgemm("N","N",&amp;amp;n,&amp;amp;n,&amp;amp;n,α,a,&amp;amp;n,b,&amp;amp;n,β,c,&amp;amp;n);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AllocatedBytes = mkl_mem_stat(&amp;amp;N_AllocatedBuffers);&lt;/P&gt;&lt;P&gt;printf("\nDGEMM uses %ld bytes in %d buffers',(long)AllocatedBytes,N_AllocatedBuffers);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mkl_free_buffers();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AllocatedBytes = mkl_mem_stat(&amp;amp;N_AllocatedBuffers);&lt;/P&gt;&lt;P&gt;if (AllocatedBytes &amp;gt; 0) {&lt;/P&gt;&lt;P&gt;printf("\nMKL memory leak!");&lt;/P&gt;&lt;P&gt;printf("\nAfter mkl_free_buffers there are %ld bytes in %d buffers",&lt;/P&gt;&lt;P&gt;(long)AllocatedBytes,N_AllocatedBuffers);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mkl_free(a);&lt;/P&gt;&lt;P&gt;mkl_free(b);&lt;/P&gt;&lt;P&gt;mkl_free(c);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;return 0;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;-----------------</description>
      <pubDate>Mon, 09 Apr 2012 17:52:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-mem-stat-gives-wrong-statistics/m-p/776485#M1106</guid>
      <dc:creator>Peng_Liang</dc:creator>
      <dc:date>2012-04-09T17:52:30Z</dc:date>
    </item>
    <item>
      <title>mkl_mem_stat gives wrong statistics?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-mem-stat-gives-wrong-statistics/m-p/776486#M1107</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;In MKL 10.3 MKL_Mem_Stat() returns the amount of the memory allocated by MKL Memory allocator.&lt;BR /&gt;This includes memory allocated for internal buffers plus buffers allocatedvia mkl_malloc() calls.&lt;BR /&gt;But mkl_free_buffers() just frees internally allocated buffers.&lt;BR /&gt;&lt;BR /&gt;So, pleasesee correctedtail of yourprogram:&lt;BR /&gt;&lt;BR /&gt;&lt;P&gt; mkl_free_buffers();&lt;/P&gt;&lt;P&gt; AllocatedBytes = mkl_mem_stat(&amp;amp;N_AllocatedBuffers);&lt;BR /&gt; printf("\nAfter mkl_free_buffers: %ld bytes in %d buffers",&lt;BR /&gt; (long)AllocatedBytes,N_AllocatedBuffers);&lt;/P&gt;&lt;P&gt; mkl_free(a);&lt;BR /&gt; mkl_free(b);&lt;BR /&gt; mkl_free(c);&lt;/P&gt;&lt;P&gt; AllocatedBytes = mkl_mem_stat(&amp;amp;N_AllocatedBuffers);&lt;/P&gt;&lt;P&gt; if (AllocatedBytes &amp;gt; 0) {&lt;BR /&gt; printf("\nMKL memory leak!");&lt;BR /&gt; printf("\nAfter mkl_free_buffers there are %ld bytes in %d buffers",&lt;BR /&gt; (long)AllocatedBytes,N_AllocatedBuffers);&lt;BR /&gt; } else&lt;BR /&gt; printf("\nMKL memory OK!");&lt;/P&gt;&lt;P&gt; return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;As a result the program output is as follows on my machine:&lt;/P&gt;&lt;P&gt;% ./a.out&lt;/P&gt;&lt;P&gt;DGEMM uses 32434736 bytes in 16 buffers&lt;BR /&gt;After mkl_free_buffers: 24000432 bytes in 3 buffers&lt;BR /&gt;MKL memory OK!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2012 07:25:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-mem-stat-gives-wrong-statistics/m-p/776486#M1107</guid>
      <dc:creator>barragan_villanueva_</dc:creator>
      <dc:date>2012-04-10T07:25:24Z</dc:date>
    </item>
    <item>
      <title>mkl_mem_stat gives wrong statistics?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-mem-stat-gives-wrong-statistics/m-p/776487#M1108</link>
      <description>I talked to my colleagues about our program. There is no envidence in our program showing it is wrong.&lt;BR /&gt;&lt;BR /&gt;The MKL_Mem_Stat() function should be right. Thanks for the replies!&lt;BR /&gt;</description>
      <pubDate>Wed, 02 May 2012 19:18:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/mkl-mem-stat-gives-wrong-statistics/m-p/776487#M1108</guid>
      <dc:creator>Peng_Liang</dc:creator>
      <dc:date>2012-05-02T19:18:46Z</dc:date>
    </item>
  </channel>
</rss>

