How does parallel computing toolbox works in nested loop?
5 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
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 个评论
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 Center 和 File Exchange 中查找有关 Parallel for-Loops (parfor) 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!