<?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 SPBLAS Question : sparse matrix-vector multiplication in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-SPBLAS-Question-sparse-matrix-vector-multiplication/m-p/857680#M7164</link>
    <description>Hi all&lt;BR /&gt;&lt;BR /&gt;I have this simple test program (which I wrote after getting frustrated with a bigger program!!).&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Description of the program:&lt;/STRONG&gt;&lt;BR /&gt;-- The program computes the product of a sparse matrix with a vector. The sparse matrix i gave is filled with Ones, and the vector is also filled with Ones.&lt;BR /&gt;&lt;BR /&gt;-- The difference between the last two mkl_dcoomv calls in the code is the order in which row indices and col indices are sent.&lt;BR /&gt;&lt;BR /&gt;-- I created the matrix such that it is symmetric, so that rowindices and column indices can be interchanged without any problem.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Question:&lt;/STRONG&gt; Why do I get different results for both the calls when the matrix is symmetric and interchanging rows and cols should not matter? &lt;BR /&gt;&lt;BR /&gt;For the second call to the coomv, if I give the transpose 'T", it gives the right result (which is understandable of course!). &lt;BR /&gt;&lt;BR /&gt;Does it have to do with the index sorting in coordinate reprsentation? If so, i did not find it anywhere explicitly mentioned in the documentation!&lt;BR /&gt;&lt;BR /&gt;
&lt;PRE&gt;[cpp]real(8), dimension(100) :: vA;
integer, dimension(100) :: iA;
integer, dimension(100) :: jA;
real(8),dimension(10) :: ones;
real(8),dimension(10) :: sumA;

integer :: i,j;

k = 1;
do i=1,10
do j=1,10
iA(k) = i;
jA(k) = j;
vA(k) = 1;
k = k + 1;
enddo
enddo

sumA = 0;
ones = 1;
call mkl_dcoogemv('T',10,vA,iA,jA,100,ones,sumA);
print*, sumA;

sumA = 0;
call mkl_dcoogemv('T',10,vA,jA,iA,100,ones,sumA);
print*, sumA;

end
[/cpp]&lt;/PRE&gt;
&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Both of the outputs are incorrect (I was wrong before, Sorry about it!)&lt;BR /&gt;&lt;EM&gt;&lt;BR /&gt; 5.00000000000000        5.00000000000000        5.00000000000000        5.00000000000000        5.00000000000000        5.00000000000000        5.00000000000000        5.00000000000000        5.00000000000000        5.00000000000000     &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; 10.0000000000000        10.0000000000000        10.0000000000000        10.0000000000000     10.0000000000000       0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000&lt;BR /&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;Here is the compilation command I used:&lt;BR /&gt;&lt;EM&gt;&lt;BR /&gt;ifort -i8 -debug all -I /opt/intel/mkl/10.1.1.019/include/   test.f90 -L /opt/intel/mkl/10.1.1.019/lib/em64t/ -lmkl -lm  -openmp&lt;BR /&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;I would greatly appreciate any help.&lt;BR /&gt;Thank you.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Pavan&lt;BR /&gt;</description>
    <pubDate>Sun, 25 Jan 2009 05:55:02 GMT</pubDate>
    <dc:creator>pavanm</dc:creator>
    <dc:date>2009-01-25T05:55:02Z</dc:date>
    <item>
      <title>MKL SPBLAS Question : sparse matrix-vector multiplication</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-SPBLAS-Question-sparse-matrix-vector-multiplication/m-p/857680#M7164</link>
      <description>Hi all&lt;BR /&gt;&lt;BR /&gt;I have this simple test program (which I wrote after getting frustrated with a bigger program!!).&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Description of the program:&lt;/STRONG&gt;&lt;BR /&gt;-- The program computes the product of a sparse matrix with a vector. The sparse matrix i gave is filled with Ones, and the vector is also filled with Ones.&lt;BR /&gt;&lt;BR /&gt;-- The difference between the last two mkl_dcoomv calls in the code is the order in which row indices and col indices are sent.&lt;BR /&gt;&lt;BR /&gt;-- I created the matrix such that it is symmetric, so that rowindices and column indices can be interchanged without any problem.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Question:&lt;/STRONG&gt; Why do I get different results for both the calls when the matrix is symmetric and interchanging rows and cols should not matter? &lt;BR /&gt;&lt;BR /&gt;For the second call to the coomv, if I give the transpose 'T", it gives the right result (which is understandable of course!). &lt;BR /&gt;&lt;BR /&gt;Does it have to do with the index sorting in coordinate reprsentation? If so, i did not find it anywhere explicitly mentioned in the documentation!&lt;BR /&gt;&lt;BR /&gt;
&lt;PRE&gt;[cpp]real(8), dimension(100) :: vA;
integer, dimension(100) :: iA;
integer, dimension(100) :: jA;
real(8),dimension(10) :: ones;
real(8),dimension(10) :: sumA;

integer :: i,j;

