Reputation:
Is there a possible way to deny Matlab access to all cores? There are 8 on the machine at present, but I want to reduce Matlab's usage to 3 per user so that one user doesn't start a job on all 8, slowing down others in the process.
I don't have a distributed computing server license... just plain old parallel proc toolbox
Upvotes: 2
Views: 535
Reputation: 25140
There's no way to enforce a strict limit from within MATLAB, but you can set the "ClusterSize" property of the local scheduler. Unfortunately, this must be done per user. Other than that, you would need to use an OS function, but I'm not sure if such a thing exists.
Upvotes: 2
Reputation: 2404
When you say per user, are you implying that multiple users are able to submit to this machine at once? This would certainly complicate things by I have some example code that might reveal some commands you are not familiar with that will help you reach your goal.
This is some code I use to use as many cores as possible, up to 8.
ncores = feature('numCores'); nworkers = min(8,ncores);
Upvotes: 0
Reputation: 2379
You can voluntarily restrict the number of workers used for a job by setting the MaximumNumberOfWorkers
property of the job object before you submit it.
jobMgr = findResource(...appropriate parameters for your job manager here...);
job = createJob(jobMgr);
set(job, 'MaximumNumberOfWorkers', 3);
% create some tasks and add them to the job here
submit(job);
waitForState(job, 'finished');
results = getAllOutputArguments(job);
Upvotes: 2