Segmentation error during parfor loop (remote linux server)
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (2)
Daniel Duarte
il 6 Lug 2022
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 Commenti
Edric Ellis
il 8 Lug 2022
The crash dump suggests the workers are crashing inside ipqpdense. This problem should be fixed if you upgrade to R2020a or later.
0 Commenti
Vedere anche
Categorie
Scopri di più su Startup and Shutdown in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!