k = 1;
do i=1,10
do j=1,10
iA(k) = i;
jA(k) = j;
vA(k) = 1;
k = k + 1;
enddo
enddo

sumA = 0;
ones = 1;
call mkl_dcoogemv('T',10,vA,iA,jA,100,ones,sumA);
print*, sumA;

sumA = 0;
call mkl_dcoogemv('T',10,vA,jA,iA,100,ones,sumA);
print*, sumA;

end
[/cpp]&lt;/PRE&gt;
&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Both of the outputs are incorrect (I was wrong before, Sorry about it!)&lt;BR /&gt;&lt;EM&gt;&lt;BR /&gt; 5.00000000000000        5.00000000000000        5.00000000000000        5.00000000000000        5.00000000000000        5.00000000000000        5.00000000000000        5.00000000000000        5.00000000000000        5.00000000000000     &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; 10.0000000000000        10.0000000000000        10.0000000000000        10.0000000000000     10.0000000000000       0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000&lt;BR /&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;Here is the compilation command I used:&lt;BR /&gt;&lt;EM&gt;&lt;BR /&gt;ifort -i8 -debug all -I /opt/intel/mkl/10.1.1.019/include/   test.f90 -L /opt/intel/mkl/10.1.1.019/lib/em64t/ -lmkl -lm  -openmp&lt;BR /&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;I would greatly appreciate any help.&lt;BR /&gt;Thank you.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Pavan&lt;BR /&gt;</description>
      <pubDate>Sun, 25 Jan 2009 05:55:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-SPBLAS-Question-sparse-matrix-vector-multiplication/m-p/857680#M7164</guid>
      <dc:creator>pavanm</dc:creator>
      <dc:date>2009-01-25T05:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: MKL SPBLAS Question : sparse matrix-vector multiplication</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-SPBLAS-Question-sparse-matrix-vector-multiplication/m-p/857681#M7165</link>
      <description>&lt;BR /&gt;
&lt;P&gt;Hi Pavan, &lt;BR /&gt;You wrote: "The output of the above program is as follows: (first one is correct, while the second one is absolute junk!!)" &lt;EM&gt;&lt;EM&gt;5.00000000000000 5.00000000000000 5.00000000000000 5.00000000000000 5.00000000000000 5.00000000000000 5.00000000000000 5.00000000000000 5.00000000000000 5.00000000000000&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;but, at the first glance, for your example ( when all matrix's and input vector's elements filled by Ones ) it seems that, the output vector must be == 10.0 but no 5.0.&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;can you please check the problem with the follow linking:&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;EM&gt;ifort -w -i8 -I${MKL_INCL} test.f  ${MKL_LIB}/libmkl_intel_lp64.a &lt;BR /&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;-Wl,--start-group&lt;BR /&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;${MKL_LIB}/libmkl_intel_threa.a ${MKL_LIB}/libmkl_core.a &lt;BR /&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;-Wl,--end-group &lt;BR /&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;-liomp5 -lpthread -lm -o test.out&lt;BR /&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;where &lt;BR /&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;MKL_INCL=/opt/intel/mkl/10.XXX/include&lt;BR /&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;MKL_LIB=/opt/intel/mkl/10.XXX/lib/em64t&lt;BR /&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;--Gennady&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jan 2009 05:33:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-SPBLAS-Question-sparse-matrix-vector-multiplication/m-p/857681#M7165</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2009-01-26T05:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: MKL SPBLAS Question : sparse matrix-vector multiplication</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-SPBLAS-Question-sparse-matrix-vector-multiplication/m-p/857682#M7166</link>
      <description>Hi Gennady,&lt;BR /&gt;&lt;BR /&gt;Thanks for the response. Your comment on the solution being all 10s and not 5s is right. I was carried away by the fact that all the values are equal in solution 1. I corrected the original question also in my first post.&lt;BR /&gt;&lt;BR /&gt;I was working on a program since last 15 days and could not figure this out (the program should have been done in a day !!)&lt;BR /&gt;&lt;BR /&gt;So, basically - both the solutions are incorrect. I did compile the code with the command you gave:&lt;BR /&gt;
&lt;PRE&gt;[shell]ifort -w -i8 -I/opt/intel/mkl/10.1.1.019/include test.f90  -L/opt/intel/mkl/10.1.1.019/lib/em64t  /opt/intel/mkl/10.1.1.019/lib/em64t/libmkl_intel_lp64.a  -Wl,--start-group  /opt/intel/mkl/10.1.1.019/lib/em64t/libmkl_intel_thread.a /opt/intel/mkl/10.1.1.019/lib/em64t/libmkl_core.a  -Wl,--end-group -liomp5 -lpthread -lm -o test.out [/shell]&lt;/PRE&gt;
&lt;BR /&gt;There is no difference in the solution. I still get the same solution.&lt;BR /&gt;&lt;BR /&gt;
&lt;PRE&gt;[plain]   5.00000000000000        5.00000000000000        5.00000000000000     
   5.00000000000000        5.00000000000000        5.00000000000000     
   5.00000000000000        5.00000000000000        5.00000000000000     
   5.00000000000000     
   10.0000000000000        10.0000000000000        10.0000000000000     
   10.0000000000000        10.0000000000000       0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000
  0.000000000000000E+000
