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

2 views (last 30 days)
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.)

Accepted Answer

OCDER
OCDER on 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

More Answers (0)

Categories

Find more on MATLAB Parallel Server in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!