Info

This question is closed. Reopen it to edit or answer.

Parallel processing

1 view (last 30 days)
Renato
Renato on 20 Mar 2012
Closed: MATLAB Answer Bot on 20 Aug 2021
There is an article written by C. Moler: Why there isn’t a parallel matlab. Cleve’s corner , Mathworks Newsletter, 1995, which says:
"Distributed memory was the dominant model for parallel computers, and for linear algebra applications, scatter/gather of the matrix took too long to make parallel computation worthwhile."
This article is a little bit old, but I'm right now facing quite the same problem mentioned by Moler. I do not understand how can I use Matlab parallel tools in a loop like this:
for i = 1:Num_iter %(this "for" must be done in a sequence, it means can not be parallelized using "parfor")
line 1: A(:,:,:,1) = B1(:,:,:,1) + B1(:,:,:,2) + B1(:,:,:,3) + B1(:,:,:,4) + C1(:,:,:,5) + C1(:,:,:,6));
line XX: % many lines inside the loop are similar as shown above... and every operation which is done inside the loop can be made in parallel.
end
If I put this code inside a parallel enviromment, all variables will be transformed in composites and manipulation of the data can not be done, at least, in the way I was doing in a series program. If I use, for example, spmd for just some lines of the code (the lines that are more demanding), in order to continue processing and doing other operations it will be necessary to use a comand like "gather" to bring back the information again to the original format, and this will be done for every loop, which makes the code worst than it was in its linear version.
Can someone give me a tip about this? Thanks in advance. Renato
  1 Comment
Thomas
Thomas on 20 Mar 2012
Can you post your code?

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!