Skip to content

unclear error messages using sparse matrices, possible high memory use #95

@mulaga

Description

@mulaga

Hi everyone

I've been trying out the new sparse matrix capabilities in the new release. In some cases, when the sparse matrix construction fails, the error messages seem a bit unclear. In particular, I get the following error:

XDiag ERROR: Cannot allocate rowptr/col/data arrays for sparse matrix
Stacktrace (C++):
[1] csr_matrix_generate (xdiag/algebra/sparse/csr_matrix_generate.cpp:57)
[2] csr_matrix_generate (xdiag/algebra/sparse/csr_matrix_generate.cpp:73)
[3] csr_matrix (xdiag/algebra/sparse/csr_matrix.cpp:70)
[4] csr_matrixC (xdiag/algebra/sparse/csr_matrix.cpp:112)

which is generated by csr_matrix_generate.cpp, line 57, when resizing the containers for the rowpointers, columns, and data. I am using the csr_matrixC() constructor in a Hilbert space block of dimension 18,784,998 (which implies csr_matrixC_32() should also work) or even 7,056,798.

Looking at the memory usage, it seems very high during allocation, on the order of x3 of the final size. I am doing something like:

  auto block = Spinhalf(32, 12, "Gamma.C1.A"); 
  auto ham_csr = csr_matrixC(ham, block, block);

edit: on closer inspection, armadillo throws the following error:

Armadillo error: arma::memory::acquire(): requested size is too large

this is happening because the required size is estimated as

nnz: -1643425960

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions