How to use Jupyter notebooks on the GPU nodes
Introduction
Users can run jupyter notebooks directly on the GPU nodes (or any other node) while accessing the notebeook from a browser within a ThinLinc session, or via an ssh tunnel.
Overview
- start an interactive session
- load an anaconda module
- start a jupyter notebook in the background
- access from a web browser in
- in a ThinLinc remote desktop session
- over an ssh tunnel
- terminate the juptyer notebook when done
Full Procedure
-
Request an interactive session on a GPU node
srun --account=my-account-id --partition=gpu --gpus=1 --time=2:00:00 --x11 --pty bashWhen the interactive session is allocated, this will provide you with a command prompt on the allocated node e.g.
[acs03XXX@gpu01]$ -
load an anaconda module
module load anaconda/python-3.8.8/2021.05 -
start a jupyter notebook Note: make sure you use the name of the allocated node above (gpu01 in this example)
jupyter-notebook --no-browser --ip=gpu01 > notebook-output 2>&1 &This command will send all output (and errors) from the juptyter-notebook process to the file 'notebook-output'. The final "&" places the process in the background.
-
find the session token for your notebook by typing:
jupyter notebook listThis will return something like:
http://gpu01:8888/?token=4f1f3e780d70d75c09b4ce6c77289f52cdd79047bb461665 :: /users/acs03XXXThe above information should also be visible in the 'notebook-output' file.
-
On the login node (from within a ThinLinc session) start a web broswer, and go to the URL displayed above:
http://gpu01:8888/?token=4f1f3e780d70d75c09b4ce6c77289f52cdd79047bb461665 -
Terminate the jupyter notebook by clicking on "Quit" in the web-browser, or by typing:
jupyter notebook stop