Matlab

General Information

Home pageVersionLicensing
se.mathworks.com/products/matlabR2013bAccess to the Matlab installation on Vilje is available for NTNU employees and students only
R2014a

Usage on Vilje

The Matlab Parallel Computing Toolbox (PCT) allows you to run on available cores on a node. Notice, Matlab will use one licence from the common NTNU licence pool for each running PCT program.

It is possible to run Distributed Matlab on Vilje. See here.

Important
Do NOT start the Matlab GUI on Vilje. All production jobs must run in the queuing system.

Sample Matlab Job Script

#!/bin/bash
###################################################
#
#  Matlab job
#
###################################################
#
#PBS -N test
#PBS -A nn1234k #Your project account
#PBS -l select=1:ncpus=32:ompthreads=16
#PBS -l walltime=01:00:00 #HH:MM:SS
#PBS -q workq
 
module load matlab
 
cd $PBS_O_WORKDIR
 
matlab -nodisplay -r "myprogram"

Parallel Computing Toolbox example

Create a matlab file for running your code, e.g. test.m

parpool('local',16); %Start parallel toolbox
  
try
 
%My code start -----------------------
 
% This example print out the lab ID from each worker
spmd
labindex
end
  
%My code end --------------------------
delete(gcp('nocreate')); %Stop parallel toolbox
catch exception
   delete(gcp('nocreate'));
   disp('**\* Job Script Error \***');
   disp(exception.identifier);
end

Submit the job to the queueing system using a job script (see Sample Matlab Job Script), e.g. matlab.pbs:

$ qsub matlab.pbs

Further Information

Scroll to Top