<?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 Sure. I attached the code in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/memory-allocation-of-mkl-sparse-convert-csr/m-p/1169148#M28412</link>
    <description>&lt;P&gt;Sure. I attached the code here. This is Matlab mexfunction. The compile and link options are in the file.&amp;nbsp;Currently, I have&amp;nbsp;mkl_sparse_destroy(csrA) and&amp;nbsp;mkl_sparse_destroy(csrB) near the end. But if&amp;nbsp;mkl_sparse_destroy(csrA) is before the memcpy functions, it will crash when the nnz is large.&lt;/P&gt;&lt;P&gt;To call this from matlab. Run&amp;nbsp;[vt,ct,rt]=mkl_sp_transpose_double(v,c,r,int64(m),int64(n)) in matlab. Here, v is the data vector, c is the column index and r the row pointer, m number of rows and n number of columns. Make sure v is a double here.&lt;/P&gt;&lt;P&gt;If will be great if this can be improved because people can release csrA earlier to reduce the peak memory use.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jan 2020 18:48:36 GMT</pubDate>
    <dc:creator>Liu__John1</dc:creator>
    <dc:date>2020-01-14T18:48:36Z</dc:date>
    <item>
      <title>memory allocation of mkl_sparse_convert_csr</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/memory-allocation-of-mkl-sparse-convert-csr/m-p/1169142#M28406</link>
      <description>&lt;P&gt;I want to transpose a sparse matrix. I used the&amp;nbsp;mkl_sparse_convert_csr function as&lt;/P&gt;&lt;P&gt;mkl_sparse_convert_csr(csrA,SPARSE_OPERATION_TRANSPOSE,&amp;amp;csrB);&lt;/P&gt;&lt;P&gt;(1) Immediately after this step, I would like to destroy csrA. I assumed csrB will have its own memory space. However, my program will crash if I access csrB. It seems csrB share the memory with csrA. It works fine if I destroy csrA after all steps. Can someone confirm this?&lt;/P&gt;&lt;P&gt;(2) I'm also wondering if this is the best way to transpose a sparse matrix. The&amp;nbsp;mkl_?csrcsc is depreciated.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Jiaen&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2020 02:50:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/memory-allocation-of-mkl-sparse-convert-csr/m-p/1169142#M28406</guid>
      <dc:creator>Liu__John1</dc:creator>
      <dc:date>2020-01-10T02:50:46Z</dc:date>
    </item>
    <item>
      <title>Hi John,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/memory-allocation-of-mkl-sparse-convert-csr/m-p/1169143#M28407</link>
      <description>&lt;P&gt;Hi John,&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;Which compiler (Intel, gcc...) and version di you use?&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;Also, can you provide me with the sample with minimal workload so that I can reproduce the issue?&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;Please include instruction on how to compile and link the sample.&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;Thanks,&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;Khang&lt;/P&gt;&lt;P style="margin-left:0in; margin-right:0in"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 22:40:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/memory-allocation-of-mkl-sparse-convert-csr/m-p/1169143#M28407</guid>
      <dc:creator>Khang_N_Intel</dc:creator>
      <dc:date>2020-01-13T22:40:45Z</dc:date>
    </item>
    <item>
      <title>Hi Jiaen,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/memory-allocation-of-mkl-sparse-convert-csr/m-p/1169144#M28408</link>
      <description>&lt;P&gt;Hi Jiaen,&lt;/P&gt;&lt;P&gt;As for your questions:&lt;/P&gt;&lt;P&gt;1)&amp;nbsp; Your program shouldn't crash when you tried to access csrB.&amp;nbsp; That is why we asked for the sample to reproduce the error.&lt;/P&gt;&lt;P&gt;2)&amp;nbsp; There is no direct function to do that; you will need to call mkl_sparse_convert_csr with operation for transpose, then call mkl_sparse_export_csr, then call mkl_sparse_?_create_csc (since CSC representation of a matrix mathematically is the same as transposed CSR).&lt;/P&gt;&lt;P&gt;Khang&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 23:50:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/memory-allocation-of-mkl-sparse-convert-csr/m-p/1169144#M28408</guid>
      <dc:creator>Khang_N_Intel</dc:creator>
      <dc:date>2020-01-13T23:50:35Z</dc:date>
    </item>
    <item>
      <title>Hi Khang</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/memory-allocation-of-mkl-sparse-convert-csr/m-p/1169145#M28409</link>
      <description>&lt;P&gt;Hi Khang&lt;/P&gt;&lt;P&gt;Thanks for your response. The problem can be repeated if the following order is carried out and the sparse matrix is large enough (e.g., non zero elements more than 10&lt;SUP&gt;4&lt;/SUP&gt;). Now I'm quite sure about how to avoid the problem.I feel it's easier to describe it than changing my code to be general enough.&lt;/P&gt;&lt;P&gt;mkl_sparse_convert_csr(csrA,SPARSE_OPERATION_TRANSPOSE,&amp;amp;csrB);&lt;/P&gt;&lt;P&gt;mkl_sparse_destroy(csrA);&lt;/P&gt;&lt;P&gt;mkl_sparse_export_csr(csrB,&amp;amp;indexing,&lt;BR /&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;amp;mjunk,&amp;amp;njunk,&lt;BR /&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;amp;rows_start,&amp;amp;rows_end,&amp;amp;col_indx,&amp;amp;value);&lt;/P&gt;&lt;P&gt;memcpy(col_indx_output,col_indx,sizeof(MKL_INT)*nnz); // col_indx_output is the pointer to the allocated output memory.&lt;BR /&gt;mkl_sparse_destroy(csrB);&lt;/P&gt;&lt;P&gt;The program will crash if&amp;nbsp;mkl_sparse_destroy(csrA) is before memcpy. I closely monitored the memory use.&amp;nbsp;mkl_sparse_destroy(csrB) actually doesn't reduce memory use significantly. This suggests the memory allocated for the transposed matrix B is stored in csrA rather than csrB.&lt;/P&gt;&lt;P&gt;Jiaen&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 13:40:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/memory-allocation-of-mkl-sparse-convert-csr/m-p/1169145#M28409</guid>
      <dc:creator>Liu__John1</dc:creator>
      <dc:date>2020-01-14T13:40:30Z</dc:date>
    </item>
    <item>
      <title>Hi Jiaen,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/memory-allocation-of-mkl-sparse-convert-csr/m-p/1169146#M28410</link>
      <description>&lt;P&gt;Hi Jiaen,&lt;/P&gt;&lt;P&gt;I am no sure what happens in your code still. I'd appreciate if you provide an example (at least the data and the exact code snippet, where you create csrA and convert to csrB). On which line does the code crash? csrB after calling the converter should have all the memory for the transposed data which contradicts what you suggested.&amp;nbsp;&lt;BR /&gt;Please, provide us the code so that we can investigate.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;BR /&gt;Kirill&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 18:18:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/memory-allocation-of-mkl-sparse-convert-csr/m-p/1169146#M28410</guid>
      <dc:creator>Kirill_V_Intel</dc:creator>
      <dc:date>2020-01-14T18:18:20Z</dc:date>
    </item>
    <item>
      <title>Hi Jiaen,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/memory-allocation-of-mkl-sparse-convert-csr/m-p/1169147#M28411</link>
      <description>&lt;P&gt;Hi Jiaen,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for providing more information about this issue.&lt;/P&gt;&lt;P&gt;However, I still think it would be best if you can provide us with a code sample to reproduce the issue.&amp;nbsp; This way we can be sure that we are looking at the exact issue.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Khang&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 18:35:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/memory-allocation-of-mkl-sparse-convert-csr/m-p/1169147#M28411</guid>
      <dc:creator>Khang_N_Intel</dc:creator>
      <dc:date>2020-01-14T18:35:51Z</dc:date>
    </item>
    <item>
      <title>Sure. I attached the code</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/memory-allocation-of-mkl-sparse-convert-csr/m-p/1169148#M28412</link>
      <description>&lt;P&gt;Sure. I attached the code here. This is Matlab mexfunction. The compile and link options are in the file.&amp;nbsp;Currently, I have&amp;nbsp;mkl_sparse_destroy(csrA) and&amp;nbsp;mkl_sparse_destroy(csrB) near the end. But if&amp;nbsp;mkl_sparse_destroy(csrA) is before the memcpy functions, it will crash when the nnz is large.&lt;/P&gt;&lt;P&gt;To call this from matlab. Run&amp;nbsp;[vt,ct,rt]=mkl_sp_transpose_double(v,c,r,int64(m),int64(n)) in matlab. Here, v is the data vector, c is the column index and r the row pointer, m number of rows and n number of columns. Make sure v is a double here.&lt;/P&gt;&lt;P&gt;If will be great if this can be improved because people can release csrA earlier to reduce the peak memory use.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 18:48:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/memory-allocation-of-mkl-sparse-convert-csr/m-p/1169148#M28412</guid>
      <dc:creator>Liu__John1</dc:creator>
      <dc:date>2020-01-14T18:48:36Z</dc:date>
    </item>
  </channel>
</rss>

