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

2 次查看(过去 30 天)
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.)

采纳的回答

OCDER
OCDER 2017-9-8
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Parallel Server 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by