필터 지우기
필터 지우기

How to keep the parallel for loop running even when one of the job fails

조회 수: 3 (최근 30일)
Sam T
Sam T 2013년 11월 2일
댓글: Sam T 2013년 11월 3일
Question: I run multiple jobs (each job is independent of each other) in parallel mode. However, if one job fails, then entire parfor loop is shut down.
More information : To better explain it, here's an example from my code:
*parfor* caseNumber = 1:100
% _For every case number, perform the following task_
Step 1) Load input file for this case. Note: Each case has a separate file
Step 2) Do some post-processing on it
*end*
However, there are cases in which input is such that we can have some error when we do some post-processing. In short, the post-processing step (i.e. Step 2) fails. At this stage, the entire parfor loop is shut and the code terminates.
But, I want the loop to continue since there are multiple cases for which post processing needs to be carried out. What is the best way to do it
  댓글 수: 2
Edric Ellis
Edric Ellis 2013년 11월 2일
What do you mean by "fail"? MATLAB error, worker crash, ...? If it's just an error, can you use try/catch around step 2?
Sam T
Sam T 2013년 11월 3일
Good suggestion, Edric. It works.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by