Using MATLAB on AI.Panther

AI.Panther has MATLAB R2026a and R2022b installed for interactive and batch use through the environment module system. R2026a is the default; R2022b is kept for compatibility with existing code.

Loading the module

module load matlab

That gives you R2026a. To pick a release explicitly:

module load matlab/r2026a
module load matlab/r2022b

The two releases conflict, so run module purge before switching between them.

Open OnDemand (graphical)

The MATLAB desktop is available in Open OnDemand under Interactive Apps. It runs on the VDI nodes and gives you the full GUI in your browser, including Simulink and figure windows. Leave the GPU field at 1 so graphics are hardware accelerated.

Use an OnDemand session for interactive and graphical work, then submit heavy computation from inside it to the batch partitions rather than sizing the session itself up.

Interactive session (command line)

Request a compute node and start MATLAB without the GUI:

srun --partition=med --time=01:00:00 --pty bash
module load matlab
matlab -nodisplay -nosplash

Batch submission

#!/bin/bash
#SBATCH --partition=med
#SBATCH --time=01:00:00
#SBATCH --cpus-per-task=4
#SBATCH --mem=8G

module load matlab
matlab -nodisplay -nosplash -batch "myscript"

Parallel Computing Toolbox (single node)

Loading the MATLAB module registers a cluster profile named "ai-panther R2026a" and makes it your default, so a bare parpool submits a new Slurm job instead of starting workers inside the allocation you already have.

For a single-node pool inside your current job, name the local profile explicitly:

parpool('Processes', 4)

Match the pool size to your --cpus-per-task. "Processes" is what older releases called "local".

Parallel Server (multi-node)

MATLAB Parallel Server is installed, and multi-node parallel jobs run on AI.Panther under R2026a. The "ai-panther R2026a" profile registers itself the first time you start MATLAB with the module loaded, so there is nothing to set up by hand.

Set the properties the scheduler needs before submitting. MemUsage is required and MATLAB will refuse to submit without it:

c = parcluster;
c.AdditionalProperties.MemUsage = '4gb';
c.AdditionalProperties.QueueName = 'med';
c.AdditionalProperties.WallTime = '04:00:00';
c.saveProfile

These persist across sessions. Also supported: AccountName, ProcsPerNode, RequireExclusiveNode, Constraint, GpusPerNode with GpuCard, and Reservation.

Submit a multi-node parallel job with batch and a pool:

c = parcluster;
j = c.batch(@myfunction, 1, {arg1, arg2}, 'Pool', 15);
wait(j)
fetchOutputs(j)

That requests 16 tasks, one client and 15 pool workers, across as many nodes as Slurm allocates.

Known limitation. An interactive parpool spanning more than one node does not currently connect; the workers start and then time out waiting to join. We are pursuing this with MathWorks. Single-node interactive pools work, and you can keep one on a single node by setting ProcsPerNode to the pool size:

c = parcluster;
c.AdditionalProperties.ProcsPerNode = 8;
p = c.parpool(8);

For parallel work wider than one node, use batch with a 'Pool' argument as shown above, which is unaffected.