0
林使用Matpower - matlab工具箱并行计算和建立计算机集群来模拟其在下面示出的方案:这可以并行实现Matlabpool吗?
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;
当labindex是1的代码在此程序中的第一部分是在运行“计算机1“,当labindex为2时,则程序中的第二部分代码”正在计算机2中运行“。我的问题是上面显示的主代码依次或并行运行?
我的意思是,第二部分代码是否必须等待执行,直到执行代码的第一部分,或者可以在集群中的两台不同计算机上并行执行两部分代码?
工作者#2的这个延迟是否直到工人#1执行或仅仅是由于if语句? – 2014-08-28 02:06:12
是的,仅仅是因为if语句。 “并行计算”意味着工作人员在其他工作人员执行自己的代码的同时执行自己的代码。 – anandr 2014-08-28 02:53:32