Running trainNetwork() starts parallel pool in Matlab 2023b even when options.Ex​ecutionEnv​ironment = 'cpu'

7 ビュー (過去 30 日間)
It seems the behaviour of trainNetwork has changed. I have a for loop that performs a grid search of models' hyper-parameters. After updating to version 2023b, parallel pool is being started whenever trainNetwork is invoked. Is this a bug or trainNetwork behaviour changed?
  6 件のコメント
Artem Lensky
Artem Lensky 2023 年 9 月 22 日
In function
function executionSettings = setupExecutionEnvironment(options)
there is this if statement
% Validate PCT if needed. It is not needed only when the execution
% environment is set as CPU and dispatch in background is false
if isPoolNeeded || options.ExecutionEnvironment == "gpu"
nnet.internal.cnn.util.validatePCTIsInstalled(options.ExecutionEnvironment);
end
for some reason even when options.ExecutionEnvironment set to "cpu", isPoolNeeded is set to true, which leads to executing the pool even when there is no need for it.
Artem Lensky
Artem Lensky 2023 年 9 月 22 日
I think I identified the problem, option DispatchInBackground was set to True expcplicitly. Surprisingly, it didn't execute the pool in previous Matlab version.

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

採用された回答

Artem Lensky
Artem Lensky 2023 年 9 月 22 日
編集済み: Artem Lensky 2023 年 9 月 22 日
Whenever option DispatchInBackground set true, trainNetwork executes parallel pool.
If I am not mistaken this behaviour was different in 2023a, I already deleted it so can't verify, but it would be nice if someone at Mathworks would check wherther
function executionSettings = setupExecutionEnvironment( opts, X, precision, networkInfo )
contains these lines
% In DLT if the training datastore is set up for background prefetch,
% enable background prefetch
backgroundPrefetch = iUseBackgroundPrefetch(X) || opts.DispatchInBackground;
  4 件のコメント
Joss Knight
Joss Knight 2023 年 9 月 25 日
Experiment Manager can do an parameter sweep in whatever way you like, and the parameters can be anything you like, so rng seeds for instance.
Implementing a specific grid search algorithm (sweeping one parameter at a time) may require more manual intervention I'll admit. But you might still find it saves you time.
Artem Lensky
Artem Lensky 2023 年 9 月 26 日
Thanks for the reply. I might give it another go. I am surprised the grid search hasn't been implemented as an out of the box feature given that it is one of the basic parameter search approaches. Perhaps in 2024 version :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeParallel and Cloud についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by