Parfor iterations and number of cores

조회 수: 7 (최근 30일)
Jaya
Jaya 2021년 11월 8일
댓글: Jaya 2021년 11월 8일
I am using parfor for the first time. I run a piece of code 'multiple' times and get an output y each time. Finally, I take average of all such y to get the avg_y. So, I decided to use parfor for the 'multiple' times.
My laptop is quad core and my question is that can't I run the parfor more than 4 times? As I want to run the parfor loop code 10 times and then average the y values....

채택된 답변

Matt J
Matt J 2021년 11월 8일
편집: Matt J 2021년 11월 8일
The number of loop iterations isn't limited by the number of cores you have. However, if you have 4 cores, the loop iterations cannot be split into more than 4 parallel groups. So, for example, if you have 40 loop iterations, each core must do 10 of them.
  댓글 수: 3
Matt J
Matt J 2021년 11월 8일
Yes.
Jaya
Jaya 2021년 11월 8일
Thanks. I did that later. Actually I asked another question related to this but the reverse case. Can you please take a look at that also? Link is https://www.mathworks.com/matlabcentral/answers/1581179-specifying-more-cores-than-needed-for-parfor-any-speedup

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

추가 답변 (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