Skip to content

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

  1. start an interactive session
  2. load an anaconda module
  3. start a jupyter notebook in the background
  4. access from a web browser in
    • in a ThinLinc remote desktop session
    • over an ssh tunnel
  5. terminate the juptyer notebook when done

Full Procedure

  1. Request an interactive session on a GPU node

     srun --account=my-account-id --partition=gpu --gpus=1 --time=2:00:00 --x11 --pty bash
    

    When the interactive session is allocated, this will provide you with a command prompt on the allocated node e.g.

    [acs03XXX@gpu01]$
    
  2. load an anaconda module

    module load anaconda/python-3.8.8/2021.05
    
  3. 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.

  4. find the session token for your notebook by typing:

    jupyter notebook list
    

    This will return something like:

    http://gpu01:8888/?token=4f1f3e780d70d75c09b4ce6c77289f52cdd79047bb461665 :: /users/acs03XXX
    

    The above information should also be visible in the 'notebook-output' file.

  5. 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
    
  6. Terminate the jupyter notebook by clicking on "Quit" in the web-browser, or by typing:

    jupyter notebook stop