Commit c7a9bbb5 authored by Pierre Cazenave's avatar Pierre Cazenave

Update the parallel pool sections to use the new tools.

parent a902dde7
...@@ -119,13 +119,11 @@ end ...@@ -119,13 +119,11 @@ end
% Run jobs on multiple workers if we have that functionality. Not sure if % Run jobs on multiple workers if we have that functionality. Not sure if
% it's necessary, but check we have the Parallel Toolbox first. % it's necessary, but check we have the Parallel Toolbox first.
% wasOpened = false;
if license('test', 'Distrib_Computing_Toolbox') if license('test', 'Distrib_Computing_Toolbox')
% We have the Parallel Computing Toolbox, so launch a bunch of workers. % We have the Parallel Computing Toolbox, so launch a bunch of workers.
if isempty(gcp('nocreate')) if isempty(gcp('nocreate'))
% Force pool to be local in case we have remote pools available. % Force pool to be local in case we have remote pools available.
pool = gcp('local'); parpool('local');
wasOpened = true;
end end
end end
...@@ -335,14 +333,7 @@ for vv = 1:length(vars) ...@@ -335,14 +333,7 @@ for vv = 1:length(vars)
end end
end end
% if wasOpened cleaner = onCleanup(@() delete(gcp('nocreate')));
% matlabpool close
% end
% Better way of closing the pool after each invocation (though this might
% incur some overhead due to the time it takes to spin up/close down a
% MATLAB pool of workers).
cleaner = onCleanup(@() delete(gcp));
if ftbverbose if ftbverbose
fprintf('end : %s \n', subname) fprintf('end : %s \n', subname)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment