Segmentation error during parfor loop (remote linux server)
7 次查看(过去 30 天)
显示 更早的评论
I am using a Linux server with 64 GB RAM and 16 CPUs to run multiple repetitions of a MATLAB function in parallel (by using the "parfor" command); let's define this function as [Output]=myfunc(a,b,c). In particular, for "n" iterations, I have to calculate the Output of a "population" of 16 "agents", in which each agent has slightly different values of a,b,c.
Specific agents (i.e values of a,b,c) cause a worker to crash due to segmentation violation (I attach the related crash dump file).
If I run only one of these agents in a parallel pool with just one worker I get the same outcome, whereas if I don't use "parfor" the code works without any problem. Moreover, if I perform the same simulation on my Windows PC I get no error even when using the parallel pool.
0 个评论
回答(2 个)
Daniel Duarte
2022-7-6
Hello Stefano,
The main requirement of parfor is to allow Matlab to work with sections of the problem, in a vectorised fashion. Given a population of agents pop(i), we need to vectorise the output as output(i). This way we allow the parfor loop to work in parallel on each section of the problem.
A possible parfor application would be:
% initialize inputs and output
Output=zeros(16,1);
for i=1:16
pop(i).a = rand;
pop(i).b = rand;
pop(i).c = rand;
end
% implement parfor
parfor i=1:16
Output(i)=sumABC(pop(i).a,pop(i).b,pop(i).c)
end
Output
function sum = sumABC(A,B,C)
sum = A+B+C;
end
See more details at:
0 个评论
Edric Ellis
2022-7-8
The crash dump suggests the workers are crashing inside ipqpdense. This problem should be fixed if you upgrade to R2020a or later.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!