Interactive Sessions

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:

Simple interactive job
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).

Complicated interactive job
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 TypeExample ToolsCLI Alternative
Interactive plottingfigure, imshow, surfSave plots to files (print, savefig)
Live Editor.mlx scriptsUse .m scripts + publish reports
App DesignerGUI buildingCode-based UIs (uifigure, uicontrol)
Variable EditorSpreadsheet viewdisp(), whos, command-line debugging
Debugger/ProfilerVisual toolsdbstop, 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):

  1. Download and install XQuartz.

  2. Restart your Mac.

  3. 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"
OptionExampleNotes
-A physics_123uni123Required
-p burstburstburst for faster start
-t 6:00:00-t 2:00:00Max runtime (default=10d)
matlab/2022amatlab/2021aCheck 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

  1. Type exit in MATLAB’s >> prompt.

  2. 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

  1. The X11 authentication token is consumed when MATLAB launches

  2. Closing MATLAB invalidates the token

  3. Your SSH session cannot regenerate it

Required Action

To run MATLAB again:

  1. Fully log out:

    exit
  2. Start a brand new session:

    ssh -Y your_UNI@axon.rc.zi.columbia.edu
  3. 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