Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
7234 Discussions

Problem converting sparse matrix format in MKL using mkl_dcsrcoo

sagarmatha
Beginner
2,496 Views

Hi,

Can the entries of coordinate(ia(nnz),ja(nnz),a(nnz)) formated input sparse matrix be in "ANY" order when connverting it into CSR format using mkl_dcsrcoo in Intel MKL(-in Fortran) or should the order be like(increasing in column or row). I get a wrong converted matrix in CSR format when the INPUT was a random ordered Coordinate sparse matrix.
Following is the code added to the example code in which I changed the order of coordinate formated input sparse matrix and output. The output CSR, i get different than the actual.
Does anyone knows why the converting is not correct? The output i get are:
AI= 1 3 5 7 9
AJ = 1 2 1 2 4 3 4 3
Acsr = 5.0 8.0 9.0 2.0 6.0 3.0 4.0 1.0
the actual ones are
AI_standard 1 3 5 7 9
AJ_standard 1 2 1 2 3 4 3 4
Acsr_standard5.0 8.09.0 2.0 3.0 6.0 1.04.0
thanks a lot
sagarm

Win xp sp3 32-bit

Intel core 2 2 ghz, 2 gb ram

Microsoft Visual Studio 2008

Version 9.0.30729.1 SP

Intel Visual Fortran Compiler Integration Package ID: w_cprof_p_11.1.035

Intel Visual Fortran Compiler Integration for Microsoft Visual Studio* 2008, 11.1.3462.200

[bash]
!C--------------------------------------------------------------------------- !C TASK 4 Obtain sparse row format from sparse coordinate format !C--------------------------------------------------------------------------- job(1)=1 job(6)=3 ! !----------------------------------------! Acsr=.0; AJ=0;AI=0 ! set to zero. !Acoo in different order. ir(1)=1; jc(1)= 1; Acoo(1)=5.0; ir(2)=4; jc(2)= 4; Acoo(2)=4.0; ir(3)=1; jc(3)= 2; Acoo(3)=8.0; ir(4)=4; jc(4)= 3; Acoo(4)=1.0; ir(5)=2; jc(5)= 1; Acoo(5)=9.0; ir(6)=3; jc(6)= 4; Acoo(6)=6.0; ir(7)=2; jc(7)= 2; Acoo(7)=2.0; ir(8)=3; jc(8)= 3; Acoo(8)=3.0; !----------------------------------------! call mkl_dcsrcoo (job,n,Acsr,AJ,AI,nnz,Acoo,ir,jc,info)[/bash]
0 Kudos
10 Replies
mecej4
Honored Contributor III
2,496 Views
You are asking for a conversion to the 3-array CSR format. In that format, elements in row i must come before elements in row i+1; however, within a single row elements may be given in any order. Thus, the results you got are equivalent to the "standard one" with a different column order. In the COO format, the triplets can be given in any order. In the CSR format, as I just stated, there is a stipulation that rows appear in order. Column indices, however, need not be sorted.
0 Kudos
sagarmatha
Beginner
2,496 Views
Thanks mecej4,
But the problem still exist. I was converting my COO matrix to the 3-array CSR format, simply to use it as input in PARDISO solver and I first started with the given example file as I mentioned in the question.
PARDISO returned me the following error, when I wanted to solve the converted(using mkl_dcsrcoo) CSR matrix from the COO formated(example 4*4 sparse )matrix with 1 rhs( 13, 11, 9, 5) so that solution is (1 1 1 1):

*** Error in PARDISO (incorrect input matrix ) error_num= 24
*** Input check: j=7, ja(j)=4, ja(j+1)=3 are incompatible
Reordering completed ...
The following ERROR was detected: -1

Does this mean, PARDISO requires, in each row, the column indices of the entries to be in increasing order. Am I understanding it correctly ?

thanks
sagarm
0 Kudos
mecej4
Honored Contributor III
2,496 Views
Pardiso has an additional requirement. The Pardiso manual states: "The algorithms in PARDISO require JA to be increasingly ordered per row...". That would make the output of mkl_dcsrcoo possibly unsuitable for passing to Pardiso.

Let us wait for an Intel representative to address this discrepancy.
0 Kudos
sagarmatha
Beginner
2,496 Views
I see.
thanks
sagarm
0 Kudos
sagarmatha
Beginner
2,496 Views
any intel representative please !!
0 Kudos
Konstantin_A_Intel
2,496 Views
Hello,
In fact,mkl_?csrcoo routine in MKL 10.2 and earlier versions didn't sorted column indices withing a row. So, in order to use CSR arrays from the converter in PARDISO you'd need to sort each interval of ja array for each row i: ja(ia(i):ia(i+1)-1)
However, MKL 10.3.Beta supports this feature. If you want, you may download it and follow the documentation:
if job(1)=2, the matrix in the coordinate format isconverted to the CSR format, and the column indices in CSR
representation are sorted in the increasing order within eachrow.
Regards,
Konstantin
0 Kudos
sagarmatha
Beginner
2,496 Views
thanks a lot for the suggestion. I'll try 10.3.
sagarm
0 Kudos
Gennady_F_Intel
Moderator
2,496 Views
please try to use this link to get 10.3 beta faster..
0 Kudos
sagarmatha
Beginner
2,496 Views
thanks Gennady
0 Kudos
Nicky_Sandhu
Beginner
2,496 Views
I am using Intel MKL 10.3.11 and its still a problem. Any ideas when this fix will make it into the release?
0 Kudos
Reply