Using parfor to Solve System of Linear Equations
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am trying to solve a system of linear equations for N different cases. Let's say N=140. So at each iteration, there is a portion of my code, where I want to do X = A\b;.
However, I am aware to a beginner's level that A\b implements parallelization when the matrices are sufficiently large. Would adding this loop:
parfor i=1:140
... % set A and b and other book-keeping stuff
X = A\b;
end
make things slower? My A matrix is around 500,000 x 7000 and b is 500,000 x 1, so I am pretty sure that A\b already uses parallelization, but I want to see if there is anyway to improve the operating speed of this overall computation.
1 Commento
Edric Ellis
il 23 Set 2016
It is almost certain that using parfor will actually make this slower - assuming you have access only to the 'local' cluster type. That's because as you observe, A\b is already implicitly multithreaded by MATLAB. The workers run in single-computational-thread mode, so even disregarding data transfer overheads, they can't perform faster than the multi-threaded client. The data transfer overheads will simply serve to slow things down. (If you have access to a remote cluster, the situation is different because there you'll have the opportunity to use more computational resources).
Risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!