Change parallel preferences from code or console in a live session
조회 수: 25 (최근 30일)
이전 댓글 표시
Hi,
Is there a way to change the AutoCreate and IdleTimeout preferences of the parallel computing toolbox in a live Matlab session from code/console (i.e. without using the GUI preferences panel or editing the parallel.settings file)?
Note that I am not talking about specific cluster preferences, which I know how to manipulate using Matlab code. I stumbled upon an answer by Yari which discusses undocumented features to change general Matlab preferences: http://www.mathworks.co.uk/matlabcentral/newsreader/view_thread/154608
Alas, the parallel computing toolbox settings are not stored in the matlab.prf file, which has a proprietary format, but in the parallel.settings file, which is in XML format. These are changed normally from the GUI preferences panel.
I'm interested in changing the following two settings:
AutoCreate
IdleTimeout
The first is whether to auto-start a parallel cluster when 'parfor' is executed, the second is after how long to shutdown an idle cluster (Inf = never).
There is the function pctconfig but that cannot change the above two settings. There is also the parallel object with plenty of properties and methods, including parallel.settings and parallel.internal and parallel.internal.settings but again I couldn't find it in there.
Any masters of undocumented features have any clues?
Regards, Alex.
댓글 수: 0
답변 (2개)
Josh Wells
2018년 12월 28일
You can turn off the auto create via the following command:
ps = parallel.Settings;
ps.Pool.AutoCreate = false;
댓글 수: 0
Elwin Chan
2014년 2월 14일
There is no documented way to change the parallel preferences programmatically. However, you may find Edric's advice on disabling the automatic creation of parpools useful.
When you create a pool manually, you can supply the IdleTimeout property:
% This will set the idle timeout to 2 hours
parpool('IdleTimeout', 120)
You can also change the IdleTimeout property of the pool whilst it is running:
p = parpool
p.IdleTimeout = 120
댓글 수: 2
Yu Xiang
2016년 4월 25일
Hi Alex,
Did you find the answer, i am also searching the method to turn off the AutoCreate with some codes in the matlab rather with the parallel preferences.
Kind Regards, Yu Xiang
참고 항목
카테고리
Help Center 및 File Exchange에서 Parallel Computing Fundamentals에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!