Parfor loop worker utilization problems

2 views (last 30 days)
Mordechai Rorvig
Mordechai Rorvig on 11 Oct 2011
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?

Answers (1)

Edric Ellis
Edric Ellis on 12 Oct 2011
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.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!