MATLAB installations at NSC


Directory list:

VersionDescription
R2012a Matlab [Link]
R2012b Matlab [Link]
R2013a Matlab [Link]
R2014a 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

The following Matlab licenses are available at NSC. If you are covered by one of them, please contact support@nsc.liu.se and ask to be added to the appropriate license group.

  • Linköping University Matlab TAH license. Available to all Linköping university staff and students.
  • Chalmers University Matlab license.
  • KTH Matlab license.
  • MISU (misu.su.se) Matlab license.
  • Uppsala University Matlab license.

If you work at an organization that does not have its license listed above, 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:
www.nsc.liu.se/systems/triolith/#accessing_triolith_thinlinc

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 User Guide for more information on how to submit and check the result of your batch jobs.