MATLAB Answers

pctRunOnAll does not recognize current parallel pool

조회 수: 3(최근 30일)
Chris10116
Chris10116 18 Sep 2019
댓글: Chris10116 19 Sep 2019
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

  댓글 수: 0

로그인 to comment.

채택된 답변

Edric Ellis
Edric Ellis 19 Sep 2019
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 19 Sep 2019
Thank you very much. Easy as that. I thought it automatically creates a parallel pool if I insert a parfor.

로그인 to comment.

추가 답변(0개)

이 질문에 답변하려면 로그인을(를) 수행하십시오.

태그

제품


릴리스

R2018b

Translated by