How does parallel computing toolbox works in nested loop?

조회 수: 2 (최근 30일)
mono
mono 2023년 5월 6일
댓글: Raymond Norris 2023년 5월 10일
Say pseudo code as following:
parfor ii = 1:2
firtgp(X_, y, 'UseParallel', true);
end
Now assume 8 workers available, how are these 8 workers assigned to the task above?

채택된 답변

Raymond Norris
Raymond Norris 2023년 5월 6일
MATLAB will run the inner parfor loop as a for-loop. Therefore, in your example, where you have a parallel pool of 8 workers, 2 will be used for the ii loop and the other 6 will stay idle. The parfor loop embedded within firtgp will run as a for-loop.
  댓글 수: 2
mono
mono 2023년 5월 6일
Thanks. Is there a simple way I can make the fitrgp go parallel using other 6 workers?
Raymond Norris
Raymond Norris 2023년 5월 10일
No. You have to either choose the parallel for-loop on the outside (ii = 1:2) or the inside (firtgp).

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Gaussian Process Regression에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by