Skip to content

Jupyter

This notebook runs DeepLabV3-MobileNetV3 to label every pixel in a photograph.

0 — Launch Jupyter from inside the Singularity container

This is the simplest approach — the entire Jupyter server runs inside the container:

# Get a GPU session first
srun --partition=2080-galvani --gres=gpu:1 --mem=16G --time=02:00:00 --reservation=hands-on --pty bash

# Pick a random port to avoid collisions with other users
export JUPYTER_PORT=$(( 8800 + RANDOM % 100 ))
echo "Using port: $JUPYTER_PORT on $(hostname -f)"

# Launch Jupyter inside the container
singularity exec --nv \
  --bind $WORK:$WORK --bind $HOME:$HOME \
  --env TORCH_HOME=$WORK/.cache/torch \
  $WORK/ml-tutorial/pytorch_24.01.sif \
  bash -c "pip install -q ipykernel && jupyter notebook --no-browser --port=$JUPYTER_PORT --notebook-dir=$WORK/ml-tutorial  --ip=\$(hostname -f)"

1 - Terminal 2 — Your laptop

Then set up the SSH tunnel from a second terminal window from your laptop and connect to your notebook.

# SSH tunnel through the login node to the compute node
ssh -N -L <JUPYTER_PORT>:<COMPUTE_NODE>:<JUPYTER_PORT> <USER>@<LOGIN_NODE>

Then open http://localhost:$JUPYTER_PORT in your browser and paste the token from the Terminal on the compute node.

2 - Start Juyter Notebook

Start jupyter_singularity_tutorial.ipynb.


Last update: June 9, 2026
Created: March 5, 2026