- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am a newbie in using the Intel MKL. As I am dealing with matrices and vectors of which contents are not known beforehand.
- No matter what level of BLAS I use, I need to determine the number nonzero elements nz and their corresponding indices *indx. I would like to know if there is a fast method provided by the Intel MKL to determine the inputs nz and the indices pointed by *indx for the gthr function or do I have to program this by myself? What about sparse matrices?
- After having determined the necessary indices and the number of non zero elements, I want to use all BLAS from one to three. Is that possible and what do I have to consider when mixing BLAS 1 with BLAS 2,3 ?
Thx in advance,
Cem
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am a newbie in using the Intel MKL. As I am dealing with matrices and vectors of which contents are not known beforehand.
- No matter what level of BLAS I use, I need to determine the number nonzero elements nz and their corresponding indices *indx. I would like to know if there is a fast method provided by the Intel MKL to determine the inputs nz and the indices pointed by *indx for the gthr function or do I have to program this by myself? What about sparse matrices?
- After having determined the necessary indices and the number of non zero elements, I want to use all BLAS from one to three. Is that possible and what do I have to consider when mixing BLAS 1 with BLAS 2,3 ?
Thx in advance,
Cem
Dear Cem,
Let's start from the second question. Yes you can useall sparse BLAS from one to three if you use the compressed sparse row, compressed sparse column or coordinate format for representation of your matrices. And yes, mixing BLAS 1 and BLAS 2,3 is also possible. Let me give an example.Let(values, columns, rowIndex) be the representation of matrix A in the compressed sparse row format (see MKL Reference Manual, Appendix A).Sparsematrix-vector multiply A*x =y can be done by calling
call mkl_dcsrgemv('n', m, values, rowIndex, columns, x, y)
And let's assume we want to compute the dot product of the i-th row of the samematrix A and another vector z. It can be done by calling ddoti from Sparse Level 1
nz=rowIndex(i+1) -rowIndex(i) ! the number of nonzeros in the i-th row
w=ddoti ( nz, val(rowIndex(i)), column(rowIndex(i)),z)
As concerns the first question, nz and array indx should be defined by the user. Array indx can be a part of sparserepresentation of a matrix or can be a separate array. These parameters mustcome from application and must be defined by the user.
MKL provides a set of converters and for example you can use them if you needto convert a dense rectangularmatrix (it might be a vector) toone sparse storage supported by MKL.
All the best
Sergey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
MKL provides a set of converters and for example you can use them if you needto convert a dense rectangularmatrix (it might be a vector) toone sparse storage supported by MKL.
Thnx Sergey,
you said sth about set of converters. In which section of the manual can I find the description of such converter? Are these functions I can call from the library ? Can you name them ?
my first concern is to efficiently converting rows of my matrix A into another storage format, so that within each iteration step i the corresponding row A(i,:) are stored in a specified compression scheme.
thnx again,
Cem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thnx Sergey,
you said sth about set of converters. In which section of the manual can I find the description of such converter? Are these functions I can call from the library ? Can you name them ?
my first concern is to efficiently converting rows of my matrix A into another storage format, so that within each iteration step i the corresponding row A(i,:) are stored in a specified compression scheme.
thnx again,
Cem
Dear Cem
Please see page 223, MKL Reference Manual
Auxiliary routines
Matrix converters
mkl_ddnscsr
Convertsadense matrix in the CSR format (3-array variation).
mkl_dcsrcoo
Converts a sparse matrix in the CSR format (3-array variation) to the coordinate format and vice versa.
mkl_dcsrbsr
Converts a sparse matrix in the CSR format to the BSR format (3-array variations) and vice versa.
mkl_dcsrcsc
Converts a sparse matrix in the CSR format to the CSC and vice versa (3-array variations).
mkl_dcsrdia
Converts a sparse matrix in the CSR format (3-array variation) to the diagonal format and vice versa.
mkl_dcsrsky
Converts a sparse matrix in the CSR format (3-array variation) to the sky line format and vice versa.
The documentation is buggy. Sorry for that.
The first three converters are available in MKL 10.1 and MKL 10.1 Update 1. The full list of the converters will be available in coming MKL 10.2 Beta.
All the best
Sergey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I get the following error went I am trying to execute my code. No error occurs when compiling the source code.
./dct: symbol lookup error: ./dct: undefined symbol: mkl_ddnscsr
this is how I compile my code :
gcc -c -I${MKLDIR}/include $FILE.c
gcc $FILE.o -L${MKLDIR}/lib/32 -lmkl_intel -lmkl_intel_thread -lmkl_core -liomp5 -lguide -lpthread -lm -o $FILE
this is my code
#include "mkl_spblas.h"
....
mkl_ddnscsr( job, &m, &n, adns, &m, acsr, ja, ia, &info );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hmm, that's strange .. all looks correct.
Could you try this linking line:
MKLINCL=/opt/intel/mkl/10.1.0.015/include
MKLPATH=/opt/intel/mkl/10.1.0.015/lib/32
-L${MKLPATH} ${MKLPATH}/libmkl_intel.a -Wl,--start-group ${MKLPATH}/libmkl_intel_thread.a ${MKLPATH}/libmkl_core.a -Wl,--end-group ${MKLPATH}/libiomp5.a -lpthread -lm -o test.out
--Gennady
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Cem
Please see page 223, MKL Reference Manual
Auxiliary routines
Matrix converters
mkl_ddnscsr
Convertsadense matrix in the CSR format (3-array variation).
mkl_dcsrcoo
Converts a sparse matrix in the CSR format (3-array variation) to the coordinate format and vice versa.
mkl_dcsrbsr
Converts a sparse matrix in the CSR format to the BSR format (3-array variations) and vice versa.
mkl_dcsrcsc
Converts a sparse matrix in the CSR format to the CSC and vice versa (3-array variations).
mkl_dcsrdia
Converts a sparse matrix in the CSR format (3-array variation) to the diagonal format and vice versa.
mkl_dcsrsky
Converts a sparse matrix in the CSR format (3-array variation) to the sky line format and vice versa.
The documentation is buggy. Sorry for that.
The first three converters are available in MKL 10.1 and MKL 10.1 Update 1. The full list of the converters will be available in coming MKL 10.2 Beta.
All the best
Sergey
Dear Sergey,
Is it possible that Intel also offers the corresponding subroutines for double complex sparse matrices? I think these routines are important for the calculations using sparse matrix. Now I've written some subroutines to perform the conversion because I cannot find them in MKL.
Best regards,
Gang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Gang, you are right. Currently, all routines convert a sparse matrix in the one format to another and vice versa, support double precision data types only.We would recommend you submit the issue against MKL to Premier support( https://premier.intel.com/ )
--Gennady

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page