简体   繁体   中英

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

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 *' .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM