Jupyter on Euler and Leonhard Open
Since Jupyter notebooks are becoming more widely used among the scientific community, the HPC group developed a script that you can run on your local computer. This shell script then starts a Jupyter notebook in a batch job on Euler/Leonhard Open (depending on which cluster you choose) and connects your local browser with it.
At the moment, the script can be used with Linux and Mac computers. There is no support for windows computers. Maybe Windows user can try to run the script using Windows subsystem for Linux (WSL), but this has not been tested yet.
Please note, that with this script we are addressing beginners that start to use Jupyter notebooks on the cluster. It is not addressing advanced users that need a wide range of additional features going beyond simple Jupyter notebooks. Advanced users can take the script and adapt it, such that it can be used with other Python versions (centrally installed, or local installations) and add support for GPU, adding new kernels etc.
Getting the script
The script is available on the Gitlab instance of ETH Zurich:
Please note that the example on the wiki refers to the Euler cluster and for Leonhard Open, then hostname needs to be changed from
please make sure that xdg-open is installed. This package is used to automatically start your default browser. You can install it with the following command:
yum install xdg-utils
apt-get install xdg-utils
Download the repository with the command
chmod 755 start_jupyter_nb.sh
Running the script
The start_jupyer_nb.sh script needs to be executed on your local computer:
./start_jupyter_nb.sh CLUSTER NETHZ_USERNAME NUM_CORES RUN_TIME MEM_PER_CORE
|CLUSTER||Name of the cluster (Euler or LeoOpen)|
|NETHZ_USERNAME||NETHZ username for which the notebook should be started|
|NUM_CORES||Number of cores to be used on the cluster (maximum: 36)|
|RUN_TIME||Run time limit for the jupyter notebook on the cluster (HH:MM)|
|MEM_PER_CORE||Memory limit in MB per core|
./start_jupyter_nb.sh Euler sfux 4 01:20 2048
Running multiple notebooks in a single Jupyter instance
If you run Jupyter on the Leonhard cluster, using GPUs (the default version of the uses a python_cpu module, which does not support GPU usage. You would need to change the Python version in the script to enable GPU usage), then you need to make sure a notebook is correctly terminated before you can start another one.
If you don't properly close the first notebook and run a second one, then the previous notebook will still occupy some GPU memory and have processes running, which will throw some errors, when executing the second notebook.
Therefore please make sure that you stop running kernels in the "running" tab in the browser, before starting a new notebook.
Terminate the Jupyter session
Please note that when you finish working with the jupyter notebook, you need to click on the "Quit" or "Logout" button in your Browser. This will stop the batch job running on Euler. Afterwards you also need to clean up the SSH tunnel that is running in the background.
samfux@bullvalene:~/Jupyter-on-Euler-or-Leonhard-Open$ ps -u | grep -m1 -- "-L" | grep -- "-N" samfux 8729 0.0 0.0 59404 6636 pts/5 S 13:46 0:00 ssh firstname.lastname@example.org -L 51339:10.205.4.122:8888 -N samfux@bullvalene:~/jupyter-on-Euler-or-Leonhard-Open$ kill 8729