Parfor loop worker utilization problems

I am running Matlab R2011a on OpenSUSE Linux. When I'm running parfor loops, I've been looking at "top" to monitor processor usage. I initialize the largest possible matlabpool (size 8), and one would expect to see 8 processors cranking away in top. However, some jobs are running on 8 for a little bit, then some processors drop off one by one, and then finally MATLAB will only be running on say, 1 processor! It's as though MATLAB isn't redistributing the workload between available workers if other workers finish their assignments earlier than expected. Or is this some bug with my machine or something else? What's going on here?

Risposte (1)

How many iterations are your PARFOR loops running over? If the number is small, then the work may end up not being distributed completely evenly. For example
matlabpool 8
parfor ii = 1:9
pause(2);
end
will run in around 4 seconds because of that last iteration. PARFOR attempts to distribute work by sending out a relatively large number of iterates to each work in the first instance, and then a decreasing number as the loop is nearly complete.
One other factor can be if your loop iterations take very different amounts of time to complete.

Categorie

Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange

Richiesto:

il 11 Ott 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by