MATLAB (matrix laboratory) is a multi-paradigm numerical computing environment and fourth-generation programming language. Developed by MathWorks, MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages, including C, C++, Java, and Fortran. (taken from, more details there)


module add software/matlab/R2015a

See the vendor documentation:

Using Matlab-Compiler

There are several options to compile your Matlab code to stand-alone executables/libraries. Being independent of licenses is one of the major advantages here, of course. But when running compiled code with the Matlab Runtime Envirenment (MRE) on the cluster you have to consider the threading of your code just as well as when you run Matlab itself. Generally, Matlab detects the number of physical cores and opens the same amount of threads to make full use of the multithreading implemented in the built-in functions. So, if you call

you obtain multithread code. Often this might be wanted, but you have to make sure that you select the appropriate resources for this then - namely, the appropriate core-affinity. Since Matlab wants to use everything on a host you'll have to call bsub -n 1 -R 'affinity[cores(64)]' and an appropriate memory reservation. On the other hand, if your code doesn't need the full multithreading capability, you should compile your code with the flag 'singleCompThread'

This makes sure that your standalone code will run on a single computational thread, which not only doesn't frustrate the core scheduler and the other users but improves performance of your code because less time is spent in scheduling all the threads on one core.

Sometimes it can speed up your single-core job if submit it using

This binds 2 cores of the same memory block to your process and can speed up your calculation by up to 50% depending on your code, of course. Note that you can only use up to 32 GB for your task in this case, since one NUMA-Block contains 32 GB.


Submitting a Matlab job


Compiling a m-file on a node

Using the following shell script you can compile a m-file into a stand-alone c application. It's a variation of the script for using local scratch on a node.