<?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: Using sparse matrix formats for Sparse Matrix Dense Vector Product in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1249243#M30744</link>
    <description>&lt;P&gt;When it comes to performing operations on matrices and vectors with different representations, the number of combinations can be large, and making routines to perform such operations&amp;nbsp; as general as possible can make the interfaces complicated and error prone.&lt;/P&gt;
&lt;P&gt;The following code will calculate b = M v.&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;!compute b = M.v, where M is m X n, CSR-represented with ir(1:m+1), jc(1:nnz), val(1:nnz)
!                       v is n X 1,
!                       b is m X 1
do i = 1, m
   s = 0
   do k=ir(i),ir(i+1)-1
      s = s+val(k)*v(jc(k))
   end do
   b(i) = s
end do &lt;/LI-CODE&gt;</description>
    <pubDate>Sat, 23 Jan 2021 14:50:55 GMT</pubDate>
    <dc:creator>mecej4</dc:creator>
    <dc:date>2021-01-23T14:50:55Z</dc:date>
    <item>
      <title>Using sparse matrix formats for Sparse Matrix Dense Vector Product</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1249238#M30743</link>
      <description>&lt;P&gt;I am trying to store a matrix in sparse format matrix vector product. In the documentation, I can only see sparse CSR format using set_crs_data function&amp;nbsp; and using the gemv to compute the product.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any other format supported by oneMKL to store sparse matrices and to compute the product of sparse matrix and dense vector product?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Jan 2021 14:22:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1249238#M30743</guid>
      <dc:creator>Nikhil_T</dc:creator>
      <dc:date>2021-01-23T14:22:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using sparse matrix formats for Sparse Matrix Dense Vector Product</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1249243#M30744</link>
      <description>&lt;P&gt;When it comes to performing operations on matrices and vectors with different representations, the number of combinations can be large, and making routines to perform such operations&amp;nbsp; as general as possible can make the interfaces complicated and error prone.&lt;/P&gt;
&lt;P&gt;The following code will calculate b = M v.&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;!compute b = M.v, where M is m X n, CSR-represented with ir(1:m+1), jc(1:nnz), val(1:nnz)
!                       v is n X 1,
!                       b is m X 1
do i = 1, m
   s = 0
   do k=ir(i),ir(i+1)-1
      s = s+val(k)*v(jc(k))
   end do
   b(i) = s
end do &lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 23 Jan 2021 14:50:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1249243#M30744</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2021-01-23T14:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using sparse matrix formats for Sparse Matrix Dense Vector Product</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1249244#M30745</link>
      <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/41971"&gt;@mecej4&lt;/a&gt;&amp;nbsp; I am dealing with a matrix of size one billion by one billion here. This method seems to perfrom poor. I was thinking to use one of the optimized functions of oneMKL.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Jan 2021 15:00:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1249244#M30745</guid>
      <dc:creator>Nikhil_T</dc:creator>
      <dc:date>2021-01-23T15:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: Using sparse matrix formats for Sparse Matrix Dense Vector Product</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1249365#M30746</link>
      <description>&lt;P&gt;mecej4's, code would be just as efficient as would be anything contained within a library. It is conceivably no different from:&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;!compute b = M.v, where M is m X n, CSR-represented with ir(1:m+1), jc(1:nnz), val(1:nnz)
