필터 지우기
필터 지우기

linear least squares/mldivide for large matrices in parallel?

조회 수: 2 (최근 30일)
Arvind
Arvind 2015년 4월 8일
댓글: Sean de Wolski 2016년 7월 27일
I have a really large system to solve using linear least squares. The A matrix can have 2-3 million rows and 2000-3000 columns. The B matrix has same row size but with a single column.
I have access to a supercomputer, and I want to run the x = A\B (or) mldivide(A,B) command in parallel, since I can easily run out of RAM even on workstations with lots of memory.
Any ideas? I am able to run EIG and SVD without any issues in parallel, since I assume it is automatically parallelized by MATLAB. What about linear least squares? Suggestions outside of MATLAB are also welcome. Thanks.

채택된 답변

Edric Ellis
Edric Ellis 2015년 4월 8일
편집: Edric Ellis 2015년 4월 8일
If you have access to a cluster of machines, you could use distributed arrays to solve the large system in parallel using the multiple memories. You'll need MATLAB Distributed Computing Server worker licenses on the cluster, and Parallel Computing Toolbox on the client machine. Something like this:
parpool();
A = distributed.rand(20000,2000);
b = sum(A, 2);
x = A\b;
  댓글 수: 3
David
David 2016년 7월 27일
Okay so how do I then load up my distributed matrix? It seems that distributed arrays don't support non scalar right hand assignment... do I really need to loop through the entire 200,000 x 20,000 array in my case one by one? Won't this be really slow compared with the vectorized matrix manipulations I was using before?
I tried stuffing the matrix and then distributing it, but its over my single thread RAM limit at this point.
Sean de Wolski
Sean de Wolski 2016년 7월 27일
David, please ask this in a new question - the answer will end up being to use codistributed arrays inside of spmd.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Mahdiyar
Mahdiyar 2015년 4월 8일
Hi Arvind
Parallel computing helps you to use more amount of CPU to run your simulation in a shorter time. As well as I know, when you have memory problem, it does not help you.
What I can suggest you is that you can implement the "x=A\B" by your own code.
I mean that write the m-file to calculate this x = A\B. The only difference is that you have to save your data and delete another one when you do not need it to avoid Memory problem.
For example, to calculate the A\B, you need to calculate A^(-1). Thus, first, JUST load matrix A and calculate A^(-1) and then save that matrix as a matrix and delete matrix A (be cause you do not need it anymore).
I hope it helps you.
Regards,

카테고리

Help CenterFile Exchange에서 Parallel Computing Fundamentals에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by