Reputation: 21
I want to use some parallel features in Matlab. And execute following command.
matlabpool open local 12;
batch(funcname,1,{arg},'PathDependencies',p,'Matlabpool',1);
Then all processes keep silent for the rest of time... But without opening matlabpool. It would finish normally. Is there any conflicts between the use of matlabpool and batch?
Upvotes: 2
Views: 1268
Reputation: 11
if you want to batch and parfor at the same time, open one less worker with matlabpool than you otherwise would. so 11 in your case. if you batch first and then matlabpool, it will automatically do this, but not vice versa.
to see the queue:
c=parcluster
c.Jobs
interestingly, if you open up a second matlab instance, you can get another 12 workers. but strangely not with a third. makes sense though i guess as if you actually use them all it will thrash.
Upvotes: 1
Reputation: 25140
The matlabpool
command runs a parallel job on the local scheduler to give you workers on which to run the body of your parfor
loops and spmd
blocks. This means that while matlabpool
is open, the number of workers available to the local scheduler is reduced. Then, when you try to run a batch
job, it can only run when there are workers free.
You can find out how many running jobs you have on your local scheduler either using the "job monitor" from the "Parallel" desktop menu item (your matlabpool
session would show up there as a job in state running
with 12 tasks), or by executing the following piece of code:
s = findResource( 'scheduler', 'Type', 'local' );
[pending, queued, running, finished] = findJob(s);
running
Upvotes: 1