Cholmod via Eigen fails when sparse matrix becomes too large (Int Overflow error)

706 views Asked by At

I am trying to solve Ax=b with Cholmod supernodal solver in Eigen libary c++ based project (I am calling cholmod via Eigen) , A is a sparse matrix with dimensions 5Mx5M and I have these errors in runtime:

CHOLMOD error: problem too large. file: C:\suitesparse\SuiteSparse\CHOLMOD\Include\../Supernodal/cholmod_super_symbolic.c line: 683
CHOLMOD error: argument missing. file: C:\suitesparse\SuiteSparse\CHOLMOD\Include\../Cholesky/cholmod_factorize.c line: 121

This is the part of cholmod source code in file cholmod_super_symbolic.c line: 683, the second error I think is due to the first.

if (ssize < 0 ||(find_xsize && xxsize > Int_max))
    {
        /* Int overflow, clear workspace and return.
               QR factorization will not use xxsize, so that error is ignored.
               For Cholesky factorization, however, memory of space xxsize
               will be allocated, so this is a failure.  Both QR and Cholesky
               fail if ssize overflows. */
        ERROR (CHOLMOD_TOO_LARGE, "problem too large") ;
        FREE_WORKSPACE ;
        return (FALSE) ;
    }

I think maybe it is because int index overflows but I do not know how to fix it ,I have tried smaller matrices and works perfect . Also I have tried to change the _StorageIndex from int to long int of sparse matrix A in Eigen definitions (Eigen::SparseMatrix<double,0,long int > SPaMtr), but I have this complile error: cannot convert argument 3 from 'const long *' to 'const int *'.

1

There are 1 answers

0
AAAACT On

I meet the same problem when I solve a 30Mx30M linear system. And I solve the problem based on your explanation. Firstly, you should check whether the memory is enough. Then, you can convert the type of the index storage like, SparseMatrix<double, ColMajor, long int> for each sparse matrix in you program.