pctRunOnAll does not recognize current parallel pool

2 ビュー (過去 30 日間)
Chris10116
Chris10116 2019 年 9 月 18 日
コメント済み: Chris10116 2019 年 9 月 19 日
Inside a parfor loop I want to surpress warnings with pctRunOnAll but I get the error message: Cannot execute pctRunOnAll warning_off_WarnIfIllConditioned when a parallel pool does not exist. What should I do?
parfor V_g_i = 1:length(V_g_vec)
pctRunOnAll warning_off_WarnIfIllConditioned
%% Other code
[Vi,~] = eigs(mat,1,10^(-19)); % mat is an ill-conditioned matrix
%% Other code
end

採用された回答

Edric Ellis
Edric Ellis 2019 年 9 月 19 日
You should use pctRunOnAll at the client, i.e. before the start of the loop, like this:
gcp(); % Ensure we have a parallel pool that parfor will use
pctRunOnAll warning_off_WarnIfIllConditioned
parfor V_g_i = 1:length(V_g_vec)
%% Other code
[Vi,~] = eigs(mat,1,10^(-19)); % mat is an ill-conditioned matrix
%% Other code
end
(I assume warning_off_WarnIfIllConditioned is a script or function you have to make the necessary warning modifications)
  1 件のコメント
Chris10116
Chris10116 2019 年 9 月 19 日
Thank you very much. Easy as that. I thought it automatically creates a parallel pool if I insert a parfor.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by