Parallel Programming inside a user-defined function
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Puiyin
am 1 Jan. 2014
Beantwortet: Walter Roberson
am 2 Jan. 2014
Hi all, I am actually quite new to the parallel computing in matlab. So I would like to ask a few questions about it.
Suppose I have written a function, which consists of a lot of parts: the first is a for loop from time zero up to time 1. The second part has a for loop from time zero to time 2. I have 5 parts in total.
Suppose I divide it into 5 cells. Is there a way to run the function to make the 5 cells go in parallel?
Or method 2: is it just write down a generalisation of each cell as a nested function and use parfor or spmd? What is the difference between parfor and spmd?
Thank you very much.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 2 Jan. 2014
No there is no way to make the 5 cells go in parallel. Use parfor or spmd.
I do not know the differences between the two in detail. spmd is suited for message-passing parallelization, in which the work being done by the parallel parts might not all be the same. parfor is suited for multiple iterations over a loop in which the same work is being done in each iteration.
As you are really doing 5 different kinds of work at the same time, spmd might be more suitable for you.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Parallel for-Loops (parfor) finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!