Improving parfor tasks distribution
Ältere Kommentare anzeigen
Hello,
I have the feeling that the way parfor distributes tasks over the workers may be suboptimal in some cases. Here is a dummy example to explain the problem I encountered: Let say I have 22 tasks to perform in parallel and 10 cores available. Now, for some external reasons (not related to Matlab in any way), I had to stop the code while only 8 tasks were completed. It gets a bit more tricky when I want to start things over.
listTask=[T1,..,..,T22];
parfor iTask=1:numel(listTask)
if listTaks(iTask) not performed yet
perform listTask(iTask)
end
end
So when I restart the program, Matlab naturally starts tasks T9 and T10... but not T11 to T18. It works on only two cores while 8 more are doing nothing. 80% of my computer ressources is idling. To be able to start Matlab over the 10 cores again, the only way I found is to directly edit the listTask variable such as
listTask=[T9,..,..,T22];
So in conclusion, if I restart the program from the 9th task, Matlab will take 3 batches (T9 to T10, then T11 to T20, and finally T20 to T22) to finish the job while 2 would be enough! Is there a way to force Matlab to use all cores available?
Thanks!
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Parallel for-Loops (parfor) finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!