开发者

Restrict Matlab's parallel toolbox from using all cores

I开发者_开发技巧s 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


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.


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);


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);

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