Skip to content

MATLAB Compiler Runtime (MCR) on MeluXina

The MeluXina system environment provides the MCR compiler.

EasyBuild module description

 The MATLAB Runtime is a standalone set of shared libraries that enables the execution of compiled MATLAB applications or components on computers that do not have MATLAB installed.

You can use MCR to compile your MATLAB programs.

Intel usage

Interactive

Reserve an interactive session:

salloc -A COMPUTE_ACCOUNT -t 01:00:00 -q dev --res cpudev -p cpu -N 1

The example above will allocate one CPU node in interactive mode (dev QoS with cpudev reservation). Load the MCR (Will load default version if not specified) module as in below script.

module load MCR
mcc -m -R -singleCompThread -R -nodisplay -R -nojvm hello.m
  • The -m option enables C language translation
  • The -R option indicates runtime options
  • -singleCompThread runs the application as single-threaded
  • -nodisplay disables graphical output
  • -nojava disable Java

Batch

MCR can also be used in a batch job using Slurm. The script below compile a simple C HelloWorld test on one CPU node allocated for 5 minutes.

#!/bin/bash -l
#SBATCH -N 1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH -p cpu
#SBATCH -q test
#SBATCH --time 00:05:00

#Load MCR module
module load MCR

#Check MCR version
mcc --version

#Compile C program with Intel
mcc hello.m -o ./hello_m

#Execute the program
hello_m