All parallel jobs become terminated if error occurs only in one of them

2 vues (au cours des 30 derniers jours)
Ben
Ben le 8 Sep 2017
Commenté : Ben le 8 Sep 2017
I use “parfor” to run a function for different input values in parallel on 24 cores. Some input values may be out of the acceptable range for the function and MATLAB generates an error message and terminates the job.
The problem is that all other jobs are also terminated although their input values are OK. How can I prevent this behavior of MATLAB?
(I cannot predict in advance what values are problematic since the function is quite complicated and calls many other functions while it is running.)

Réponse acceptée

OCDER
OCDER le 8 Sep 2017
Try placing a try-catch statement around where the error occurs. Note that try-catch can slow down performance, but I guess it's better than stopping all jobs.
parfor j = 1:NumberOfJobs
try
%Do the unpredictable function here
catch
end
end

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Parallel Server dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by