1
$\begingroup$

I am encountering a problem that my MATLAB code ran and an error occurs and shows that it is out of memory. My code is using finite element method to solve some complicated kind of integral equation and the number of elements can reach more than 100,000. I use the sparse to store the stiffness matrix and ran the code in parallel on our school cluster. I am not sure whether the data is too big or my code is not well programmed that caused the out-of-memory problem. I also have the c version of the code and same problem occured(the error showed to be segmentaion fault). For small data my code does not have anything wrong. Since it is a 2d FEM code, suppose the number of unknown in each coordinate is n(so that the total is n^2), then the bandwidth of the matrix is approximately less than 2*n. It is symmetric positive definite. When I use MATLAB, I just use \ to solve the linear system. For c version, I use the subroutine for banded matrix in CLAPACK. It is the big data problem and my code does not work, so is there anybody who would like to help me and tell me what I should do to fix it, no matter in c or MATLAB? And for c, is there any package available for solving linear system with big data? Thanks so much!

$\endgroup$
  • 1
    $\begingroup$ You say you have 100000 elements. Is the number of equations also around 100000? If so, this is not a particularly large system if I understand your description of the sparsity. That you got an out-of-memory error makes me think you are running on a 32-bit OS. If so, try to find a version of MATLAB running on a 64-bit OS. $\endgroup$ – Bill Greene Dec 8 '14 at 21:24
  • 2
    $\begingroup$ Even if the cluster is running a 64-bit version of Linux or Windows, if they're using a 32-bit version of Matlab you could see this too (would be strange for a campus cluster). $\endgroup$ – horchler Dec 9 '14 at 0:15
  • $\begingroup$ I created a 100000-equation system from a FEM discretization of the 2d Laplace equation. I can solve this in MATLAB in around a half second using backslash on a modest five-year-old 64-bit windows 7 computer. So the issue is not the MATLAB direct sparse solvers but rather the address-space limitations of a 32-bit operating system. $\endgroup$ – Bill Greene Dec 10 '14 at 1:53
  • $\begingroup$ Thanks for everybody's suggestions. I made a mistake when I was explaining the problem. The problem already occurs when I add each entry to the sparse matrix. And the problem I solved is an integral equation rather than PDE. The matrix is sparse but not that sparse. And I am a student, I do not have much money spent on some commercial software. $\endgroup$ – winterfly Dec 11 '14 at 19:30
3
$\begingroup$

While Bill and tbirdal's suggestions of looking at other sparse solvers are good, I suggest trying Matlab's own sparse iterative methods first, since you already have something working. From looking at matlab's documentation on the A\b operator, it's always going to use a direct decomposition method, which as Bill said, 100k unknowns might be too big for. Since A is symmetric positive definite, try the preconditioned conjugate gradient method -- x = pcg(A,b).

$\endgroup$
2
$\begingroup$

100k rows for FEM is big enough and likely sparse enough that you should probably try a sparse iterative solver package like PETSc or Trilinos.

$\endgroup$
0
$\begingroup$

Take a look at Intel MKL or ACML. Especially MKL provides efficient and parallel sparse solvers on CPU. Both direct and indirect ones are present. As a second alternative, also look at PARDISO solver here.

$\endgroup$
  • 1
    $\begingroup$ Past versions of MATLAB have linked to MKL for BLAS and LAPACK. To determine the BLAS and LAPACK libraries MATLAB is using, type version -blas or version -lapack at the MATLAB command prompt. $\endgroup$ – Geoff Oxberry Dec 10 '14 at 1:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.