Home > utility > feOpenLocalCluster.m

feOpenLocalCluster

PURPOSE ^

Initializes a local matlab cluster if the parallel matlab toolbox is

SYNOPSIS ^

function feOpenLocalCluster

DESCRIPTION ^

 Initializes a local matlab cluster if the parallel matlab toolbox is
 available.

  feOpenLocalCluster

 Copyright (2013-2014), Franco Pestilli, Stanford University, pestillifranco@gmail.com.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function feOpenLocalCluster
0002 % Initializes a local matlab cluster if the parallel matlab toolbox is
0003 % available.
0004 %
0005 %  feOpenLocalCluster
0006 %
0007 % Copyright (2013-2014), Franco Pestilli, Stanford University, pestillifranco@gmail.com.
0008 
0009 % Initialize a local matlab cluster to speed up some of the processes.
0010 if exist('matlabpool','file')
0011    try 
0012      if (matlabpool('size') == 0)
0013         if (exist('parcluster','file') == 2)
0014            c = parcluster;
0015            c.NumWorkers = 12;
0016            t = tempname;
0017            OK = mkdir(t);
0018            if OK
0019               c.JobStorageLocation = t;
0020            end
0021            matlabpool(c);
0022         else
0023            matlabpool open;     
0024         end
0025      else
0026         % disp('[feOpenLocalCluster] Found Matlab parallel cluster open, not intializing.')
0027      end
0028    catch ME
0029      fprintf('\n[feOpenLocalCluster] Problem intializing the cluster: \n\n %s.\n', ME.message)
0030      disp('[feOpenLocalCluster] Many computations will be substantially slower, without the parallel toolbox.')
0031    end
0032 else
0033       disp('[feOpenLocalCluster] Cannot find the Matlab parallel toolbox, not intializing a cluster.')
0034       disp('[feOpenLocalCluster] Many computations will be substantially slower, without the parallel toolbox.')
0035 end
0036 
0037 end

Generated on Wed 16-Jul-2014 19:56:13 by m2html © 2005