Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

fortran mkl csr sparse matrix storage, integer size of row/column index vectors for very large arrays

may_ka
Beginner
849 Views

Hi there,

I ran into trouble with the single precision integer size (I think it is 32bit) of the row index vector of  mkl csr arrays. I create squared sparse arrays with +56,000,000 rows and columns and +3,000,000,000 elements. The column index vector is still ok because largest numbers are equal to the column dimension. However, the row index vector makes trouble with entries equal to the length of the column index vector which cannot be held by a single precision integer. I could use a larger integer kind number (double precision integer, 64 bit) but then I am in trouble with all mkl routines dealing with csr matrices (e.g. dcsrmm). That is because these routine have a fortran 77 interfaces and as outlined in the mkl manual, the expect index vectors of kind single precision. I can imagine that one could set the default integer to 64 bit when installing the mkl, but I am not sure whether that is possible. Any Ideas??

Thanks a lot

 

0 Kudos
8 Replies
may_ka
Beginner
849 Views

I found that "ilp64" is my friend.

Seems to be solved.

0 Kudos
Xuhao_C_
Beginner
849 Views

Hi,

I have the same problem. Basically the row indices are in a 64-bit array (A_idx_ptr) and the column indices are in a 32-bit array (A_nnz_idx). 

mkl_scsrmm (&transa, &M , &N, &K, &alpha , matdescra, A_nonzeros, A_nnz_idx, A_idx_ptr, A_idx_ptr+1, B, &N, &beta , C, &N);

How did you call the above function?
 

0 Kudos
may_ka
Beginner
849 Views

Hi,

you just have to link you application against the version of mkl where the default integer is 64 bit. Checkout the mkl link adviser to get the link line correct.

 

Cheers

0 Kudos
MariaZh
Employee
849 Views

Hi, 
Currently we do not support mixing of different integer types for column and row indices in Sparse BLAS.
If you need long integers, you will have to convert column indices and use ILP64 interface of MKL.

Best regards,
Maria

Xuhao C. wrote:

Hi,

I have the same problem. Basically the row indices are in a 64-bit array (A_idx_ptr) and the column indices are in a 32-bit array (A_nnz_idx). 

mkl_scsrmm (&transa, &M , &N, &K, &alpha , matdescra, A_nonzeros, A_nnz_idx, A_idx_ptr, A_idx_ptr+1, B, &N, &beta , C, &N);

How did you call the above function?
 

0 Kudos
Xuhao_C_
Beginner
849 Views

So you convert column indices into 64-bit before pass it to the function?

may.ka wrote:

Hi,

you just have to link you application against the version of mkl where the default integer is 64 bit. Checkout the mkl link adviser to get the link line correct.

 

Cheers

0 Kudos
Xuhao_C_
Beginner
849 Views

I see. So either both 32-bit or both 64-bit. Thanks.

Zhukova, Maria (Intel) wrote:

Hi, 
Currently we do not support mixing of different integer types for column and row indices in Sparse BLAS.
If you need long integers, you will have to convert column indices and use ILP64 interface of MKL.

Best regards,
Maria

Quote:

Xuhao C. wrote:

 

Hi,

I have the same problem. Basically the row indices are in a 64-bit array (A_idx_ptr) and the column indices are in a 32-bit array (A_nnz_idx). 

mkl_scsrmm (&transa, &M , &N, &K, &alpha , matdescra, A_nonzeros, A_nnz_idx, A_idx_ptr, A_idx_ptr+1, B, &N, &beta , C, &N);

How did you call the above function?
 

 

 

0 Kudos
Xuhao_C_
Beginner
849 Views

BTW, does csrmm support multi-threading? Say if I export MKL_NUM_THREADS=32 on a 32-core CPU,  will it get speedup compared to sequential setting?

Zhukova, Maria (Intel) wrote:

Hi, 
Currently we do not support mixing of different integer types for column and row indices in Sparse BLAS.
If you need long integers, you will have to convert column indices and use ILP64 interface of MKL.

Best regards,
Maria

Quote:

Xuhao C. wrote:

 

Hi,

I have the same problem. Basically the row indices are in a 64-bit array (A_idx_ptr) and the column indices are in a 32-bit array (A_nnz_idx). 

mkl_scsrmm (&transa, &M , &N, &K, &alpha , matdescra, A_nonzeros, A_nnz_idx, A_idx_ptr, A_idx_ptr+1, B, &N, &beta , C, &N);

How did you call the above function?
 

 

 

0 Kudos
Gennady_F_Intel
Moderator
849 Views

this routine should be threaded, but the performance of csrmm functionality significantly depends on matrix size, sparsity, and portrait. Please note, this routine is deprecated. You may try to call Inspector-Executed counterpart (mkl_sparse_s_mm) of this routine from the latest version of mkl.

0 Kudos
Reply