Error in parfor loop: Unexpected failure to indicate all intervals added
7 次查看(过去 30 天)
显示 更早的评论
I have a parfor loop code which following structure:
% set defults value, array, load required data and save them to the the memory!
parfor i = 1 : h
n = 1;
array_1 = [];
array_2 = {};
K_repeats = myDefults_1[i];
...
...
% I set all temporary variables here
for ii = 1 : hh
% I get some A values from array
for iii = 1 hhh
% I get some B values from some objects
...
....
for r = 1 : K_repeats
Z = getFromArray(W);
is_successful = false;
while ~is_successful
try
calculateSomeThing(A,B,..,Z)
is_successful = true;
catch ME
disp(ME.message)
end
end
var_1(n,1) = AA;
var_2(n,1) = BB;
...
var_k(n,1) = KK;
n = n + 1;
end
end
end
for j = 1 : length(Z)
% create a table based on the results
% and save it as a csv file in a directory!
T = table(var_1,var_2,..,var_k)
saveTableAsCSV(T)
end
end
I noticed that I needed the MATLAB version after 2017b to save the data in the parloop. So, now, I am using MATLAB 2019b. I also check the code on my PC; I do not have sufficient RAM to do it in parallel, and it takes a long time to be done, so, on a limited number of the default values, I tested the code, and it was fine without error when I ran it via a simple "for" loop. But I always get an error when I run it from a server using "parfor". Although I put all the temporary variables at the beginning of the parloop, I have no warning. Still, I receive the following error, and the code will be terminated!
Unexpected failure to indicate all intervals added.
I can't figure out what that error is about! I don't even know which line I'm getting this error and what I should do about it!
Any thought or suggestion?
2 个评论
Edric Ellis
2020-12-9
I think this problem is caused by a bug that should be fixed in the latest release, R2020b. This unhelpful message can show up under certain circumstances, but I thought that they were always related to cases where the loop would fail anyway. Can I ask: are you using the 'local' cluster type, or a remote cluster? (If you're using a remote cluster, it might work to ensure you've attached all the necessary files to the parallel pool prior to running your parfor loop).
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!