Parallel processing 这能并行实现Matlabpool吗?
我使用Matpower-Matlab工具箱进行并行计算,并构建计算机集群来模拟如下所示的程序:Parallel processing 这能并行实现Matlabpool吗?,parallel-processing,matlab,Parallel Processing,Matlab,我使用Matpower-Matlab工具箱进行并行计算,并构建计算机集群来模拟如下所示的程序: 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
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时,此程序中的第一部分代码在群集中的“computer1”中运行,以此类推,当labindex为2时,则程序中的第二部分代码在“computer2”中运行。我的问题是上面显示的主要代码是顺序运行还是并行运行
我的意思是,第二部分代码是否必须等待执行,直到第一部分代码被执行,或者两部分代码可以在集群中的两台不同计算机上并行执行?spmd和相应的
end
之间的代码被发送给所有工作人员(在您的情况下为5个)它们并行执行这些指令。然后,在代码中,您指示worker#1执行runopf('casea')代码>和工人#2runopf('caseb')代码>。三到五岁的工人实际上什么也不干
从技术上讲,工人2将执行runopf('caseb')代码>稍晚一点。之所以出现延迟,是因为worker#2还将检查第一个if
语句(但不会执行其中的代码)。是因为worker#2直到worker#1执行的延迟,还是因为if语句的延迟?是的,只是因为if
语句的延迟。“并行计算”是指当其他工作人员执行自己的代码时,工作人员同时执行自己的代码。