User Tools

Site Tools


matlab_on_cluster

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
matlab_on_cluster [2016/06/03 09:24] – [Managing parallel configurations] lenocilmatlab_on_cluster [2021/06/24 07:19] (current) – [Matlab on multi-processor machines] lenocil
Line 1: Line 1:
 ====== Matlab on multi-processor machines ====== ====== Matlab on multi-processor machines ======
-The aim of this short guide is to get you started with using matlab in a multi-processor environment. The goal is to instruct matlab to use a `pool' of ''n'' processors rather than a single one to speed up calculations. 
  
-:!: Before trying to parallelize any codes, please make sure your code works as expected on one processor.+The aim of this short guide is to get you started with using matlab in a multi-processor environment. The goal is to instruct matlab to use a `pool' of ''n'' processors rather than a single one to speed up calculations.
  
-:!: matlab versions prior to 2007 do not have the features discussed here.+|matlab is available on all Lorentz Institute and Sterrewacht cluster machines.| 
 +|Before trying to parallelize any codes, please make sure your code works as expected on one processor.| 
 +|matlab versions prior to 2007 do not have the features discussed here.|
  
 =====  Parallel Computing Toolbox aka matlabpool ===== =====  Parallel Computing Toolbox aka matlabpool =====
Line 10: Line 11:
 matlabpool can be used to parallelize your m script across multiple cores in a single machine. matlabpool can be used to parallelize your m script across multiple cores in a single machine.
  
-Open matlab and initialize the parallel environment+Open matlab ((Type ''ml spider matlab'' to list available versions)) and initialize the parallel environment
  
 <code> <code>
Line 27: Line 28:
              ClusterOsType : unix              ClusterOsType : unix
                ClusterSize : 8                ClusterSize : 8
-              DataLocation : /home/lenocil/.matlab/local_scheduler_data/R2010b+              DataLocation : /home/xxxxx/.matlab/local_scheduler_data/R2010b
        HasSharedFilesystem : true        HasSharedFilesystem : true
  
Line 57: Line 58:
 In matlab2010 the max number of workers is set to 8 where as that limit ip brought to 12 in matlab R2011b. In matlab2010 the max number of workers is set to 8 where as that limit ip brought to 12 in matlab R2011b.
  
-If you wanted to use 64 workers (for instance on one of the maris nodes), you will need a 64-node MDCS licence +If you wanted to use 64 workers (for instance on one of the maris nodes), you will need a 64-node MDCS licence ((Leiden University has an unlimited access license for everybody, see https://nl.mathworks.com/academia/tah-portal/universiteit-leiden-31485292.html)
-(you can buy it through our procurement office) and you will also need to create a `scheduler' to manage these resources. There are detailed instructions on how to do this at http://nl.mathworks.com/support/product/DM/installation/ver_current/+ and you will also need to create a `scheduler' to manage these resources. There are detailed instructions on how to do this at http://nl.mathworks.com/support/product/DM/installation/ver_current/
  
 +To modify the local configuration
 +
 +<code>
 +jm=findResource('scheduler', 'configuration', 'local'); 
 +jm.ClusterSize=6
 +jm.DataLocation="/somewhere/you/like"
 +</code>
 +
 +To check what configurations are available and which one is loaded use
 +<code>
 +[conf, allConf] = defaultParallelConfig 
 +conf =
 +
 +test
 +
 +
 +allConf = 
 +
 +    'local'    'test'
 +
 +</code>
 +===== Gotchas =====
  
-==== Gotchas ==== 
   * `parfor' executes loop in an order that suits matlab, that is not sequentially   * `parfor' executes loop in an order that suits matlab, that is not sequentially
   * `parfor' loops cannot be nested   * `parfor' loops cannot be nested
Line 69: Line 91:
 http://vtchl.uiuc.edu/sites/default/files/MATLAB_Report.pdf http://vtchl.uiuc.edu/sites/default/files/MATLAB_Report.pdf
  
 +http://www.mathworks.com/support/product/DM/installation/ver_current/Files/mdcs-mjs-quickstart-guide.pdf
  
 +http://nl.mathworks.com/help/distcomp/program-independent-jobs-for-a-generic-scheduler.html
matlab_on_cluster.1464945890.txt.gz · Last modified: 2016/06/03 09:24 by lenocil