MATLAB installations at NSC


Directory list:

VersionDescription
R2011a Matlab [Link]
R2012a Matlab [Link]
R2012b Matlab [Link]
R2013a Matlab [Link]
R2014a Matlab [Link]
R2014b Matlab [Link]
R2015a Matlab [Link]
R2015b Matlab [Link]
R2016a Matlab [Link]
R2016b Matlab [Link]

Level of support

Tier 3 NSC will not be able to help you much with this program, either because we lack the in-house experience, or because it is a test installation. In general, these types of installations are untested, and will not be updated unless you send a request to NSC.

Please see the page describing our software support categories for more information.
You can also contact support@nsc.liu.se for further information.

Licensing

Linköping University have signed a “Third party access rider to the Mathworks, Inc. Software license agreement”. The rider allows Third Parties to use all licensed programs, provided such access and use is solely for the purpose of academic course work and teaching, noncommercial academic research, and personal use which is not for any commercial or other organizational use.

If you work at a non academic organization or need toolboxes not included in the Linköping University license but have your own license, please contact support@nsc.liu.se and we will help you find out if you can use Matlab at NSC using that license.

How to run

Load the Matlab module corresponding to the version you want to use.

module load matlab/R2012a

To run Matlab interactively, allocate a compute node for interactive use and then run matlab:

interactive -N1 --exclusive -t 00:30:00
matlab

When running the GUI, NSC recommends using ThinLinc to access Triolith. For more information on how to use ThinLinc, please see the page Running graphical applications.

To run Matlab with ThinLinc and hardware accelerated OpenGL support:

vglrun matlab

If you do not want the graphical Matlab desktop, you can run in text-mode:

matlab -nodesktop

Please do not run Matlab on the login node!

Running Matlab batch jobs

Assume that you have a Matlab function saved in the file “parallel.m” that you want to run many times with different input (in this example we will use the inputs 1, 2, 3, … 32).

function S = parallel(x)
%
% Sum average of N random numbers
%
format long
s = RandStream.create('mt19937ar','seed',x);
N = 1e7;
R = rand(s, N, 1);
S = sum(R)/N;
filename = ['parallel_', num2str(x), '.out'];
fid=fopen(filename,'w');
fprintf(fid,'A small Matlab example\n');
fprintf(fid,'Run with the input: %s\n', num2str(x));
fprintf(fid,'Sum average = %16.12f\n',S);
fclose(fid);
%
% End
%

You could then use this batch script (saved as job1.sh):

#!/bin/bash
#
# Load the Matlab module
module load matlab/R2012a

# Use 2 nodes, i.e. 32 cores, for 10 minutes
#SBATCH -N 2 --exclusive
#SBATCH -t 00:10:00

MATLAB='matlab -nodesktop -nodisplay -singleCompThread'
# The name of the Matlab script (without .m)
job=parallel

# Note the explicit "exit" to exit Matlab.
for i in $(seq 1 32);do
  srun -N1 -n1 --exclusive ${MATLAB} -r "${job}(${i});exit" > ${job}_${i}.log &
done
wait # needed to prevent the script from exiting before all Matlab tasks are done

# End of script

To run this batch job, submit it using:

sbatch job1.sh

Please see the Batch jobs and scheduling page for more information on how to submit and check the result of your batch jobs.