!                       v is n X 1,
!                       b is m X 1
do i = 1, m
   j = ir(i)
   k = ir(i+1)-1
   b(i) = dotproduct(val(j:k)*v(jc(j:k))
end do
&lt;/LI-CODE&gt;
&lt;P&gt;At issue with the above code (assuming that is your issue) is the indexing of v(arraySliceOfIndexes).&lt;/P&gt;
&lt;P&gt;Depending on the targeted instruction set, this may generate vector gather instructions, and the efficiency/inefficiency of the execution would depend on the vector-wide compactness (or lack there of) the indices. IOW how many cache lines are involved in gathering the 8 or 16 groupings of v(jc(j:k)).&lt;/P&gt;
&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jan 2021 15:31:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1249365#M30746</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2021-01-24T15:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using sparse matrix formats for Sparse Matrix Dense Vector Product</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1249425#M30748</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;
&lt;P&gt;With all respect to&amp;nbsp;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/41971"&gt;@mecej4&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/63968"&gt;@jimdempseyatthecove&lt;/a&gt;, I believe they answered a different question than the one contained in the original post. There are many cases when writing an own version of sparse matrix - dense vector product is not the most efficient approach and decreases performance of the overall application significantly.&lt;/P&gt;
&lt;P&gt;oneMKL offers several ways to compute sparse matrix - dense vector product using optimized routines:&lt;/P&gt;
&lt;P&gt;1) DPC++ interfaces:&amp;nbsp;&lt;A href="https://docs.oneapi.com/versions/latest/onemkl/mkl-sparse-gemv.html" target="_blank" rel="noopener"&gt;https://docs.oneapi.com/versions/latest/onemkl/mkl-sparse-gemv.html&lt;/A&gt;&lt;BR /&gt;Currently, only CSR format is supported.&lt;/P&gt;
&lt;P&gt;2) C/Fortran interfaces with Inspector-Executor API (IE Sparse BLAS):&lt;BR /&gt;&lt;A href="https://software.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-fortran/top/blas-and-sparse-blas-routines/inspector-executor-sparse-blas-routines.html" target="_blank" rel="noopener"&gt;https://software.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-fortran/top/blas-and-sparse-blas-routines/inspector-executor-sparse-blas-routines.html&lt;/A&gt;&lt;BR /&gt;&lt;SPAN style="font-family: inherit;"&gt;This API has been developed to enhance the NIST-like Sparse BLAS API (see below) with a higher-level approach.&lt;BR /&gt;&lt;/SPAN&gt;API for spmv,&amp;nbsp;&lt;A href="https://software.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-fortran/top/blas-and-sparse-blas-routines/inspector-executor-sparse-blas-routines/inspector-executor-sparse-blas-execution-routines/mkl-sparse-mv.html" target="_blank" rel="noopener"&gt;https://software.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-fortran/top/blas-and-sparse-blas-routines/inspector-executor-sparse-blas-routines/inspector-executor-sparse-blas-execution-routines/mkl-sparse-mv.html&lt;/A&gt;&amp;nbsp;supports through an opaque handle the formats: CSR, CSC, COO, BSR.&lt;BR /&gt;Plus, additionally, by calling the mkl_sparse_optimize() routine with approriate hints the user can enable several internal formats (which are stored as optimized data inside the matrix handle) which are tuned for performance and work very well for appropriate sparsity patterns.&lt;/P&gt;
&lt;P&gt;3) C/Fortran interfaces with NIST-like Sparse BLAS API:&amp;nbsp;&lt;A href="https://software.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-fortran/top/blas-and-sparse-blas-routines/sparse-blas-level-2-and-level-3-routines/sparse-blas-level-2-and-level-3-routines-1.html" target="_blank" rel="noopener"&gt;https://software.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-fortran/top/blas-and-sparse-blas-routines/sparse-blas-level-2-and-level-3-routines/sparse-blas-level-2-and-level-3-routines-1.html&lt;/A&gt;&lt;BR /&gt;These are also present in oneMKL as oneMKL has everything what MKL had (plus, additionally, new DPC++ stuff).&lt;BR /&gt;As you might see, it is low-level API with different APIs for different formats: CSR, CSC, COO, BSR, DIA.&lt;BR /&gt;&lt;SPAN style="font-family: inherit;"&gt;This API is declared deprecated but is still supported. But I recomment using IE Sparse BLAS API described above.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;4) C interface for GraphBLAS-like API (experimental):&lt;BR /&gt;&lt;A href="https://software.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/graph-routines/graph-functionality/graph-operations/mkl-graph-mxv.html" target="_blank" rel="noopener"&gt;https://software.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/graph-routines/graph-functionality/graph-operations/mkl-graph-mxv.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Provides additional flexibility (if you're familiar with GraphBLAS project) to the performed operation (allows semirings and masks, for example), integer/boolean valus and sparse input/output vectors.&lt;BR /&gt;Supports CSR and CSC formats.&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, 24 Jan 2021 22:46:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1249425#M30748</guid>
      <dc:creator>Kirill_V_Intel</dc:creator>
      <dc:date>2021-01-24T22:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using sparse matrix formats for Sparse Matrix Dense Vector Product</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1249844#M30757</link>
      <description>&lt;P&gt;Thanks for the reply&amp;nbsp;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/111125"&gt;@Kirill_V_Intel&lt;/a&gt;. The second solution seems to work for me. However I do have other doubts having read the implementations of the same:&lt;/P&gt;
&lt;P&gt;1) Are these libraries accessible in the DPC++?&lt;/P&gt;
&lt;P&gt;2) If yes, do these function and other function of oneMKL work in parallel mode? If they can be, what is the procedure for executing these function (including the ones mentioned in the 2 point of your answer) in parallel mode for VS2019?&lt;/P&gt;
&lt;P&gt;3) Is there a way to have repeated entries of col and row data but different values (so that the compiler automatically sums up the values that have the same col and row values; much like it is done in scipy). Or does it need to be implemented by the programmer?&lt;/P&gt;
&lt;P&gt;4) Parts of my algorithm requires to a have the diagonal entries of CSR matrix as a separate matrix and the strictly upper and strictly lower parts as another separate matrix. Does oneMKL supports any such feature that can split one CSR matrix into diagonal and the rest as two matrices? Or any method that can give one of them as a separate matrix?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 00:24:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1249844#M30757</guid>
      <dc:creator>Nikhil_T</dc:creator>
      <dc:date>2021-01-26T00:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using sparse matrix formats for Sparse Matrix Dense Vector Product</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1249910#M30761</link>
      <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/143036"&gt;@Nikhil_T&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;1) Yes. oneMKL is in this sense an extension of MKL, with an addition of the new DPC++ interfaces (which can work on GPU) for selected functionality. So you can use any of the functionality which was available with C/Fortran interfaces of MKL. Of course, MKL only supported CPUs so if you want to execute your code on GPU using C/Fortran interfaces, you need to use OpenMP offload.&lt;/P&gt;
