Change parallel preferences from code or console in a live session
16 views (last 30 days)
Show older comments
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 Comments
Answers (2)
Josh Wells
on 28 Dec 2018
You can turn off the auto create via the following command:
ps = parallel.Settings;
ps.Pool.AutoCreate = false;
0 Comments
Elwin Chan
on 14 Feb 2014
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 Comments
Yu Xiang
on 25 Apr 2016
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
See Also
Categories
Find more on Parallel Computing Fundamentals in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!