MATLAB Answers

Solution of large sparse matrix systems using GPU MLDIVIDE

조회 수: 6(최근 30일)
I have a sparse 1 million by 1 million matrix system that I wish to solve repeatedly in a loop, (I use MLDIVIDE or the ' \ '). My CPU takes about 250 s to solve this once and the RAM goes up to 40 GB during the process. This has made me doubt that, Is it possible to solve this system on a 4 GB GPU, using the GPU MLDIVIDE? Will solving it on a GPU make it faster? Or it does not make sense? I have read that GPU is good for highly parallel operations. I have GeForce GTX 1050 Ti 4 GB GPU. My CPU is i7-9700 with 3 GHz, 8 cores, and 64 GB RAM.

  댓글 수: 0

로그인 to comment.

채택된 답변

Joss Knight
Joss Knight 16 Jan 2020
The general advice is that Sparse MLDIVIDE may be convenient, but it is 'usually' slower than use of an iterative solver with an appropriate preconditioner: gmres, cgs, pcg, bicg, bicgstab, qmr, tfqmr, lsqr.

  댓글 수: 3

Yash Agrawal
Yash Agrawal 17 Jan 2020
Thanks for the advice, Joss. I see that the iterative solvers are faster than MLDIVIDE, I will need to work on that.
Although I would like to know if MLDIVIDE is feasible for solving such large (but sparse) matrix systems, exclusively on GPU. The implementation might be something I have to look up, but is it something experts routinely do?
Joss Knight
Joss Knight 17 Jan 2020
Yes, sparse matrix mldivide is supported on GPU, see here:
But it's often very slow. We want to improve it, but it is a general truism that sparse direct solves are less efficient than iterative solvers.
Yash Agrawal
Yash Agrawal 17 Jan 2020
That answers my question. Thank you for your help.
I will look up iterative solvers, to run them on the GPU.

로그인 to comment.

추가 답변(1개)

Edric Ellis
Edric Ellis 16 Jan 2020
A couple of suggestions:
  1. On the CPU, if you're repeatedly solving the same system, you might be able to benefit from the recently-introduced decomposition object.
  2. On the GPU, it's hard to say without knowing the exact details whether or not the GPU will be of benefit in this case, so perhaps it would be best to get a Parallel Computing Toolbox trial licence to enable you to experiment.

  댓글 수: 1

Yash Agrawal
Yash Agrawal 16 Jan 2020
Thanks for the reply Edric. Some clarifications.
  1. I am not solving the same system everytime, the system evolves (its an optimization problem).
  2. I am interested in solving the system once, not the loop part.
  3. I do have the license to parallel computing toolbox.
  4. One aspect of my question, does it make sense to solve the large sparse matrix system on GPU? I am worried about the memory overflow that happens during the process, 40GB >> 4GB.
I have tried doing it on the GPU once, but there was an error and MATLAB crashed. I believe it was because I am new to GPU programming and did not do it properly. I kept on getting error that said, " GPU MLDIVIDE only supports sparse square matrices and full column vectors." I made some changes and it went through but took indefinite amount of time (I did not wait for it to complete).

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.

Translated by