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

column-major format <-> row-major format in sparse solvers

julian_stoev
Beginner
375 Views
Hello,
I am looking into interfacing between Matlab and MKL for sparse matrices and expecially for OOC direct sparse solving of (large) linear systems with non-symmetric matrices. As far, as I can see, things are pretty straightforward, except for one big inconvinience: Matlab is using column-major format, while MKL DSS is using row-major format. I can easilly rewrite the matrix, but in my case this will require to have two data copies in the memory. It would be nice if I can avoid this. I was looking to find some nice hidden flag indicating that the solution is sought for the transposed matrix, but I can find none.
Any suggestions?

Thanks a lot!

--JS
0 Kudos
4 Replies
julian_stoev
Beginner
375 Views
I don't think using C conventions is sufficient in case of sparse matrices. The data order and structure in the memory is really different and Direct Sparse Solver (DSS) functions expect sparse data in row major. The description is in the reference manual appendix A.
0 Kudos
julian_stoev
Beginner
375 Views
I will not (do not want to) access the huge matrix myself, so A[i,j] formula is of no use. I need to use Out Of Core (OOC) Direct Sparce Solvers (DSS), as described in Reference manual 8. They expect the matrix to be ordered in row major form only. But in fact the matrix is ordered in column major form from Matlab. So it is like "transposed". I can reorder the matrix using logic similar to yours, but I will have to double my memory use and in general I will need some resources to do this. The matrix may be huge, close to the system memory, so this is not a good option.
0 Kudos
julian_stoev
Beginner
375 Views
I know I can use BLAS functions to solve system of linear equations. In fact I can use Matlab for the same purpose. Matlab functions are quite optimal for small and medium matrices.
The special reason why I want to use MKL is because I want to use the Direct Sparse Solver library, which is good for solving extremely large systems. Such systems may give LU decomposition larger than the memory available. So DSS is using disk memory to store LU decompositions. This is called Out Of Core (OOC) operation. You can find a description in the Reference manual part 8.
Unfortunately DSS does not have transpose flags, like the BLAS functions. Or at least I don't see them.
0 Kudos
Todd_R_Intel
Employee
375 Views
I don't see any options to make DSS interpret the matrix as the transpose, and it is true that only compressed sparse row is supported. So unless the Matlab functionality has the ability to transpose you may be stuck with two copies. I'll ask the solver developers if they have any suggestions or comments.

-Todd
0 Kudos
Reply