MATLAB Answers

parfor doesn't continue to run other jobs when only one worker is working

1 ビュー (過去 30 日間)
Zhangxi Feng
Zhangxi Feng 2020 年 5 月 23 日
回答済み: Edric Ellis 2020 年 5 月 26 日
I have a parfor loop that is supposed to run 7 jobs with 4 workers. Each job executes a .exe program in their individual folders. It successfully completed 5 of the jobs. The 7th job's exe is hanging due to whatever reason, but I also noticed the 6th job wasn't even started after a long time. Why wouldn't Matlab allocate the 6th job to a worker to start it in this case?
The code is simply:
parfor i = 1:size(rotFold,1)
[~,~] = system(['cd /d ',rotFold{i},' & EPSC.exe']);
end
Thanks!
Jesse

  0 件のコメント

サインインしてコメントする。

回答 (1 件)

Edric Ellis
Edric Ellis 2020 年 5 月 26 日
parfor sends loop iterations to workers in groups known as "subranges" for efficiency. Also, recent versions of Parallel Computing Toolbox "eagerly" send subranges to workers slightly ahead of when the workers need them. Both of these things taken together can mean that if a single iteration of your loop hangs in this way, then other iterations might never start executing.

  0 件のコメント

サインインしてコメントする。

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by