필터 지우기
필터 지우기

what does "parpool close force local" mean?

조회 수: 2 (최근 30일)
zhu wenguo
zhu wenguo 2020년 7월 12일
댓글: zhu wenguo 2020년 7월 12일
I am using a code based on old version matlab, and I got a error when it comes to:
if numProc <= 1
parpool close force local
else
% poolSize = parpool('size'); % check to see if a pool is already open
p = gcp('nocreate'); % If no pool, do not create new one.
if isempty(p)
poolSize = 0;
else
poolSize = p.NumWorkers
end
if poolSize == 0 || poolSize < numProc || poolSize ~= numProc
parpool close force local
eval(['parpool open ' num2str(numProc)])
end
end
and got the following error:
Error using parpool (line 145)
Properties and values must be specified in pairs.
it seems that the command has been deprecated, what does it mean? and what is its alternatives?
thank you in advance!

채택된 답변

Walter Roberson
Walter Roberson 2020년 7월 12일
Something like,
if numProc <= 1
p = gcp('nocreate');
if ~isempty(p)
delete(p);
end
poolSize = 0;
else
p = gcp('nocreate');
if isempty(p)
poolSize = 0;
else
poolSize = p.NumWorkers;
if poolSize ~= numProc
delete(p);
poolSize = 0;
end
end
if poolSize == 0
try
p = parpool(numProc);
poolSize = p.NumWorkers;
catch
poolSize = 0;
end
end
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Parallel Computing Fundamentals에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by