I have research work where I need to compute a matrix inversion. The matrix has a size $31300\times31300$. I am using a universal java matrix package to invert this matrix. But as the dimension of the matrix is huge, it throws error memory out of scope. Cpu cannot allocate huge memory space.

So, to find out a solution I came to know about GPU(Graphical Processing Unit). But in every search about GPU, it is described that GPU is used to speed up a process.

So my doubt is that the computation that failed to compute by CPU, is it possible to be computed by GPU? Or GPU only used for those processes which take of time to compute in CPU, they can compute in GPU for speedup.


Unfortunately, GPUs will be of no help to you in this particular situation. Your problem is in the memory limitation; thus, you just do not have enough RAM resources to allocate/factorize/solve the system. GPUs usually have a much smaller amount of memory available on them, so they are not used to help with memory-limited problems.

Suggestions to try:

  1. It looks like you are trying to allocate $31300\times 31300$ matrix which implies you are solving a dense linear algebra problem. Make sure that the matrix you work with is not sparse (in this case, there are efficient sparse linear algebra solvers).
  2. There are out-of-core linear algebra solvers (which are, of course, significantly slower) which will allow you to solve larger problems within your RAM limitations by using your hard drive to store intermediate/final results.
  3. Use efficient LAPACK linear algebra, say Intel MKL.
  4. Try using a machine with a larger amount of memory (Amazon EC2 has cheap options available).
  • $\begingroup$ Thank you for your suggestion.My system configuration is: Ubuntu Release 16.04.5 LTS (Xenial Xerus) 64 bit. Kernel Linux 4.7.0 intel.r5.0 x86_64. MATE 1.12.1. Hardware Memory: 62.8GiB ,Processor: Intel Xeon(R)CPU E5-2670 v3 @2.30GHZ*48 System Status Available disk space: 5.1 TiB. I am using universal java matrix package to invert matrix and of course this matrix is a sparse matrix. After such a good configuration why the error memory out of bound showed.Please help me to give your suggestion. $\endgroup$ – Saswati Aug 31 '18 at 1:22
  • $\begingroup$ Just to store a dense 31300x31300 matrix of 64 bit doubles you will need around 60 GB. Are you sure you are storing the data as a sparse matrix? $\endgroup$ – Biswajit Banerjee Aug 31 '18 at 3:03
  • $\begingroup$ Yes I am sure that the matrix is a sparse matrix. I provide the system information that I used for computation purpose. Is 62gb is not enough to invert a sparse matrix? $\endgroup$ – Saswati Aug 31 '18 at 3:37
  • 1
    $\begingroup$ @Saswati Can you please explain what you mean by "inverting the matrix"? Are you just trying to solve a linear system $Ax=b$, or are you trying to compute a matrix factorization? As Anton mentioned, different approaches will lead to vastly different memory consumption. $\endgroup$ – cthl Aug 31 '18 at 5:29
  • 3
    $\begingroup$ So you are really only solving a linear system $\Omega \mu = \xi$. There are much more efficient techniques to solve linear systems than to compute the inverse of the matrix. $\endgroup$ – Wolfgang Bangerth Aug 31 '18 at 21:15

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .