Interactive Sessions
An interactive session is a scheduler job where you can run commands in real-time (i.e., it is qualitatively identical a remote session started via Secure Shell or a terminal session that you've started on your laptop). If you're developing code in the cluster environment or your analysis workflow isn't well-defined and you need to experiment with different command line tools then this is the option you want.
Similar to a Secure Shell (SSH) session or a terminal window, if you close your interactive session the applications that are running in it will be quit and the resources will be freed up for use by other jobs on the cluster. If you need your interactive session to persist, we recommend using the screen or tmux utilities on the login node. Tutorials for these tools can be found below:
To run an interactive job on the cluster, invoke the srun command on the login node (axon.rc) as demonstrated below:
srun --pty bash -i
This command would start an interactive job with the default limits. You would be provided with a session on one of Axon's nodes with one CPU core (and no GPU) for the default job time limit (see here; currently 10 days as of 3/21).
srun --pty -c 2 --nodelist=ax08 --gres=gpu:gtx1080:2 -t 0-01:00 /bin/bash
In the command above the parameters are as follows:
--pty says to start a pseudo terminal interactive session (mandatory for interactive sessions).
-c 2 means use 2 cores (optional, default is 1 core)
--nodelist=ax08 means only run on the node named ax08 (optional, default is any to run on any available node)
--gres=gpu:gtx1080:2 is to use 2 gpu boards of the gtx1080 variety (optional, by default no gpus are allocated, note allocated gpus will appear starting as id 0)
-t 0-01:00 is to set the time for the session, in this case 1 hour (generally, the shorter the time you request, the higher the likelihood your job can be scheduled, this will be come more important as the cluster fills up!)
/bin/bash is to run the program you wish to start in the interactive session, the bash shell (mandatory, you need to specify a program it doesn't have to be a command line interpreter like bash it could by python or matlab if that's what you want to run)
How to Run MATLAB Interactively with the GUI on Axon
Before You Begin: CLI vs. GUI MATLAB
For most workflows, the command-line interface (CLI) is faster, more stable, and cluster-friendly. Reserve the GUI only for tasks that require visual interaction.
When to Use CLI
ā Faster execution (no GUI overhead)
ā Better for batch processing (scripts, functions)
ā Easier automation (via matlab -batch "your_code.m"
)
ā Lightweight over SSH (no X11 forwarding needed)
When GUI is Necessary
Feature Type | Example Tools | CLI Alternative |
---|---|---|
Interactive plotting | figure , imshow , surf | Save plots to files (print , savefig ) |
Live Editor | .mlx scripts | Use .m scripts + publish reports |
App Designer | GUI building | Code-based UIs (uifigure , uicontrol ) |
Variable Editor | Spreadsheet view | disp() , whos , command-line debugging |
Debugger/Profiler | Visual tools | dbstop , tic/toc , profile -timer |
0. Prerequisites: X11 Forwarding Setup
Windows Users
š¹ Recommended: Use MobaXterm (includes built-in X11 support).
Just install, open, and SSH with
-Y
:ssh -Y your_username@axon.rc.zi.columbia.edu
No extra config needed!
š¹ Alternative: Xming + PuTTY setup guide here.
macOS Users
š¹ Install XQuartz (required for X11):
Download and install XQuartz.
Restart your Mac.
Open Terminal and SSH with
-Y
:ssh -Y your_username@axon.rc.zi.columbia.edu
1. Log in with X11 Forwarding
After setting up MobaXterm/XQuartz:
ssh -Y your_username@axon.rc.zi.columbia.edu
ā
Verify X11 works: Run xclock
– a clock should pop up!
2. Check Available MATLAB Versions
module avail matlab # Press [TAB] to see options
Example output:
matlab/2017a matlab/2019b matlab/2021a matlab/2017b matlab/2020a matlab/2022a
3. Start MATLAB via Slurm
This command uses our new x11_container_helper.sh
script to properly handle GUI applications in Slurm:
srun -n1 --pty --x11 -A your_UNI -t 6:00:00 \ /etc/slurm/x11_container_helper.sh bash -c "module load matlab && matlab -nosplash -desktop"
Option | Example | Notes |
---|---|---|
-A physics_123 | uni123 | Required |
-p burst | burst | burst for faster start |
-t 6:00:00 | -t 2:00:00 | Max runtime (default=10d) |
matlab/2022a | matlab/2021a | Check with module avail |
4. Wait for MATLAB to Launch
Delay: 1–5 minutes over Wi-Fi (be patient!).
Slow GUI? Reduce bandwidth usage:
matlab -nosplash -desktop -softwareopengl # Use if laggy
5. Quitting MATLAB Properly
Type
exit
in MATLAB’s>>
prompt.Wait 10–30 seconds for Slurm to release resources.
š« Never:
Force-close the window → Creates core dumps can affect your quota/disk space!
Kill the SSH session → Job keeps running!
ā ļø Important Warning About MATLAB Sessions
If you quit MATLAB and try to start it again in the same SSH session, you will see:
srun: error: x11_get_xauth: Could not retrieve magic cookie. Cannot use X11 forwarding.
Why This Happens
The X11 authentication token is consumed when MATLAB launches
Closing MATLAB invalidates the token
Your SSH session cannot regenerate it
Required Action
To run MATLAB again:
Fully log out:
exit
Start a brand new session:
ssh -Y your_UNI@axon.rc.zi.columbia.edu
Only then rerun your Slurm command.
Key Implications
This affects all GUI applications using the X11 wrapper
One MATLAB session per SSH connection
No workarounds exist - this is a security feature