How do MATLAB workers/PC cores divide the work in a parallelized optimization inside a parfor loop?
이전 댓글 표시
For example:
parfor i = 1:20
options = optimoptions('ga','UseParallel',true,'UseVectorized',false);
x = gamultiobj(ObjectiveFunction,[],options);
end
Let's say there are 10 workers, and we are running the optimization algorithm with parallelization within a parallelized parfor loop.
Although my sample is not large, I have noticed that this is faster than using a simple for loop.
According to MATLAB docs, a parfor inside a parfor does not work. Yet this combination (which in the end is a parfor inside a parfor, I guess) does work.
Thus, my questions are:
- How do workers divide the work? I notice that the first 10 loop cases are started at the same time, but do the workers then stop their loop iteration and help out whichever started the gamultiobj first?
- Assuming "n" workers, do the parfor and for approaches deliver the same performance when num of cases >> n?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Parallel Computing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!