Commit b2a0895b authored by Pierre Cazenave's avatar Pierre Cazenave

Remove the old parallel processing bits and replace with the current versions.

parent e2fa43d7
...@@ -43,6 +43,8 @@ function Mobj = get_HYCOM_tsobc(Mobj, hycom, varlist) ...@@ -43,6 +43,8 @@ function Mobj = get_HYCOM_tsobc(Mobj, hycom, varlist)
% the new interp1 call and it's identical to the old version. Also % the new interp1 call and it's identical to the old version. Also
% update the parallel toolbox stuff for the same reason (future % update the parallel toolbox stuff for the same reason (future
% removal). % removal).
% 2015-05-21 Remove the old parallel processing bits and replace with
% the current versions.
% %
%========================================================================== %==========================================================================
...@@ -54,22 +56,11 @@ if ftbverbose ...@@ -54,22 +56,11 @@ if ftbverbose
fprintf(['begin : ' subname '\n']) fprintf(['begin : ' subname '\n'])
end end
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.
try if isempty(gcp('nocreate'))
% New version for MATLAB 2014a (I think) onwards. % Force pool to be local in case we have remote pools available.
if isempty(gcp('nocreate')) parpool('local');
pool = parpool('local');
wasOpened = true;
end
catch
% Version for pre-2014a MATLAB.
if matlabpool('size') == 0
% Force pool to be local in case we have remote pools available.
matlabpool open local
wasOpened = true;
end
end end
end end
...@@ -374,14 +365,7 @@ if isfield(hycom, 'time') ...@@ -374,14 +365,7 @@ if isfield(hycom, 'time')
Mobj.ts_times = hycom.time; Mobj.ts_times = hycom.time;
end end
% Close the MATLAB pool if we opened it. cleaner = onCleanup(@() delete(gcp('nocreate')));
if wasOpened
try
pool.delete
catch
matlabpool close
end
end
if ftbverbose if ftbverbose
fprintf(['end : ' subname '\n']) fprintf(['end : ' subname '\n'])
......
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