How to programmatically determine the default number of workers set in parallel preferences

3 ビュー (過去 30 日間)
Afzal
Afzal 2023 年 7 月 11 日
コメント済み: Bruno Luong 2023 年 7 月 11 日
Is there a way to deterine the number of workers set by a user in their MATLAB preferences without starting a parallel pool. I want to know this, so I can use parsim with the minimum number of workers required to reduce memory usage, which would be the lower of the number of cases to run and the value set in the parallel preferences. I'm currently getting this by starting a parallel pool using the code below. Is there a way to get numWorkers without first having to start a parallel pool to save time.
p=gcp;
numWorkers = min([no_of_cases_to_run, p.NumWorkers])
delete(gcp('nocreate'))
parpool(numWorkers);
simOut = parsim(simIn);

回答 (1 件)

Bruno Luong
Bruno Luong 2023 年 7 月 11 日
編集済み: Bruno Luong 2023 年 7 月 11 日
Please see if this thread can help you
  2 件のコメント
Afzal
Afzal 2023 年 7 月 11 日
I don't think it tells me how to get the value set here.
Bruno Luong
Bruno Luong 2023 年 7 月 11 日
You seem to use not the latest version of MATLAB. In R2023b the preference window looks like this
And if you read throuh the thread, it seems the prefernce is not really used by parallel toolboxn so it doesn't matter even if you could retrieve the value.

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

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by