Interactive Sessions

Run commands directly on a compute node for testing, debugging, and exploration.

Interactive sessions give you a shell on a compute node, letting you run commands in real-time instead of waiting for batch job results. This is ideal for:

  • Testing code before submitting production jobs

  • Debugging issues with immediate feedback

  • Exploring data and checking results interactively

  • Running Jupyter notebooks or other interactive tools

  • Learning commands without job submission overhead

Basic Interactive Session

Request an interactive session on the standard partition:

srun --pty --time=02:00:00 /bin/bash

This reserves a compute node for 2 hours and gives you a bash shell. Optionally, you can specify --partition=development to be placed on a devel node.

Interactive Session with Resources

Specify CPU, memory, and other resources:

srun --pty \
  --nodes=1 \
  --ntasks-per-node=1 \
  --cpus-per-task=4 \
  --mem=8G \
  --time=02:00:00 \
  /bin/bash

Interactive GPU Session

Request a GPU node for testing GPU code:

srun --pty \
  --gres=gpu:a100:1 \
  --time=04:00:00 \
  --partition=gpu-a100 \
  /bin/bash

Note

The specific partition and gpu requested may differ between clusters.

Cluster-Specific Interactive Sessions

Different clusters have different partition names and limits:

Standard CPU Session:

srun --pty --time=02:00:00 --partition=orion /bin/bash

Big Memory Session:

srun --pty --time=02:00:00 --partition=bigmem --mem=256G /bin/bash

Standard CPU Session:

srun --pty --time=02:00:00 --partition=hercules,hercules-2 /bin/bash

GPU Session:

srun --pty --gres=gpu:a100:1 --time=04:00:00 --partition=gpu-a100 /bin/bash

MIG GPU Session:

srun --pty --gres=gpu:mig:1g.10gb --time=04:00:00 --partition=gpu-a100-mig7 /bin/bash

V100 GPU Session:

srun --pty --gres=gpu:v100:1 --time=04:00:00 --partition=gpu-v100 /bin/bash

A100 GPU Session:

srun --pty --gres=gpu:a100:1 --time=04:00:00 --partition=gpu-a100 /bin/bash

L40S GPU Session:

srun --pty --gres=gpu:l40s:1 --time=04:00:00 --partition=gpu-l40s /bin/bash

Standard CPU Session:

srun --pty --time=02:00:00 --partition=morrill /bin/bash

GPU Session:

srun --pty --gres=gpu:a100:1 --time=04:00:00 --partition=gpu-a100 /bin/bash

What to Do in Interactive Sessions

Test Your Code

# Load modules
module load python

# Test script
python test_script.py

# Check results
cat output.txt

Debug Jobs

# Run with debugger
module load gcc
gdb ./my_program

# Or use valgrind
module load valgrind
valgrind --tool=memcheck ./my_program

Explore Data

# Quick data exploration
python
>>> import pandas as pd
>>> df = pd.read_csv('data.csv')
>>> df.head()

Ending Interactive Sessions

# Exit normally
exit

Or press Ctrl+ D

The session ends and resources are released immediately.

salloc

If you find yourself calling srun many times with the same allocation for interactive multi-processing jobs, you can instead use salloc to create a reservation, then srun to use that reservation. e.g.

srun --nodes=4 --ntasks-per-node=32 ./some-mpi-binary
# would become
salloc --nodes=4 --ntasks-per-node=32
srun ./some-mpi-binary
# you can call srun many times more and use the same allocation

Once you are done with your allocation, call exit or press Ctrl + D to exit.

Note

salloc spawns a new shell, this can sometimes interfere with environment variables such as PATH. re-run any env modifying commands such as export and module