Setting default priority for matlabpool processes

13 ビュー (過去 30 日間)
Matthew Cordaro
Matthew Cordaro 2013 年 10 月 11 日
回答済み: Matt Bigelow 2018 年 5 月 7 日
I ran my program, which has a resource heavy function call in a parfor loop, and I noticed my system started to hang frequently. I went into task manager and turned down the priority of every matlab process to alleviate the issue. I was wondering if there was a way to set the default process priority to a different (in my case lower) value. I would still like to do work while my code is running, since it will be going for at least a few hours, and if I need to run it again later, I don't want to have to set them one-by-one in taskman every time.

回答 (3 件)

Matt Bigelow
Matt Bigelow 2018 年 5 月 7 日
I know this thread is old, but putting the following in a poolStartup.m script (see poolStartup - the file can also be on the MATLAB path) might be a convenient way to solve this:
if ispc
[~,~] = system(['wmic process where processid=' ...
num2str(feature('getpid')) ' call setpriority "below normal"']);
end
Using the getpid feature instead of putting in a process name ensures just your workers get a priority change and not your user session and not anyone else's MATLAB sessions or workers (if you're on a machine with multiple users and you have permission to change their process priorities).

Edric Ellis
Edric Ellis 2013 年 10 月 11 日
編集済み: Edric Ellis 2013 年 10 月 11 日
I assume you're running on windows - you could try using this file exchange submission: http://www.mathworks.com/matlabcentral/fileexchange/1841 and call it within an SPMD block.
  1 件のコメント
Matthew Cordaro
Matthew Cordaro 2013 年 10 月 11 日
That would be useful if I felt like compiling every time. Maybe they should consider this for a future version. Thanks for the tip.

サインインしてコメントする。


JonasBGood
JonasBGood 2014 年 6 月 26 日
I stumbled upon this problem as well. For me (using win7) the system command wmic helps:
matlabpool open
cmd_str = 'wmic process where name="MATLAB.exe" CALL setpriority 64';
[~,~] = system(cmd_str);
This reduces the priority af ALL matlab instances on your local machine to 'low'. The number defines the priority:
idle: 64, below normal: 16384, normal: 32, above normal: 32768, high priority: 128, real time: 256

カテゴリ

Help Center および File ExchangeParallel Computing Fundamentals についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by