From 6e915e04a885fbefa5cea7cc7c11d8eb935180a7 Mon Sep 17 00:00:00 2001 From: Russ Tedrake Date: Fri, 1 May 2015 13:38:27 -0400 Subject: [PATCH] resolves #1064 --- examples/LinearGaussianExample.m | 3 +-- systems/@DynamicalSystem/simulate.m | 2 +- .../@PolynomialSystem/sampledFiniteTimeVerification.m | 4 +--- .../@PolynomialSystem/sampledTransverseVerification.m | 3 +-- util/checkDependency.m | 9 ++++----- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/examples/LinearGaussianExample.m b/examples/LinearGaussianExample.m index 3dc447a3cffe..202a7d66e209 100644 --- a/examples/LinearGaussianExample.m +++ b/examples/LinearGaussianExample.m @@ -41,8 +41,7 @@ function prob=monteCarlo(obj,S,tspan,x0) N=200; - % for old versions of parallel computing toolbox, startup a matlabpool if necessary: - if (exist('matlabpool','file') && matlabpool('size')==0) matlabpool; end + ok=checkDependency('distcomp'); % initialize toolbox if it exists parfor i=1:N xtraj = simulate(obj,tspan,x0); diff --git a/systems/@DynamicalSystem/simulate.m b/systems/@DynamicalSystem/simulate.m index 3f59fa6adc17..149c3d0d8b72 100644 --- a/systems/@DynamicalSystem/simulate.m +++ b/systems/@DynamicalSystem/simulate.m @@ -90,7 +90,7 @@ pstruct.LimitDataPoints = 'on'; pstruct.MaxDataPoints = num2str(options.MaxDataPoints); else - pstruct.LimitDataPoints = 'off' + pstruct.LimitDataPoints = 'off'; end %pstruct.SaveOnModelUpdate = 'false'; diff --git a/systems/@PolynomialSystem/sampledFiniteTimeVerification.m b/systems/@PolynomialSystem/sampledFiniteTimeVerification.m index aa265e73bd6b..764d45ce2b46 100644 --- a/systems/@PolynomialSystem/sampledFiniteTimeVerification.m +++ b/systems/@PolynomialSystem/sampledFiniteTimeVerification.m @@ -36,9 +36,7 @@ % Implements the algorithm described in http://arxiv.org/pdf/1010.3013v1 checkDependency('sedumi'); - -% for old versions of parallel computing toolbox, startup a matlabpool if necessary: -if (exist('matlabpool','file') && matlabpool('size')==0) matlabpool; end +ok=checkDependency('distcomp'); % initialize toolbox if it exists t=msspoly('t',1); ts=ts(:); diff --git a/systems/@PolynomialSystem/sampledTransverseVerification.m b/systems/@PolynomialSystem/sampledTransverseVerification.m index 67661b47eaec..69b8089e8913 100644 --- a/systems/@PolynomialSystem/sampledTransverseVerification.m +++ b/systems/@PolynomialSystem/sampledTransverseVerification.m @@ -33,8 +33,7 @@ if (~isCT(sys)) error('not implemented yet'); end checkDependency('sedumi'); -% for old versions of parallel computing toolbox, startup a matlabpool if necessary: -if (exist('matlabpool','file') && matlabpool('size')==0) matlabpool; end +ok=checkDependency('distcomp'); % initialize toolbox if it exists num_x = sys.getNumStates(); num_xd = sys.getNumDiscStates(); diff --git a/util/checkDependency.m b/util/checkDependency.m index e594ce79a5de..a53f936b9fad 100644 --- a/util/checkDependency.m +++ b/util/checkDependency.m @@ -42,11 +42,10 @@ conf.distcomp_enabled = ~isempty(v); if ~conf.distcomp_enabled disp(' MATLAB Parallel Computing Toolbox was not found'); - else - % go ahead and start up a pool if necessary - if (exist('matlabpool','file') && matlabpool('size')==0) - matlabpool; - end + elseif verLessThan('distcomp','6.3') && matlabpool('size')==0 + % start a matlab pool (if none exists). this approximates the + % now default behavior in newer versions of distcomp. + matlabpool; end case 'spotless'