Can this implementation of Matlabpool in parallel?

2 visualizaciones (últimos 30 días)
Zhida
Zhida el 28 de Ag. de 2014
Respondida: Raymond Norris el 28 de Ag. de 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?

Respuesta aceptada

Raymond Norris
Raymond Norris el 28 de Ag. de 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.

Más respuestas (0)

Categorías

Más información sobre Language Fundamentals en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by