Temporary guide: Running Jupyter on DTU HPC through VSCode

As the QIM Platform is currently down, I’ve been asked to share an alternative way of using the DTU HPC resources for jupyter notebooks. Though it requires some setup we hope that it might be of use for the time being.

This guide assumes that a working Remote SSH connection to DTU HPC has already been configured in VSCode. You can read more about access to the HPC, or alternatively look into using ThinLinc, here.

1. Connect to the HPC in VSCode

Press:

Ctrl + Shift + P

Search for and select:

Remote-SSH: Connect to Host...

Choose the relevant DTU HPC login host. A new VSCode window opens with the remote connection.

2. Open the project folder

In the remote VSCode window, open the folder containing the project you would like to work on. Create the following jupyter.sh script:

#!/bin/bash
#BSUB -J QIM_jupyter_notebook
#BSUB -q hpc
#BSUB -n 1
#BSUB -W 04:00
#BSUB -R "rusage[mem=16GB] span[hosts=1]"
#BSUB -o jupyter_%J.out
#BSUB -e jupyter_%J.err

cd <PROJECT_FOLDER>
source /dtu/3d-imaging-center/QIM/conda/miniconda3/bin/activate

echo "Job ID: $LSB_JOBID"
echo "Queue: $LSB_QUEUE"
echo "Host: $(hostname)"
echo "Port: 8888"

jupyter lab --no-browser --ip=0.0.0.0 --port=8888

Before submitting: Adjust the requested resources to match your needs:

  • #BSUB -n 1 — number of CPU cores

  • mem=16GB — requested memory (per core requested!)

  • #BSUB -W 04:00 — maximum runtime (Here 4 hours)

Request only what you need, as larger requests may take longer to enter the queue.

3. Submit the Jupyter job

Open the integrated terminal in VSCode:

Terminal → New Terminal

Go to the folder containing jupyter.sh, then submit it:

bsub < jupyter.sh

The terminal prints the submitted job ID.

Check the job status with:

bjobs

Wait until the job status changes to “RUN”.

4. Copy the Jupyter URL

The job creates log files named:

jupyter_<JOBID>.out
jupyter_<JOBID>.err

Open the generated log file in VSCode and find the Jupyter URL. It will look similar to:

http://127.0.0.1:8888/lab?token=...

or:

http://<COMPUTE-NODE>:8888/lab?token=...

Copy the complete URL, including the token.

Depending on the Jupyter version, the URL may appear in either the .out or .err file.

5. Connect the notebook to the Jupyter server

Open the desired .ipynb file in the same remote VSCode window.

Click the kernel selector in the upper-right corner of the notebook.

Choose:

Select Another Kernel...

Then choose:

Existing Jupyter Server...

Paste the complete Jupyter URL from the log file and confirm. The notebook now runs using the environment and resources allocated by the submitted HPC job.

6. Stop the job when finished

Save the notebook and check the active job:

bjobs

Stop it using:

bkill <JOBID>

This releases the allocated HPC resources.