我正在使用fminsearch将模型拟合到几个数据集,我正在尝试并行执行它们.我的代码运行到parfor循环的开始,但parfor循环似乎需要永远开始! (parfor中的第一行未执行).没有错误,matlab只是“忙”.
我正在运行4核心的本地集群,从matlabpool 4开始,看起来很好.我在Ubuntu 14.04.3上运行Matlab R2014b 64bit,8核i7-3770K @ 3.50GHz,24GiB RAM(当然大部分未使用).
编辑
这是重现问题的代码!
文件matlab_parfor_test_2
function f=matlab_parfor_test_2
f={};
for i=1:400
a=@(p)i*p; % make some functions depending on i
b=@(p)a(p)+0; % a function depending on this
f=[f { @(p)b(p) }]; % create a list of i functions using this
end
文件matlab_parfor_test_1
function matlab_parfor_test_1
f=matlab_parfor_test_2(); % create the functions
f=f(1:2); % discard all but two functions
for i=1:2 % for each function ('A')
parfor j=1 % dummy parfor
tmp=f{i}; % just read a function fro