&lt;P&gt;2) If you want to use the C/Fortran interfaces ...&lt;BR /&gt;a) ... on CPU, basically, you will just call a C function from MKL in your DPC++ code. If you link your application with a threaded version of MKL libraries, parallelization will happen inside MKL and you don't need to do anything specific. That's the way MKL works.&lt;/P&gt;
&lt;P&gt;b) ... on GPU, you will need to use special OpenMP offload #pragmas.&lt;/P&gt;
&lt;P&gt;3) Such duplicates accumulation will not be done by compiler, it is something to be done in runtime. It is possible but currently is not supported in sparse functionality of MKL/oneMKL.&lt;/P&gt;
&lt;P&gt;4) Currently, MKL cannot do any sparse operation on such matrix decomposition via a single call. Neither it can create such a splitting. It is a bit too custom an operation and also difficult to optimize in a general setting.&lt;/P&gt;
&lt;P&gt;I hope other experts here can add more to my answer and provide more links to various doc pages and KB articles about how to properly use oneMKL functionality.&lt;/P&gt;
&lt;P&gt;Best,&lt;BR /&gt;Kirill&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 05:12:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1249910#M30761</guid>
      <dc:creator>Kirill_V_Intel</dc:creator>
      <dc:date>2021-01-26T05:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using sparse matrix formats for Sparse Matrix Dense Vector Product</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1250035#M30766</link>
      <description>&lt;P&gt;Thanks for reply. for the point no. 2, how do I link my application with the threaded version of mkl library. Also to mention, I am a complete beginner in this field and dont have much experience with CLI interface based compilation. Could you please tell how to do this considering that I am a starter in this domain?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 14:22:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1250035#M30766</guid>
      <dc:creator>Nikhil_T</dc:creator>
      <dc:date>2021-01-26T14:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using sparse matrix formats for Sparse Matrix Dense Vector Product</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1250171#M30769</link>
      <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/111125"&gt;@Kirill_V_Intel&lt;/a&gt;&amp;nbsp;I have another doubt as well. The mkl_sparse_spmm accepts the handles for the matrices. Does it accepts the handle that has been set by init_matrix_handle of Sparse BLAS routine or it only accepts the handles set up by sparse_matrix_t??&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 21:54:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1250171#M30769</guid>
      <dc:creator>Nikhil_T</dc:creator>
      <dc:date>2021-01-26T21:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using sparse matrix formats for Sparse Matrix Dense Vector Product</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1251045#M30779</link>
      <description>&lt;P&gt;Hi again,&lt;/P&gt;
&lt;P&gt;1) About the handles, the answer is no. Better think of C/Fortran interfaces and DPC++ interfaces as separate sets of API. You cannot currently pass a matrix handle from IE SpBLAS into DPC++ routines like the one created by&amp;nbsp;&lt;SPAN&gt;init_matrix_handle.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The only way you can exchange information between handles created by different APIs is through explicitly exporting data (e.g., raw CSR pointers) from one of them and putting the data into the (newly created) handle of the other type.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2) As for linking MKL: I think you've opened another question [I'd recommend to do that anyway], so folks there will help you with that.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best,&lt;BR /&gt;Kirill&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 23:35:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1251045#M30779</guid>
      <dc:creator>Kirill_V_Intel</dc:creator>
      <dc:date>2021-01-28T23:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using sparse matrix formats for Sparse Matrix Dense Vector Product</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1252347#M30804</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/143036"&gt;@Nikhil_T&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please confirm if your query is resolved?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Rahul&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 11:15:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1252347#M30804</guid>
      <dc:creator>RahulV_intel</dc:creator>
      <dc:date>2021-02-02T11:15:17Z</dc:date>
    </item>
    <item>
      <title>Re:Using sparse matrix formats for Sparse Matrix Dense Vector Product</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1252655#M30824</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks for the confirmation. Intel will no longer monitor this thread. Further discussions on this thread will be considered community only.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rahul&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 03 Feb 2021 06:20:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Using-sparse-matrix-formats-for-Sparse-Matrix-Dense-Vector/m-p/1252655#M30824</guid>
      <dc:creator>RahulV_intel</dc:creator>
      <dc:date>2021-02-03T06:20:07Z</dc:date>
    </item>
  </channel>
</rss>

