MATLAB Compiler
When MATLAB is started, either interactively or within a batch job, a license is required. As we have only a limited number of licenses, this restricts the number of instances which can run simultaneously.
However, in many cases, a MATLAB script can be compiled using the MATLAB compiler to produce a stand-alone program, which can run without the need for a MATLAB license. Thus, the batch system can be used to run an arbitrary number of such a compiled program simultaneously.
The MATLAB program hello_world.m
is compiled in the following way:
module add matlab/R2016a mcc -mv -R -singleCompThread -R -nodisplay hello_world.m
The batch file to run the program then has to include the following lines:
module add matlab/R2016a export MCR_HOME=$MATLABROOT export MCR_CACHE_ROOT=$TMPDIR/$USER/mcr_cache ./run_hello_world.sh $MCR_HOME
Please note that any further arguments passed will be interpreted as strings. Thus, it may, say, be necessary to convert these to integers with str2num
.