[/plain]&lt;/PRE&gt;
&lt;BR /&gt;Please let me know what can be done. The example I have provided is too small to have any major bugs in it, but who knows! :)&lt;BR /&gt;&lt;BR /&gt;Thank you once again,&lt;BR /&gt;&lt;BR /&gt;Pavan.&lt;BR /&gt;&lt;BR /&gt;P.S. I am not able to reply to your post (forums are giving Page not found error), so I am replying to my own email. I am not sure if you will recieve this.&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Jan 2009 06:29:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-SPBLAS-Question-sparse-matrix-vector-multiplication/m-p/857682#M7166</guid>
      <dc:creator>pavanm</dc:creator>
      <dc:date>2009-01-26T06:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: MKL SPBLAS Question : sparse matrix-vector multiplication</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-SPBLAS-Question-sparse-matrix-vector-multiplication/m-p/857683#M7167</link>
      <description>&lt;BR /&gt;
&lt;P&gt;Pavan, &lt;BR /&gt;The cause of this problem dealt with interface library you are using:&lt;BR /&gt;for this case please use ilp64 library (libmkl_intel_ilp64.a ) instead of lp64 one.&lt;/P&gt;
&lt;P&gt;ifort-w-i8-I/opt/intel/mkl/10.1.1.019/include&lt;STRONG&gt;test&lt;/STRONG&gt;.f90-L/opt/intel/mkl/10.1.1.019/lib/em64t/opt/intel/mkl/10.1.1.019/lib/em64t/libmkl_intel_ilp64.a.........&lt;/P&gt;
&lt;P&gt;or use building line without -i8 option&lt;BR /&gt;in this case you can use libmkl_intel_lp64.a&lt;/P&gt;
&lt;P&gt;--Gennady&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jan 2009 16:54:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-SPBLAS-Question-sparse-matrix-vector-multiplication/m-p/857683#M7167</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2009-01-26T16:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: MKL SPBLAS Question : sparse matrix-vector multiplication</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-SPBLAS-Question-sparse-matrix-vector-multiplication/m-p/857684#M7168</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Hi Gennady,&lt;BR /&gt;&lt;BR /&gt;Thank you very much for the response. It worked. Its not really essential, only if you have time, can you please let me know what the reason for this behaviour is?&lt;BR /&gt;&lt;BR /&gt;Thank you once again.&lt;BR /&gt;&lt;BR /&gt;Bye&lt;BR /&gt;Pavan&lt;BR /&gt;&lt;/DIV&gt;
&lt;BR /&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Jan 2009 17:00:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-SPBLAS-Question-sparse-matrix-vector-multiplication/m-p/857684#M7168</guid>
      <dc:creator>pavanm</dc:creator>
      <dc:date>2009-01-26T17:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: MKL SPBLAS Question : sparse matrix-vector multiplication</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-SPBLAS-Question-sparse-matrix-vector-multiplication/m-p/857685#M7169</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/334681"&gt;Gennady Fedorov (Intel)&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;&lt;BR /&gt;
&lt;P&gt;Hi Pavan, &lt;BR /&gt;You wrote: "The output of the above program is as follows: (first one is correct, while the second one is absolute junk!!)" &lt;EM&gt;&lt;EM&gt;5.00000000000000 5.00000000000000 5.00000000000000 5.00000000000000 5.00000000000000 5.00000000000000 5.00000000000000 5.00000000000000 5.00000000000000 5.00000000000000&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;but, at the first glance, for your example ( when all matrix's and input vector's elements filled by Ones ) it seems that, the output vector must be == 10.0 but no 5.0.&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;can you please check the problem with the follow linking:&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;EM&gt;ifort -w -i8 -I${MKL_INCL} test.f  ${MKL_LIB}/libmkl_intel_lp64.a &lt;BR /&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;-Wl,--start-group&lt;BR /&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;${MKL_LIB}/libmkl_intel_threa.a ${MKL_LIB}/libmkl_core.a &lt;BR /&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;-Wl,--end-group &lt;BR /&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;-liomp5 -lpthread -lm -o test.out&lt;BR /&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;where &lt;BR /&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;MKL_INCL=/opt/intel/mkl/10.XXX/include&lt;BR /&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;MKL_LIB=/opt/intel/mkl/10.XXX/lib/em64t&lt;BR /&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;EM&gt;&lt;EM&gt;--Gennady&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Jan 2009 22:07:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-SPBLAS-Question-sparse-matrix-vector-multiplication/m-p/857685#M7169</guid>
      <dc:creator>Anand_M_Intel</dc:creator>
      <dc:date>2009-01-26T22:07:01Z</dc:date>
    </item>
  </channel>
</rss>

