Can this implementation of Matlabpool in parallel?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Zhida
am 28 Aug. 2014
Beantwortet: Raymond Norris
am 28 Aug. 2014
Im using the Matpower - Matlab toolbox in parallel computing and building the computer cluster to simulate the programme which is shown below:
matlabpool open job1 5 % matlabpool means computer cluster
spmd %the statement from the Parallel computing toolbox
% Run all the statements in parallel
% first part of code
if labindex==1
runopf('casea');
end
% second part of code
if labindex==2
runopf('caseb');
end
end
matlabpool close;
When the labindex is 1 the first part of code in this program is running in "computer1" in the cluster, and so forth when the labindex is 2, then the second part of code in the program is "running in computer2". My question is the main code shown above running in sequence or in parallel?
By which I mean, does the second part code has to wait to be executed until the first part of code is executed or two parts of codes can be executed parallel at the two different computers in the cluster?
0 Kommentare
Akzeptierte Antwort
Raymond Norris
am 28 Aug. 2014
The code will run in parallel. Keep in mind, one path may run quicker than the other paths, so you may nee to create a "barrier", in order to sync the code paths. Take a look at
help labBarrier
No code will run past the spmd block until all labs have completed the block.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Language Fundamentals 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!