How to get your MATLAB work done on NeSI's Pan cluster

  1. Prerequisites: Work through the companion document OtagoPanInstructions first.
  2. Type nano simplefunction.m and Copy and Paste the following (it makes a random matrix and displays the result of a calculation), write out and exit:
    
    function simplefunction(n)
    n = str2double(n);
    a = rand(n);
    save simpleMatlab a
    2^10
    
    
  3. Type nano simpleMatlab.sl and Copy and Paste the following (you need to replace projectIDhere with your project ID from OtagoPanInstructions), write out and exit:
    
    #!/bin/bash
    #SBATCH -J yourjobName
    #SBATCH -A projectIDhere
    #SBATCH --time=1:00:00
    #SBATCH --mem-per-cpu=2048
    #SBATCH --output=simpleMatlabout.txt
    #SBATCH --error=simpleMatlaberr.txt
    module load MATLAB/2015b
    srun matlab -nodesktop -nosplash -nodisplay -nojvm -r 'simplefunction 20'
    
    
  4. Submit the Slurm script you created in step 2 by typing: sbatch simpleMatlab.sl.
  5. When your job is finished, you should find three new files:
  6. You copy the file simpleMatlab.mat to your local machine (see OtagoPanInstructions) or look at it on the build node using:
    ssh build-sb 
    module load MATLAB/2015b
    matlab
    load simpleMatlab
    disp(a)
    
    
  7. Changing your code to work on Pan