Parfor starting a new parallel pool at every call?

6 ビュー (過去 30 日間)
adajaga
adajaga 2018 年 10 月 11 日
回答済み: adajaga 2018 年 10 月 11 日
Hi, I am running MATLAB on a cluster, and noticed my jobs suddenly becoming very slow. When I looked at the logs it is a lot of (Starting parallel pool (parpool) using the 'local' profile) spam. It seems that MATLAB is starting a new parallel pool every time I call a parfor loop.
When I run MATLAB on the front end I encounter the same problem, e.g.:
>> parfor i=1:2;disp(i);end
Starting parallel pool (parpool) using the 'local' profile ...
2
1
>> parfor i=1:2;disp(i);end
Starting parallel pool (parpool) using the 'local' profile ...
2
1
>> parfor i=1:2;disp(i);end
Starting parallel pool (parpool) using the 'local' profile ...
2
Any idea what could be happening? (running '9.4.0.902940 (R2018a) Update 4')

採用された回答

OCDER
OCDER 2018 年 10 月 11 日
Do this once in your MATLAB command line to set the default setting to :
ps = parallel.Settings;
ps.Pool.AutoCreate = false; %do not autocreate parpool when encountering a |parfor|
ps.Pool.IdleTimeout = Inf; %do not shutdown parpool after Inf idle time

その他の回答 (1 件)

adajaga
adajaga 2018 年 10 月 11 日
Thanks that did it!

カテゴリ

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