Borrar filtros
Borrar filtros

what does "parpool close force local" mean?

2 visualizaciones (últimos 30 días)
zhu wenguo
zhu wenguo el 12 de Jul. de 2020
Comentada: zhu wenguo el 12 de Jul. de 2020
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!

Respuesta aceptada

Walter Roberson
Walter Roberson el 12 de Jul. de 2020
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

Más respuestas (0)

Categorías

Más información sobre Parallel Computing Fundamentals en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by