[Nirfast] matlabpool error fixed

Xin Sun sun.xin1 at husky.neu.edu
Wed Nov 16 16:10:10 EST 2016


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: <http://public.kitware.com/pipermail/nirfast/attachments/20161116/c42faf70/attachment.html>
-------------- 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
-
-


More information about the Nirfast mailing list