How save memory for a solving a symmetric (or upper traingular) matrix?

212 views Asked by At

I need to solve system of linear algebraic equations A.X = B

The matrix A is double precision with about size of 33000x33000 and I will get an error when I try to allocate it:

Cannot allocate array - overflow on array size calculation.

Since I am using LAPACK dposv with the Intel MKL library, I was wondering if there is a way to somehow pass an smaller matrix to the library function? (because only half of the matrix arrays are needed to solve)

The dposv function only needs an upper or lower triangular matrix for A. Here is more details about dposv.

Update: Please notice that the A matrix is N x N and yet it takes lda: INTEGER as The leading dimension of a; lda ≥ max(1, n). So may be there is a way to parse A as an 1D array?

2

There are 2 answers

0
Saeid On BEST ANSWER

Thanks to mecej4

There are several options to pass a huge matrix using less memory:

0
innoSPG On

As the error says (Cannot allocate array - overflow on array size calculation) Your problem seems to be somewhere else: especially the limit of the integer type used to compute the array size internally. And I am afraid that you might not be able to solve that even if you add more memory. You will need to check the internals of the library that your are using for memory management (Possibly MKL, but I don't use MKL so I can not help) or choose another one.

Explanation, some functions use 4 bytes integer to compute the memory size when allocating. That gives you a limit of 2^32 or 4 Gbytes of memory that you can allocate wich is way lower than your 8 Gbytes array. In that I am assuming unsigned integer; with signed integer, that limit is 2 Gbytes.

Hints if you have limited memory:

If you do not have enough memory (about 4 Gbytes for the matrix alone since it is triangular) and you do not know the structure of the matrix, then forget about special solvers and solve your problem yourself. Solving a system with an upper triangular matrix is a backward substitution. Starting with the last row of the solution, you need only one row of the matrix to compute each component of the solution.

Find a way to load your matrix row by row starting with the last row.