Can this implementation of Matlabpool in parallel?

2 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

Raymond Norris
Raymond Norris il 28 Ago 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.

Più risposte (0)

Categorie

Scopri di più su Language Fundamentals in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by