<?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 Hi Marc, in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Question-about-mkl-sparse-d-export-csr/m-p/1089933#M23171</link>
    <description>&lt;P&gt;Hi Marc,&lt;/P&gt;

&lt;P&gt;You correct, the arrays returned by export function allocated internally and deallocated by mkl_sparse_destroy&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Alex&lt;/P&gt;</description>
    <pubDate>Wed, 08 Feb 2017 05:09:12 GMT</pubDate>
    <dc:creator>Alexander_K_Intel2</dc:creator>
    <dc:date>2017-02-08T05:09:12Z</dc:date>
    <item>
      <title>Question about mkl_sparse_d_export_csr</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Question-about-mkl-sparse-d-export-csr/m-p/1089932#M23170</link>
      <description>&lt;P&gt;I am using&amp;nbsp;mkl_sparse_d_export_csr to access the arrays rows_start and rows_end of the csr representation of my matrix. I have a question about memory allocation. Before call&amp;nbsp;mkl_sparse_d_export_csr, I am allocating the 4 arrays for the matrix by using new. My programm crashes when I am trying to delete these arrays after using&amp;nbsp;mkl_sparse_d_export_csr. I would like to know if the memory is allocated inside the function, as it looks like, or if it needs to be allocated before calling the function. I am assuming the answer is that it is allocated by the function and freed when I call mkl_sparse_destroy. Am I right?&lt;/P&gt;

&lt;P&gt;Thanks,Marc&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2017 17:04:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Question-about-mkl-sparse-d-export-csr/m-p/1089932#M23170</guid>
      <dc:creator>marcsolal</dc:creator>
      <dc:date>2017-02-07T17:04:52Z</dc:date>
    </item>
    <item>
      <title>Hi Marc,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Question-about-mkl-sparse-d-export-csr/m-p/1089933#M23171</link>
      <description>&lt;P&gt;Hi Marc,&lt;/P&gt;

&lt;P&gt;You correct, the arrays returned by export function allocated internally and deallocated by mkl_sparse_destroy&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Alex&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 05:09:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Question-about-mkl-sparse-d-export-csr/m-p/1089933#M23171</guid>
      <dc:creator>Alexander_K_Intel2</dc:creator>
      <dc:date>2017-02-08T05:09:12Z</dc:date>
    </item>
    <item>
      <title>Hello Marc,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Question-about-mkl-sparse-d-export-csr/m-p/1089934#M23172</link>
      <description>&lt;P&gt;Hello Marc,&lt;/P&gt;

&lt;P&gt;There is no need to allocate memory for mkl_sparse_._export output arrays.&amp;nbsp;Routines such as mkl_sparse_._mm, mkl_sparse_._add, mkl_sparse_._spmm, mkl_sparse_._convert compute size of output sparse matrix arrays&amp;nbsp;and&amp;nbsp;allocate memory&amp;nbsp;internally. To free this memory you simply call mkl_sparse_destroy. User only allocates input matrices for the above routines before passing them to mkl_sparse_create routine. The example of usage is the following:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;/* Allocate input CSR arrays */
double *values_A = (double *)mkl_malloc(sizeof(double) * NNZ, ALIGN);
MKL_INT *columns_A = (MKL_INT *)mkl_malloc(sizeof(MKL_INT) * NNZ, ALIGN);
MKL_INT *rowIndex_A = (MKL_INT *)mkl_malloc(sizeof(MKL_INT) * (M + 1), ALIGN);

double *values_B = (double *)mkl_malloc(sizeof(double) * M, ALIGN);
MKL_INT *columns_B = (MKL_INT *)mkl_malloc(sizeof(MKL_INT) * M, ALIGN);
MKL_INT *rowIndex_B = (MKL_INT *)mkl_malloc(sizeof(MKL_INT) * (M + 1), ALIGN);

double *values_C;
MKL_INT *columns_C;
MKL_INT *rowIndex_C;

//some code here, preparing arrays, related to matrices.

/* Create handles for matrices A and B stored in CSR format */
mkl_sparse_d_create_csr( &amp;amp;csrA, SPARSE_INDEX_BASE_ZERO, M, M, rowIndex_A, rowIndex_A+1, columns_A, values_A );
mkl_sparse_d_create_csr( &amp;amp;csrB, SPARSE_INDEX_BASE_ZERO, M, M, rowIndex_B, rowIndex_B+1, columns_B, values_B );

// C = A*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 );
//some code here

&amp;nbsp;/* Release matrix handle. Not necessary to deallocate arrays for which we don't allocate memory: values_C, columns_C, pointerB_C, and pointerE_C.
These arrays will be deallocated together with csrC structure. */
mkl_sparse_destroy( csrC );

&amp;nbsp;//Release matrix handle and deallocate arrays for which we allocate memory ourselves.
mkl_sparse_destroy( csrA );
mkl_free(values_A); mkl_free(columns_A); mkl_free(rowIndex_A);

mkl_sparse_destroy( csrB );
mkl_free(values_B); mkl_free(columns_B); mkl_free(rowIndex_B);
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 05:29:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Question-about-mkl-sparse-d-export-csr/m-p/1089934#M23172</guid>
      <dc:creator>Irina_S_Intel</dc:creator>
      <dc:date>2017-02-08T05:29:37Z</dc:date>
    </item>
  </channel>
</rss>

