What is happening when Matlab is starting a "parallel pool"? -


running parallel cpu processes in matlab starts command

parpool() 

according documentation, function:

[creates] special job on pool of workers, , [connects] matlab client parallel pool.

this function takes bit of time execute, on order of 30 seconds. in other multi-cpu paradigms openmp, parallel execution seems totally transparent -- i've never noticed behavior analogous matlab (granted i'm not experienced parallel programming).

so, happening between time parpool() called , when finishes executing? takes long?

parallel computing toolbox enables run matlab code in parallel using several different paradigms (e.g. jobs , tasks, parfor, spmd, parfeval, batch processing), , run either locally (parallelised across cores in local machine) or remotely (parallelised across machines in cluster - either 1 own, or 1 in cloud).

in of these cases, code run on matlab workers, copies of matlab without interactive desktop.

if you're intending run on remote cluster, it's these workers started , ready run code. if you're intending run locally, it's possible might have started workers, maybe haven't.

some of constructs above (e.g. jobs , tasks, batch processing) run thing asked for, , workers go being available other things (possibly different user).

but of constructs (e.g. parfor, spmd) require workers on intend run reserved period of time - partly because might lie idle time , don't want them taken on user, , partly because (unlike jobs , tasks, or batch processing) might need communicate each other. called creating worker pool.

when run parpool, you're telling matlab want reserve pool of workers yourself, because you're intending run construct requires worker pool. can specify input argument cluster profile, tell whether want run on remote cluster or locally.

if you're running on cluster, parpool send message cluster reserve of (already running) workers use.

if you're running locally, parpool ensure there enough workers running locally, , connect them pool you.

the thing takes 30 seconds part needs start workers, if they're not running. on windows, if watch task manager while running parpool, you'll see additional copies of matlab popping on 30 seconds workers start (they're not matlab itself, they're matlab workers - can distinguish them they'll using less memory no desktop).

to compare matlab doing openmp, note these matlab workers separate processes, whereas openmp creates multiple threads within existing process.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -