From sun.xin1 at husky.neu.edu Tue Nov 15 17:40:26 2016 From: sun.xin1 at husky.neu.edu (Xin Sun) Date: Tue, 15 Nov 2016 17:40:26 -0500 Subject: [Nirfast] Error using matlabpool Message-ID: To whom it might concern, I tried to run the forward solver in NIRfast under MATLAB R2015b on Linux workstation, however I got the following error "Error using matlabpool (line 27) matlabpool has been removed. To query the size of an already started parallel pool, query the 'NumWorkers' property of the pool. To check if a pool is already started use 'isempty(gcp('nocreate'))'. And I tried to run the forward solver in MATLAB R2016b on Macbook, no error has been showed. Could you please give me some suggestions to figure this out? Best, Xin Sun -------------- next part -------------- An HTML attachment was scrubbed... URL: From h.dehghani at cs.bham.ac.uk Wed Nov 16 10:01:42 2016 From: h.dehghani at cs.bham.ac.uk (Hamid Dehghani) Date: Wed, 16 Nov 2016 15:01:42 +0000 Subject: [Nirfast] Error using matlabpool In-Reply-To: References: Message-ID: <647d32fd-4a6e-4f35-c77d-df9f259d6c97@cs.bham.ac.uk> As the error states, it is an issue with matlab back compatibility. You can either fix this yourself, by manually updating the command of matlabpool. Alternatively, you can replace parellel_init.m with the following function function result = parallel_init() % parallel_init() % % Initializes the parallel workers if the toolbox is available % % result is 1 if succesful, 0 otherwise if (exist('matlabpool')) % Start labs if necessary. sz = matlabpool('size'); if (sz ==0) matlabpool('open'); end % Check we got some now. sz = matlabpool('size'); if (sz ==0) error('Failed to open parallel workers'); result = 0; else fprintf('Running on %d workers\n', sz); result = 1; end else result = 0; end On 15/11/2016 22:40, Xin Sun wrote: > To whom it might concern, > > I tried to run the forward solver in NIRfast under MATLAB R2015b on > Linux workstation, however I got the following error > > "Error using matlabpool (line 27) > matlabpool has been removed. > To query the size of an already started parallel pool, query the > 'NumWorkers' property of the pool. > To check if a pool is already started use 'isempty(gcp('nocreate'))'. > > And I tried to run the forward solver in MATLAB R2016b on Macbook, no > error has been showed. > > Could you please give me some suggestions to figure this out? > > Best, > Xin Sun > > > _______________________________________________ > Nirfast mailing list > Nirfast at public.kitware.com > http://public.kitware.com/mailman/listinfo/nirfast > -- -------------------------- Hamid Dehghani, PhD, MIPEM School of Computer Science Acting Director, Physical Sciences for Health Doctoral Training Centre University of Birmingham B15 2TT 0121 414 8728 https://www.cs.bham.ac.uk/~dehghanh/mi-lab.html From sun.xin1 at husky.neu.edu Wed Nov 16 16:10:10 2016 From: sun.xin1 at husky.neu.edu (Xin Sun) Date: Wed, 16 Nov 2016 16:10:10 -0500 Subject: [Nirfast] matlabpool error fixed Message-ID: Hello Dr. Dehghani, Thank you for the response. Actually, the function parallel_init in my toolbox is the one you provided, so I followed your first suggestion and manually updated the function. I tried the updated function, it works well. The diff. text file is attached, feel free to give suggestions. Best, Xin -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- --- parallel_init.m 2016-11-16 15:58:26.320262176 -0500 +++ parallel_init_old.m 2016-11-16 15:58:26.320262176 -0500 @@ -7,21 +7,19 @@ % result is 1 if succesful, 0 otherwise if (exist('matlabpool')) % Start labs if necessary. - - if isempty(gcp('nocreate')) - parpool('open'); + sz = matlabpool('size'); + if (sz ==0) + matlabpool('open'); end % Check we got some now. - - if isempty(gcp('nocreate')) + sz = matlabpool('size'); + if (sz ==0) error('Failed to open parallel workers'); result = 0; else - fprintf('Running on %d workers\n', isempty(gcp('nocreate'))); + fprintf('Running on %d workers\n', sz); result = 1; end else result = 0; end - -