在早期版本的Matlab(例如2013A)中,我将使用matlabpool
函数设置本地并行池。例如:
matlabpool('size') %To determine if a pool was already open
和
matlabpool(12) %To create a local pool of 12 workers
在更新版本的Matlab(R2015A)中,此命令已替换为parpool
。
答案 0 :(得分:1)
在R2014A(8.3)中引入了parpool
,在R2015A版本(8.5)中删除了matlabpool
。请参阅此处的2014A和2015A的并行工具箱说明:
http://www.mathworks.com/help/distcomp/release-notes.html
等效命令如下所示:
numWorkers = 12;
if verLessThan('matlab','8.3') %Pre-2014A code
if matlabpool('size') == 0; %Skip setup if a pool is already open
matlabpool(numWorkers);
end
else %2015A or later code
if isempty(gcp('nocreate')) %Skip setup if a pool is already open
parpool('local',numWorkers);
end
end