<?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 Quote:Zhukova, Maria (Intel) in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Return-mkl-sparse-spmm-Results/m-p/1132308#M25699</link>
    <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Zhukova, Maria (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;The memory for csrC and for the CSR representation, that you want to return (i.e. pointerB_C, pointerE_C, columns_C, values_C) is indeed allocated inside the mkl_sparse_spmm() routine.&lt;BR /&gt;
	In order to use the data outside of spmm() function, you should go with the next interface, using double pointers for C data:&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;void spmm(int M, int N, int K,
        int* rowIndex_A, int* columns_A, double* values_A,
        int* rowIndex_B, int* columns_B, double* values_B,
        int** pointerB_C, int** pointerE_C, int** columns_C, double** values_C)&lt;/PRE&gt;

&lt;P&gt;Hope, this will help!&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
	Maria&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks for your reply, it works. The only question in Python side is that you have to free the memory by hand in this case. Is there already some API for MKL Sparse Blas in Python?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Best,&lt;/P&gt;

&lt;P&gt;Zhihao&lt;/P&gt;</description>
    <pubDate>Fri, 21 Sep 2018 20:39:01 GMT</pubDate>
    <dc:creator>cui__zhihao</dc:creator>
    <dc:date>2018-09-21T20:39:01Z</dc:date>
    <item>
      <title>Return mkl_sparse_spmm Results?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Return-mkl-sparse-spmm-Results/m-p/1132306#M25697</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I am trying to use&amp;nbsp;mkl_sparse_spmm&lt;SPAN style="font-size: 13.008px;"&gt;&amp;nbsp;&lt;STRONG&gt;in a function&lt;/STRONG&gt;,&lt;/SPAN&gt; to calculate C = A*B, where A, B, C are in CSR format.&lt;/P&gt;

&lt;P&gt;I would like to return the information of C, i.e. rowIndex_C, column_C and values_C through the pointers that I passed to the function arguments.&lt;/P&gt;

&lt;P&gt;However, it looks like only within the function, the info of C exists. When I try to print values_C outside of the function, the pointer seems to be NULL. It looks like that the memory is allocated by&amp;nbsp;mkl_sparse_d_export_csr within the function, but no longer exists after the function call.&lt;/P&gt;

&lt;P&gt;Here is the function:&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:cpp; class-name:dark;"&gt;  void spmm(int M, int N, int K,
          int* rowIndex_A, int* columns_A, double* values_A,
          int* rowIndex_B, int* columns_B, double* values_B,
          int* pointerB_C, int* pointerE_C, int* columns_C, double* values_C){
  
      int  rows, cols;
      sparse_index_base_t    indexing;
      sparse_matrix_t        csrA = NULL, csrB = NULL, csrC = NULL;

      mkl_sparse_d_create_csr( &amp;amp;csrA, SPARSE_INDEX_BASE_ZERO, M, K, rowIndex_A, rowIndex_A+1, columns_A, values_A );
      mkl_sparse_d_create_csr( &amp;amp;csrB, SPARSE_INDEX_BASE_ZERO, K, N, rowIndex_B, rowIndex_B+1, columns_B, values_B );
  
      mkl_sparse_spmm( SPARSE_OPERATION_NON_TRANSPOSE, csrA, csrB, &amp;amp;csrC );
      mkl_sparse_d_export_csr( csrC, &amp;amp;indexing, &amp;amp;rows, &amp;amp;cols, &amp;amp;pointerB_C, &amp;amp;pointerE_C, &amp;amp;columns_C, &amp;amp;values_C )

      mkl_sparse_destroy( csrA );
      mkl_sparse_destroy( csrB );
      mkl_sparse_destroy( csrC );
  }&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Any suggestions on solving t&lt;SPAN style="font-size: 1em;"&gt;his issue? Thanks a lot! A relevant question is how to use spmm in python/scipy, which is purpose why I wrote such a function.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Best,&lt;/P&gt;

&lt;P&gt;Zhihao&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 08:11:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Return-mkl-sparse-spmm-Results/m-p/1132306#M25697</guid>
      <dc:creator>cui__zhihao</dc:creator>
      <dc:date>2018-09-20T08:11:06Z</dc:date>
    </item>
    <item>
      <title>Hi,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Return-mkl-sparse-spmm-Results/m-p/1132307#M25698</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
	&lt;BR /&gt;
	The memory for csrC and for the CSR representation, that you want to return (i.e. pointerB_C, pointerE_C, columns_C, values_C) is indeed allocated inside the mkl_sparse_spmm() routine.&lt;BR /&gt;
	In order to use the data outside of spmm() function, you should go with the next interface, using double pointers for C data:&lt;/P&gt;

&lt;DIV class="line alt1" style="font-family: Consolas, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 13.008px; color: rgb(96, 96, 96); margin: 0px !important; padding: 0px !important; border: 0px !important; outline: 0px !important; background-image: none !important; background-position: initial !important; background-size: initial !important; background-repeat: initial !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.1em !important; min-height: auto !important;"&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;PRE class="brush:cpp;"&gt;void spmm(int M, int N, int K,
        int* rowIndex_A, int* columns_A, double* values_A,
        int* rowIndex_B, int* columns_B, double* values_B,
        int** pointerB_C, int** pointerE_C, int** columns_C, double** values_C)&lt;/PRE&gt;

&lt;P&gt;Hope, this will help!&lt;BR /&gt;
	&lt;BR /&gt;
	Best regards,&lt;BR /&gt;
	Maria&lt;/P&gt;</description>
      <pubDate>Fri, 21 Sep 2018 19:11:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Return-mkl-sparse-spmm-Results/m-p/1132307#M25698</guid>
      <dc:creator>MariaZh</dc:creator>
      <dc:date>2018-09-21T19:11:00Z</dc:date>
    </item>
    <item>
      <title>Quote:Zhukova, Maria (Intel)</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Return-mkl-sparse-spmm-Results/m-p/1132308#M25699</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Zhukova, Maria (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;The memory for csrC and for the CSR representation, that you want to return (i.e. pointerB_C, pointerE_C, columns_C, values_C) is indeed allocated inside the mkl_sparse_spmm() routine.&lt;BR /&gt;
	In order to use the data outside of spmm() function, you should go with the next interface, using double pointers for C data:&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;void spmm(int M, int N, int K,
        int* rowIndex_A, int* columns_A, double* values_A,
        int* rowIndex_B, int* columns_B, double* values_B,
        int** pointerB_C, int** pointerE_C, int** columns_C, double** values_C)&lt;/PRE&gt;

&lt;P&gt;Hope, this will help!&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
	Maria&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks for your reply, it works. The only question in Python side is that you have to free the memory by hand in this case. Is there already some API for MKL Sparse Blas in Python?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Best,&lt;/P&gt;

&lt;P&gt;Zhihao&lt;/P&gt;</description>
      <pubDate>Fri, 21 Sep 2018 20:39:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Return-mkl-sparse-spmm-Results/m-p/1132308#M25699</guid>
      <dc:creator>cui__zhihao</dc:creator>
      <dc:date>2018-09-21T20:39:01Z</dc:date>
    </item>
  </channel>
</rss>

