<?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 Re: Sparse matrix - vector multiplication goes wrong in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-matrix-vector-multiplication-goes-wrong/m-p/1301148#M31785</link>
    <description>&lt;P&gt;Hi Bingqi!&lt;/P&gt;
&lt;P&gt;I've found the issue in your code. You're redefining MKL_INT to be long int. This is an incorrect way of using MKL with 64-bit integers. Essentially, size of integers passed via pointers to MKL is defined by the interface layer, LP64 or ILP64 (and if you are using MKL_INT in your example code, on the definition of MKL_INT as well).&lt;/P&gt;
&lt;P&gt;Essentially, what happened in your case is that you passed 64-bit integer arrays to mkl_sparse_z_mv routine but since you didn't do it properly, routine treated them as pointers to 32-bit integer arrays, hence incorrect result.&lt;/P&gt;
&lt;P&gt;The correct way is:&lt;/P&gt;
&lt;P&gt;Change your compilation and link line according to MKL link line advisor for 64-bit integers (i.e. choose ("C API with 64-bit integers" option). You would need to add -DMKL_ILP64 to your compilation line and also link against mkl_intel_ilp64 instead of mkl_intel_lp64 interface library.&lt;/P&gt;
&lt;P&gt;Then you would get correct results (all zeros) for the output vector.&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;Best,&lt;BR /&gt;Kirill&lt;/P&gt;</description>
    <pubDate>Sun, 25 Jul 2021 23:46:13 GMT</pubDate>
    <dc:creator>Kirill_V_Intel</dc:creator>
    <dc:date>2021-07-25T23:46:13Z</dc:date>
    <item>
      <title>Sparse matrix - vector multiplication goes wrong</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-matrix-vector-multiplication-goes-wrong/m-p/1300805#M31782</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I encounters with some problems that have to use sparse matrix to solve, so I start to learn MKL Sparse BLAS. However, I cannot get right result when calling mkl_sparse_z_mv. I still cannot find the solution after reading the MKL reference manual and casting several demos.&lt;/P&gt;
&lt;P&gt;So, how can I get a correct sparse matrix - vector multiplication? &lt;SPAN&gt;Any help is appreciated.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Many thanks,&lt;/P&gt;
&lt;P&gt;Bingqi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS: The demo is attached to this post with source code and results, along with MKL version &amp;amp; platform information.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 07:53:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-matrix-vector-multiplication-goes-wrong/m-p/1300805#M31782</guid>
      <dc:creator>BQ_Li</dc:creator>
      <dc:date>2021-07-23T07:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: Sparse matrix - vector multiplication goes wrong</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-matrix-vector-multiplication-goes-wrong/m-p/1300807#M31783</link>
      <description>&lt;P&gt;Supplement: What I want to calculate is the following matrix - vector multiplication:&lt;/P&gt;
&lt;P&gt;A = {&lt;/P&gt;
&lt;P&gt;{ 0, 0.5i, -0.5i, 0},&lt;/P&gt;
&lt;P&gt;{0.5i, -i, 0, -0.5i},&lt;/P&gt;
&lt;P&gt;{-0.5i, 0, i, 0.5i},&lt;/P&gt;
&lt;P&gt;{0, -0.5i, 0.5i, 0}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;P&gt;x = { 0.3799605, -0.1200395, -0.1200395, 0.6200395}&lt;/P&gt;
&lt;P&gt;The result, Ax, should be a zero vector. But I cannot get the correct result.&lt;/P&gt;
&lt;P&gt;I am not sure if I have missed someting in the documentation.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 08:06:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-matrix-vector-multiplication-goes-wrong/m-p/1300807#M31783</guid>
      <dc:creator>BQ_Li</dc:creator>
      <dc:date>2021-07-23T08:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: Sparse matrix - vector multiplication goes wrong</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-matrix-vector-multiplication-goes-wrong/m-p/1301148#M31785</link>
      <description>&lt;P&gt;Hi Bingqi!&lt;/P&gt;
&lt;P&gt;I've found the issue in your code. You're redefining MKL_INT to be long int. This is an incorrect way of using MKL with 64-bit integers. Essentially, size of integers passed via pointers to MKL is defined by the interface layer, LP64 or ILP64 (and if you are using MKL_INT in your example code, on the definition of MKL_INT as well).&lt;/P&gt;
&lt;P&gt;Essentially, what happened in your case is that you passed 64-bit integer arrays to mkl_sparse_z_mv routine but since you didn't do it properly, routine treated them as pointers to 32-bit integer arrays, hence incorrect result.&lt;/P&gt;
&lt;P&gt;The correct way is:&lt;/P&gt;
&lt;P&gt;Change your compilation and link line according to MKL link line advisor for 64-bit integers (i.e. choose ("C API with 64-bit integers" option). You would need to add -DMKL_ILP64 to your compilation line and also link against mkl_intel_ilp64 instead of mkl_intel_lp64 interface library.&lt;/P&gt;
&lt;P&gt;Then you would get correct results (all zeros) for the output vector.&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;Best,&lt;BR /&gt;Kirill&lt;/P&gt;</description>
      <pubDate>Sun, 25 Jul 2021 23:46:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-matrix-vector-multiplication-goes-wrong/m-p/1301148#M31785</guid>
      <dc:creator>Kirill_V_Intel</dc:creator>
      <dc:date>2021-07-25T23:46:13Z</dc:date>
    </item>
    <item>
      <title>Re:Sparse matrix - vector multiplication goes wrong</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-matrix-vector-multiplication-goes-wrong/m-p/1302456#M31821</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Can you please let us know if your issue has been resolved or not?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Rajesh&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Jul 2021 07:56:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-matrix-vector-multiplication-goes-wrong/m-p/1302456#M31821</guid>
      <dc:creator>MRajesh_intel</dc:creator>
      <dc:date>2021-07-30T07:56:53Z</dc:date>
    </item>
    <item>
      <title>Re:Sparse matrix - vector multiplication goes wrong</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-matrix-vector-multiplication-goes-wrong/m-p/1303832#M31855</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 14.6667px; font-family: Calibri, &amp;quot;Segoe UI&amp;quot;, Calibri, Thonburi, Arial, Verdana, sans-serif, &amp;quot;Mongolian Baiti&amp;quot;, &amp;quot;Microsoft Yi Baiti&amp;quot;, &amp;quot;Javanese Text&amp;quot;;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.6667px; font-family: Calibri, &amp;quot;Segoe UI&amp;quot;, Calibri, Thonburi, Arial, Verdana, sans-serif, &amp;quot;Mongolian Baiti&amp;quot;, &amp;quot;Microsoft Yi Baiti&amp;quot;, &amp;quot;Javanese Text&amp;quot;;"&gt;We have not heard back from you, so we will close this inquiry now. If you need further assistance, please post a new question.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.6667px; font-family: Calibri, &amp;quot;Segoe UI&amp;quot;, Calibri, Thonburi, Arial, Verdana, sans-serif, &amp;quot;Mongolian Baiti&amp;quot;, &amp;quot;Microsoft Yi Baiti&amp;quot;, &amp;quot;Javanese Text&amp;quot;;"&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.6667px; font-family: Calibri, &amp;quot;Segoe UI&amp;quot;, Calibri, Thonburi, Arial, Verdana, sans-serif, &amp;quot;Mongolian Baiti&amp;quot;, &amp;quot;Microsoft Yi Baiti&amp;quot;, &amp;quot;Javanese Text&amp;quot;;"&gt;Rajesh.&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Aug 2021 04:11:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-matrix-vector-multiplication-goes-wrong/m-p/1303832#M31855</guid>
      <dc:creator>MRajesh_intel</dc:creator>
      <dc:date>2021-08-05T04:11:49Z</dc:date>
    </item>
  </channel>
</rss>

