Skip to content

Instantly share code, notes, and snippets.

@SebastianBitsch
Last active April 4, 2024 09:53
Show Gist options
  • Save SebastianBitsch/74d26f69400b4b0bbb7edd2a54004765 to your computer and use it in GitHub Desktop.
Save SebastianBitsch/74d26f69400b4b0bbb7edd2a54004765 to your computer and use it in GitHub Desktop.
Jupyter server for DTU HPC/3D-imaging-center

Jupyter server for DTU HPC/3D-imaging-center

This gist is a small guide for getting a Jupyter server running on DTU HPC on a GPU node.

#!/bin/bash
# Client, can be run on any node
# read config
cd ~/jupyter
. config.conf
# connect to the jupyter server
ssh $USER@login2.hpc.dtu.dk -NL$PORT:$SERVER_HOSTNAME:$PORT
PORT=44012
CONFIG=config.conf
USER=s204163
GROUP=group_Curlew
SERVER_HOSTNAME=na
#!/bin/bash
# Server, remember to switch to appropriate node before running; linuxsh, a100sh, sxm2sh, etc..
# see: https://www.hpc.dtu.dk/?page_id=2129
# read config
cd ~/jupyter
. config.conf
# set the hostname in the config, clients need to connect to this
sed -i "s/^SERVER_HOSTNAME=.*/SERVER_HOSTNAME=$HOSTNAME/" $CONFIG
# activate env, this can be any enviornment, here it is a conda env
cd /dtu/3d-imaging-center/courses/
. conda/conda_init.sh
conda activate env-02510
# expose "all" GPUs. Please note that devices 2,3 will only be available on sxm2sh since it has 4 GPUs. Use at own risk
export CUDA_VISIBLE_DEVICES="0,1,2,3,4"
# start notebook server at the location with your files
cd /dtu/3d-imaging-center/courses/02510/groups/$GROUP/$USER/
jupyter notebook --port=$PORT --ip=$HOSTNAME --no-browser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment