parfor chuncks: are loop iterations running in parallel WITHIN a chunck on local machine?
Show older comments
I know that parfor does load-balancing to break the loop iterations into chuncks which are then sent to the workers.
Demo example:
parpool;
% parpool.NumWorkers = 5
parfor i=1:100
%do something
end
Say, the 100 iterations are divided into 5 chuncks of size 20. Then, 1:20 are maybe sent to worker 1, 21:40 are sent to worker 2, etc.
I do not take about the order in which the iterations are worked off within a chunck. So if worker 1 executes in the order
[20,19,18,....2,1] or in the random order [15,18,2,7,...] does not matter,
but what matters is that there is only one index running at a time WITHIN a worker. So what is not allowed in my case is that worker 1 runs, e.g., indices 20 and 19 simultaneously.
Can I be sure that parpool / parfor respects this or is there uncertainty?
Accepted Answer
More Answers (0)
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!