{"id":13583946,"url":"https://github.com/iot-salzburg/gpu-jupyter","last_synced_at":"2025-05-15T07:06:50.227Z","repository":{"id":37817121,"uuid":"221302744","full_name":"iot-salzburg/gpu-jupyter","owner":"iot-salzburg","description":"GPU-Jupyter: Your GPU-accelerated JupyterLab with a rich data science toolstack, TensorFlow and PyTorch for your reproducible deep learning experiments.","archived":false,"fork":false,"pushed_at":"2025-02-28T18:15:37.000Z","size":1270,"stargazers_count":733,"open_issues_count":3,"forks_count":236,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-14T13:06:50.450Z","etag":null,"topics":["docker","environment","gpu-acceleration","gpu-computing","jupyter","jupyter-server","jupyterlab","pytorch","reproducible-research","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iot-salzburg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["ChristophSchranz"],"patreon":"chris_schranz"}},"created_at":"2019-11-12T20:10:23.000Z","updated_at":"2025-04-02T03:23:12.000Z","dependencies_parsed_at":"2024-02-29T15:54:26.008Z","dependency_job_id":"f4812869-7124-4ec1-8414-860b04502b37","html_url":"https://github.com/iot-salzburg/gpu-jupyter","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iot-salzburg%2Fgpu-jupyter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iot-salzburg%2Fgpu-jupyter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iot-salzburg%2Fgpu-jupyter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iot-salzburg%2Fgpu-jupyter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iot-salzburg","download_url":"https://codeload.github.com/iot-salzburg/gpu-jupyter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254292042,"owners_count":22046426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","environment","gpu-acceleration","gpu-computing","jupyter","jupyter-server","jupyterlab","pytorch","reproducible-research","tensorflow"],"created_at":"2024-08-01T15:03:55.011Z","updated_at":"2025-05-15T07:06:45.217Z","avatar_url":"https://github.com/iot-salzburg.png","language":"Jupyter Notebook","funding_links":["https://github.com/sponsors/ChristophSchranz","https://patreon.com/chris_schranz"],"categories":["Jupyter Notebook","Notebook Environments","Notebook环境"],"sub_categories":[],"readme":"# GPU-Jupyter\n\n\u003cimg src=\"https://raw.githubusercontent.com/iot-salzburg/gpu-jupyter/master/extra/logo_gupyter.png\"\n     alt=\"GPU-Jupyter\"\n     width=661/\u003e\n\n#### GPU-Jupyter: Your GPU-accelerated JupyterLab with a rich data science toolstack, TensorFlow, and PyTorch for your reproducible deep learning experiments.\n\n![Github Workflow](https://github.com/iot-salzburg/gpu-jupyter/actions/workflows/default.yml/badge.svg)\n[![Docker Pulls](https://badgen.net/docker/pulls/cschranz/gpu-jupyter?icon=docker\u0026label=Pulls)](https://hub.docker.com/r/cschranz/gpu-jupyter)\n[![Docker Stars](https://badgen.net/docker/stars/cschranz/gpu-jupyter?icon=docker\u0026label=Stars)](https://hub.docker.com/r/cschranz/gpu-jupyter)\n[![GitHub stars](https://badgen.net/github/stars/iot-salzburg/gpu-jupyter/)](https://GitHub.com/iot-salzburg/gpu-jupyter/network/)\n[![GitHub forks](https://badgen.net/github/forks/iot-salzburg/gpu-jupyter/)](https://GitHub.com/iot-salzburg/gpu-jupyter/stargazers/)\n[![GitHub pull-requests closed](https://badgen.net/github/closed-prs/iot-salzburg/gpu-jupyter)](https://github.com/iot-salzburg/gpu-jupyter/pulls?q=is%3Aclosed)\n[![GitHub commits](https://badgen.net/github/commits/iot-salzburg/gpu-jupyter)](https://GitHub.com/iot-salzburg/gpu-jupyter/commit/)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/iot-salzburg/gpu-jupyter/graphs/commit-activity)\n\n![Jupyterlab Overview](https://raw.githubusercontent.com/iot-salzburg/gpu-jupyter/master/extra/jupyterlab-overview.png)\n\nWelcome to this project, which provides a **GPU-capable environment** based on NVIDIA's CUDA Docker image and the popular [Jupyter's Docker Stacks](https://github.com/jupyter/docker-stacks).\nOur toolstack enables GPU calculations in Jupyter notebooks, while the use of containers and versioned tags ensures the reproducibility of experiments.\nBy utilizing version control for the source code, tagged data spaces, seeds for the random functions, and tagged environments as provided here, our solution **empowers researchers to conduct highly complex big data experiments that are fully reproducible and sharable**.\n\nPlease find an example of how to **use GPU-Jupyter to make your deep learning research reproducible with one single command on [github.com/iot-salzburg/reproducible-research-with-gpu-jupyter](https://github.com/iot-salzburg/reproducible-research-with-gpu-jupyter)**.\n\nThe images of this repository are available on [Dockerhub](https://hub.docker.com/r/cschranz/gpu-jupyter).\nA big thank you to [Jupyter's Docker Stacks](https://github.com/jupyter/docker-stacks)\nfor creating and maintaining a robust Python, R, and Julia toolstack for Data Science.\n\n\n## Contents\n\n1. [Quickstart](#quickstart)\n2. [Build Your image](#build-your-image)\n3. [Tracing](#tracing)\n4. [Configuration](#configuration)\n6. [Issues and Contributing](#issues-and-contributing)\n\n\n\n## Quickstart\n\n1.  Ensure that you have access to a computer with an NVIDIA GPU. If you don’t have your own setup, you can try [Saturn Cloud](https://saturncloud.io/?utm_source=Github+\u0026utm_Github=TDS\u0026utm_campaign=ChristophSchranz\u0026utm_term=GPUJupyter) for a free GPU-powered Jupyter solution.\n2.  Install [Docker](https://www.docker.com/community-edition#/download) version **1.10.0+**\n and [Docker Compose](https://docs.docker.com/compose/install/) version **1.28.0+**.\n3.  Get access to your GPU via CUDA drivers within Docker containers. For this, follow the installation steps in this\n[Medium article](https://medium.com/@christoph.schranz/set-up-your-own-gpu-based-jupyterlab-e0d45fcacf43). You can confirm that you can access your GPU within Docker if the command below returns a result similar to this one:\n    ```bash\n    docker run --rm --gpus all nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 nvidia-smi\n    ```\n    ```bash\n    Fri Feb 28 13:13:06 2025\n    +-----------------------------------------------------------------------------------------+\n    | NVIDIA-SMI 560.35.04              Driver Version: 561.17         CUDA Version: 12.6     |\n    |-----------------------------------------+------------------------+----------------------+\n    | GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |\n    | Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |\n    |                                         |                        |               MIG M. |\n    |=========================================+========================+======================|\n    |   0  NVIDIA GeForce RTX 3060 ...    On  |   00000000:01:00.0  On |                  N/A |\n    | N/A   46C    P8             11W /   60W |     223MiB /   6144MiB |     15%      Default |\n    |                                         |                        |                  N/A |\n    +-----------------------------------------+------------------------+----------------------+\n\n    +-----------------------------------------------------------------------------------------+\n    | Processes:                                                                              |\n    |  GPU   GI   CI        PID   Type   Process name                              GPU Memory |\n    |        ID   ID                                                               Usage      |\n    |=========================================================================================|\n    |  No running processes found                                                             |\n    +-----------------------------------------------------------------------------------------+\n    ```\n    **It is important to keep your installed CUDA version in mind when you pull images.\n    Note that you can't run images based on `nvidia/cuda:11.2` if you have only CUDA version 10.1 installed, use `nvcc --version` to get the correct cuda version. Additionally, a NVIDIA driver version of at least 520 is suggested, as the images are built and tested using this and later versions.**\n\n4. Pull and run the GPU-Jupyter image. This may take some time as the whole environment for data science will be downloaded:\n   ```bash\n   cd your-working-directory\n   ll data  # this path will be mounted by default\n   docker run --gpus all -d -it -p 8848:8888 -v $(pwd)/data:/home/jovyan/work -e GRANT_SUDO=yes -e JUPYTER_ENABLE_LAB=yes --user root cschranz/gpu-jupyter:v1.9_cuda-12.6_ubuntu-24.04\n   ```\n   This starts an instance of *GPU-Jupyter* with the tag `v1.9_cuda-12.6_ubuntu-24.04` at [http://localhost:8848](http://localhost:8848) (port `8848`).\n   To log into Jupyterlab, you have to specify a token that you get from:\n   ```bash\n   docker exec -it [container-ID/name] jupyter server list\n   # [JupyterServerListApp] Currently running servers:\n   # [JupyterServerListApp] http://791003a731e1:8888/?token=5b96bb15be315ccb24643ea368a52cc0ba13657fbc29e409 :: /home/jovyan\n   ```\n   You can optionally set a password in [http://localhost:8848/login](http://localhost:8848/login) or as described [below](#change-the-password) (former default password `gpu-jupyter`).\nAdditionally, data within the host's `data` directory is shared with the container.\n\n    The following images of GPU-Jupyter are available on [Dockerhub](https://hub.docker.com/r/cschranz/gpu-jupyter):\n     - `v1.9_cuda-12.6_ubuntu-24.04` (full image)\n     - `v1.9_cuda-12.6_ubuntu-24.04_python-only` (only with a python interpreter and without Julia and R)\n     - `v1.9_cuda-12.6_ubuntu-24.04_slim` (only with a python interpreter and without additional packages)\n     - `v1.8_cuda-12.5_ubuntu-22.04` (full image)\n     - `v1.8_cuda-12.5_ubuntu-22.04_python-only` (only with a python interpreter and without Julia and R)\n     - `v1.8_cuda-12.5_ubuntu-22.04_slim` (only with a python interpreter and without additional packages)\n     - `v1.7_cuda-12.3_ubuntu-22.04` (full image)\n     - `v1.7_cuda-12.3_ubuntu-22.04_python-only` (only with a python interpreter and without Julia and R)\n     - `v1.7_cuda-12.3_ubuntu-22.04_slim` (only with a python interpreter and without additional packages)\n     - `v1.6_cuda-12.0_ubuntu-22.04` (full image)\n     - `v1.6_cuda-12.0_ubuntu-22.04_python-only` (only with a python interpreter and without Julia and R)\n     - `v1.6_cuda-12.0_ubuntu-22.04_slim` (only with a python interpreter and without additional packages)\n     - `v1.6_cuda-11.8_ubuntu-22.04` (full image)\n     - `v1.6_cuda-11.8_ubuntu-22.04_python-only` (only with a python interpreter and without Julia and R)\n     - `v1.6_cuda-11.8_ubuntu-22.04_slim` (only with a python interpreter and without additional packages)\n\n    \u003cdetails\u003e\n    \u003csummary\u003e\u003cfont color=blue\u003e Older images\u003c/font\u003e\u003c/summary\u003e\n\n    - `v1.5_cuda-12.0_ubuntu-22.04` (full image)\n    - `v1.5_cuda-12.0_ubuntu-22.04_python-only` (only with a python interpreter and without Julia and R)\n    - `v1.5_cuda-12.0_ubuntu-22.04_slim` (only with a python interpreter and without additional packages)\n    - `v1.5_cuda-11.8_ubuntu-22.04` (full image)\n    - `v1.5_cuda-11.8_ubuntu-22.04_python-only` (only with a python interpreter and without Julia and R)\n    - `v1.5_cuda-11.8_ubuntu-22.04_slim` (only with a python interpreter and without additional packages)\n    - `v1.5_cuda-11.6_ubuntu-20.04` (full image)\n    - `v1.5_cuda-11.6_ubuntu-20.04_python-only` (only with a python interpreter and without Julia and R)\n    - `v1.5_cuda-11.6_ubuntu-20.04_slim` (only with a python interpreter and without additional packages)\n    - `v1.4_cuda-11.6_ubuntu-20.04` (full image)\n    - `v1.4_cuda-11.6_ubuntu-20.04_python-only` (only with a python interpreter and without Julia and R)\n    - `v1.4_cuda-11.6_ubuntu-20.04_slim` (only with a python interpreter and without additional packages)\n    - `v1.4_cuda-11.2_ubuntu-20.04` (full image)\n    - `v1.4_cuda-11.2_ubuntu-20.04_python-only` (only with a python interpreter and without Julia and R)\n    - `v1.4_cuda-11.2_ubuntu-20.04_slim` (only with a python interpreter and without additional packages)\n    - `v1.4_cuda-11.0_ubuntu-20.04` (full image)\n    - `v1.4_cuda-11.0_ubuntu-20.04_python-only` (only with a python interpreter and without Julia and R)\n    - `v1.4_cuda-11.0_ubuntu-20.04_slim` (only with a python interpreter and without additional packages)\n    - `v1.4_cuda-11.0_ubuntu-18.04` (full image)\n    - `v1.4_cuda-11.0_ubuntu-18.04_python-only` (only with a python interpreter and without Julia and R)\n    - `v1.4_cuda-11.0_ubuntu-18.04_slim` (only with a python interpreter and without additional packages)\n    - `v1.4_cuda-10.1_ubuntu-18.04` (full image)\n    - `v1.4_cuda-10.1_ubuntu-18.04_python-only` (only with a python interpreter and without Julia and R)\n    - `v1.4_cuda-10.1_ubuntu-18.04_slim` (only with a python interpreter and without additional packages)\n    \u003c/details\u003e\n\n   The version, e.g. `v1.9`, declares the version of the generator setup.\n   The Cuda version, e.g. `cuda-12.6`, must match the CUDA driver version and be supported by the GPU libraries.\n   These and older versions of GPU-Jupyter are listed on [Dockerhub](https://hub.docker.com/r/cschranz/gpu-jupyter/tags?page=1\u0026ordering=last_updated).\n   In case you are using another version or the GPU libraries don't work on your hardware, please try to build the image on your own as described below.\n   Note that the images built for Ubuntu 20.04 LTS or Ubuntu 22.04 LTS work also on Ubuntu 24.04 LTS.\n\nWithin the Jupyterlab UI, ensure you can access your GPU by opening a new Terminal window and running `nvidia-smi`.\nHere, you can also install additional packages on top of the built image.\nTo help you get started with using the GPU, the repository includes some sample code located in `extra/Getting_Started`.\nIf you're new to JupyterLab or want to learn more about its features,\nwe recommend checking out this [Jupyter Tutorial](https://www.youtube.com/watch?v=A5YyoCKxEOU).\n\n\n## Build Your Image\n\nBuilding a custom Docker image is the recommended option if you have a different GPU architecture or if you want to customize the pre-installed packages. The Dockerfiles in `custom/`  can be modified to achieve this. To use a custom base image, modify `custom/header.Dockerfile`. To install specific GPU-related libraries, modify `custom/gpulibs.Dockerfile`, and to add specific libraries, append them to `custom/usefulpackages.Dockerfile`. Moreover, this offers the option for a **static token** or password which does not change with a container's restart.\n\nAfter making the necessary modifications, regenerate the `Dockerfile` in `/.build`. Once you have confirmed that your GPU is accessible within Docker containers by running `docker run --rm --gpus all nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 nvidia-sm` and seeing the GPU statistics, you can generate, build, and run the Docker image.\n\nThe following commands will start *GPU-Jupyter* on [localhost:8848](http://localhost:8848) with the default password `gpu-jupyter`.\n\n```bash\ngit clone https://github.com/iot-salzburg/gpu-jupyter.git\ncd gpu-jupyter\ngit branch  # Check for extisting branches\ngit checkout v1.9_cuda-12.6_ubuntu-24.04  # select or create a new version\n# generate the Dockerfile with python and without Julia and R (see options: --help)\n./generate-Dockerfile.sh --python-only\ndocker build -t gpu-jupyter .build/  # will take a while\ndocker run --gpus all -d -it -p 8848:8888 -v $(pwd)/data:/home/jovyan/work -e GRANT_SUDO=yes -e JUPYTER_ENABLE_LAB=yes -e NB_UID=\"$(id -u)\" -e NB_GID=\"$(id -g)\" --user root --restart always --name gpu-jupyter_1 gpu-jupyter\n```\n\nThis command starts a container with GPU support and a shared local data volume `/data`, along with other necessary configurations, such as root permissions to install packages within the container. For more configuration options, see [Configuration of the Dockerfile-Generation](#configuration-of-the-dockerfile-generation) below.\n\n\n\n### Start via Docker Compose\n\nTo start *GPU-Jupyter* using `docker-compose.yml`, run the following command:\n\n```bash\ndocker-compose up --build -d  # build and run in detached mode\ndocker-compose ps  # check if was successful\ndocker-compose logs -f  # view the logs\ndocker-compose down  # stop the container\n```\n\nThis step requires a `docker-compose` version of at least `1.28.0`,\nas the Dockerfile requests GPU resources (see this [changelog](https://docs.docker.com/compose/release-notes/#1280)).\nTo update `docker-compose`, this [discussion](https://stackoverflow.com/a/50454860) may be useful.\n\n\n## Tracing\n\nWith these commands we can investigate the container:\n\n```bash\ndocker ps  # use the flat '-a' to view all\ndocker stats\ndocker logs [service-name | UID] -f  # view the logs\ndocker exec -it [service-name | UID] bash  # open bash in the container\n```\n\nTo stop the local deployment, run:\n\n  ```bash\ndocker rm -f [service-name | UID]  # or\n```\n\n\n## Configuration\n\n### Configuration of the Dockerfile-Generation\n\nTo generate a Dockerfile for *GPU-Jupyter*, you can use the script `generate-Dockerfile.sh`. It generates a Dockerfile in the `.build/` directory, which is overwritten with each new generation and entries within this directory should not be modified manually.\n\nThe script has the following parameters:\n\n\n* `-h|--help`: Show a help message.\n\n* `-p|--pw|--password`: Set the password for *GPU-Jupyter* by updating\n the salted hashed token in `custom/jupyter_notebook_config.json`.\n\n* `-c|--commit`: specify a commit or `\"latest\"` for the `Jupyter's Docker Stacks`,\nthe default commit is a working one.\n\n* `-s|--slim`: Generate a slim Dockerfile.\nAs some installations are not needed by everyone, there is the possibility to skip some\ninstallations to reduce the size of the image.\nHere the `scipy-notebook` is used instead of `datascience-notebook`\nthat comes with Julia and R, see [Jupyter's Docker Stacks](https://github.com/jupyter/docker-stacks).\nMoreover, none of the packages within `custom/usefulpackages.Dockerfile` is installed.\n\n* `--python-only|--no-datascience-notebook`: As the name suggests, the `datascience-notebook`\nis not installed on top of the `scipy-notebook`, but the packages within `custom/usefulpackages.Dockerfile` are.\n\n* `--no-useful-packages`: On top of the `datascience-notebook` (Julia and R),\nthe essential `gpulibs` are installed, but not the packages within `custom/usefulpackages.Dockerfile`.\n\nNote that only one of the parameters `--slim`, `--python-only`, and `--no-useful-packages` can be used at the same time:\n\n\n### Custom Installations\n\nIf you need to install custom packages within the container, you can modify the `custom/usefulpackages.Dockerfile` file or do it directly within the container.\n**Keep in mind that every time a Dockerfile is generated, the file `.build/Dockerfile` is overwritten, so it's best to append custom installations in `custom/usefulpackages.Dockerfile` or `generate-Dockerfile.sh`.**\n\nSome useful packages are suggested in the [Extension docs](https://jupyterlab.readthedocs.io/en/stable/user/extensions.html) and in this blog article from [neptune.ai](https://neptune.ai/blog/jupyterlab-extensions-for-machine-learning).\nIf you notice that an important package is missing in the default stack, please let us know so we can update it.\n\n\n### Authorization\n\n#### Set a Static Token\n\nJupyter by default regenerates a new token on each new start.\nGPU-Jupyter provides the environment variable `JUPYTER_TOKEN` to set a customized static token.\nThis option is practicable if the host machine is periodically restartet.\nIt is suggested to use a long token such as a UUID:\n\n```bash\nexport JUPYTER_TOKEN=$(uuidgen)\necho $JUPYTER_TOKEN\n```\n\n - For Docker add the parameter `-e JUPYTER_TOKEN=${JUPYTER_TOKEN}`, e.g.:\n\n    ```bash\n    docker run --gpus all -d -it -p 8848:8888 -v $(pwd)/data:/home/jovyan/work -e GRANT_SUDO=yes -e JUPYTER_ENABLE_LAB=yes -e NB_UID=\"$(id -u)\" -e NB_GID=\"$(id -g)\" -e JUPYTER_TOKEN=${JUPYTER_TOKEN} --user root --restart always --name gpu-jupyter_1 gpu-jupyter\n    ```\n\n- In `docker-compose.yml`, the environment variable can be set under\n `ENVIRONMENT`:\n\n    `JUPYTER_TOKEN: ${JUPYTER_TOKEN}`\n\n    Please note that environment variables might not be accessable for all docker-compose versions. Consider to setting `JUPYTER_TOKEN` in a separate `.env`-file and using `env_file` in docker-compose or a hard-coded token.\n\nThe static token can be requested using `docker exec`:\n```bash\ndocker exec -it gpu-jupyter_1 jupyter server list\n```\n\n\n#### Set a custom Password\n\nThere are two ways to set a password for GPU-Jupyter:\n\n1. Go to the login page ([http://192.168.48.48:8848/login](http://localhost:8848/login)) when logged out and setup a Password in the corresponding field.\n\n2. Use the `--password` or `--pw` option in the generate-Dockerfile.sh script to specify your desired password, like so:\n\n    ```bash\n    bash generate-Dockerfile.sh --password [your_password]\n    ```\n    This will update automatically the salted hashed token in the `.build/jupyter_notebook_config.json` file. Note that the specified password may be visible in your account's bash history.\n\n\n### Adaptions for using Tensorboard\n\nBoth TensorFlow and PyTorch support [tensorboard](https://www.tensorflow.org/tensorboard/get_started).\nThis packages is already installed in the GPU-packages and can be used with these settings:\n\n1. Forward the port in the docker command using `-p 6006:6006` (only for usage outside of Juypterlab).\n2. Starting tensorboad with port binding within a container or Jupyterlab UI. Make sure the parameter `--bind_all` is set.\n\n    ```bash\n    docker exec -it [container-name/ID] bash\n    root@749eb1a06d60:~# tensorboard --logdir mylogdir --bind_all\n    ```\n    ```jupyter\n    %tensorboard --logdir logs/[logdir] --bind_all\n    ```\n\n4. Writing the states and results in the tensorboard log-dir, as described in the tutorials for [TensorFlow](https://www.tensorflow.org/tensorboard/get_started) and [PyTorch](https://pytorch.org/tutorials/recipes/recipes/tensorboard_with_pytorch.html) or in the Getting Started section `data/Getting_Started`.\nIf the port is exposed, tensorboard can be accessed in the browser on [localhost:6006](http://localhost:6006).\n\n\n### Updates\n\n#### Update CUDA to another version\n\nThe GPU-libraries such as PyTorch and Tensorflow in `custom/Docker.gpulibs` must support the CUDA version and NVIDIA drivers on the host machine. Check out the compatibility lists for [PyTorch](https://pytorch.org/get-started/locally/) and [Tensorflow](https://www.tensorflow.org/install/source#gpu) or search online for the explicit versions. In this setup, the NVIDIA Driver has version 560.35.04 and CUDA version 12.6.3 is used, which is compatible with Tensorflow 2.18 and PyTorch 2.6.\n\nThe host's CUDA version must be equal to or higher than that used by the container (set within `custom/header.Dockerfile`).\nCheck the host's version with `nvcc --version` and the version compatibilities\nfor CUDA-dependent packages as [Pytorch](https://pytorch.org/get-started/locally/)\n respectively [Tensorflow](https://www.tensorflow.org/install/gpu) previously.\nThen modify, if supported, the CUDA-version (find all tags [here](https://hub.docker.com/r/nvidia/cuda/tags))\nin `custom/header.Dockerfile` to, e.g.:\nthe line:\n\n    FROM nvidia/cuda:X.Y-base-ubuntu24.04\n\nThen re-generate, re-build and run the updated image.\nNote that a change in the first line of the Dockerfile will re-build the whole image.\n\n```bash\n./generate-Dockerfile.sh --slim  # generate the Dockerfile with only a python interpreter, --python-only is default\ndocker build -t gpu-jupyter .build/  # will take a while\ndocker run --gpus all -d -it -p 8848:8888 -v $(pwd)/data:/home/jovyan/work -e GRANT_SUDO=yes -e JUPYTER_ENABLE_LAB=yes -e NB_UID=\"$(id -u)\" -e NB_GID=\"$(id -g)\" --user root --restart always --name gpu-jupyter_1 gpu-jupyter\n```\n\n\n#### Upgrade / Downgrade the Jupyter's Docker Stacks\n\nThe [Jupyter's Docker Stacks](https://github.com/jupyter/docker-stacks) is used as a submodule within `.build/docker-stacks`. Per default, the head of the commit is reset to a commit on which `gpu-jupyter` runs stable.\nTo set the docker-stacks to a specific version generate the Dockerfile with a specific [docker-stacks commit](https://github.com/jupyter/docker-stacks/commits/main), run:\n\n```bash\n./generate-Dockerfile.sh --commit c1c32938438151c7e2a22b5aa338caba2ec01da2\n```\n\nTo update the generated Dockerfile to the latest commit, run:\n\n```bash\n./generate-Dockerfile.sh --commit latest\n```\n\nA new build can last some time and may consume a lot of data traffic. Note, that untested versions often result in\na version conflict, as some files have to be adapted. Here are some examples of solutions:\n\n- **Some file is not found:**\n    ```\n    Step 22/64 : COPY --chown=\"${NB_UID}:${NB_GID}\" initial-condarc \"${CONDA_DIR}/.condarc\"\n  COPY failed: file not found in build context or excluded by .dockerignore: stat initial-condarc: file does not exist\n  ```\n  \u0026rarr; Adapt `generate-Dockerfile.sh` so that it copies `initial-condarc` into the working directory as it does with other files. Renamed files result in a similar issue and solution.\n\n- **The specified package version is not compatible with the drivers.**\n    ```\n    Step 56/64 : RUN pip install --upgrade pip \u0026\u0026     pip install --no-cache-dir \"tensorflow==2.6.2\" \u0026\u0026     pip install --no-cache-dir keras\n     ---\u003e Running in 7c5701a3d780\n    Requirement already satisfied: pip in /opt/conda/lib/python3.10/site-packages (22.1.2)\n    ERROR: Could not find a version that satisfies the requirement tensorflow==2.6.2 (from versions: 2.8.0rc0, 2.8.0rc1, 2.8.0, 2.8.1, 2.8.2, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2, 2.9.0, 2.9.1)\n    ERROR: No matching distribution found for tensorflow==2.6.2\n    ```\n\n    \u0026rarr; Just update the package to a version that is compatible, here tensorflow 2.8.2 was.\n\n- **Branch `master` is not known:**\n    ```\n    error: pathspec 'master' did not match any file(s) known to git.\n    ```\n    \u0026rarr; The default branch of [Jupyter's Docker Stacks](https://github.com/jupyter/docker-stacks) were\n    renamed from `master` to `main`. Delete the subdirectory `.build/docker-stacks` and regenerate the the Dockerfile.\n    General information on submodules can be found in\n    [this tutorial](https://www.vogella.com/tutorials/GitSubmodules/article.html).\n\n\n\n### Configure a shared Docker network\n\nAdditionally, *GPU-Jupyter* is connected to the data source via the same *docker-network*. Therefore, This network must be set to **attachable** in the source's `docker-compose.yml`:\n\n```yml\nservices:\n  data-source-service:\n  ...\n      networks:\n      - default\n      - datastack\n  ...\nnetworks:\n  datastack:\n    driver: overlay\n    attachable: true\n```\n In this example, the docker network has the name **datastack** as defined within the `docker-compose.yml` file and is configured to be attachable.\n\n\n## Issues and Contributing\n\n### Frequent Issues:\n\n- **Can't execute the bash scripts.**\n    ```bash\n    $ bash generate-Dockerfile.sh\n    generate-Dockerfile.sh: line 2: cd: $'/path/to/gpu-jupyter\\r': No such file or directory\n    generate-Dockerfile.sh: line 3: $'\\r': command not found\n    generate-Dockerfile.sh: line 9: $'\\r': command not found\n    generate-Dockerfile.sh: line 11: syntax error near unexpected token `$'in\\r''\n    generate-Dockerfile.sh: line 11: `while [[ \"$#\" -gt 0 ]]; do case $1 in\n    ```\n    The reason for this issue is that the line breaks between Unix and Windows-based systems are different and in the current version different.\n\n    **Solution**: Change the line endings of the bash scripts. This can be done e.g. in the *Notepad++* under\n    *Edit* - *EOL Conversion*, or using `dos2unix`\n    ```bash\n    sudo apt install dos2unix\n    dos2unix generate-Dockerfile.sh\n    ```\n\n- **No GPU available - error**\n    The docker-compose start breaks with:\n    ```bash\n    ERROR: for fc8d8dfbebe9_gpu-jupyter_gpu-jupyter_1  Cannot start service gpu-jupyter: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:459: container init ca\n    used: Running hook #0:: error running hook: exit status 1, stdout: , stderr: nvidia-container-cli: initialization error: driver error: failed to process request: unknown\n    ```\n    **Solution**:\n    Check if the GPU is available on the host node via `nvidia-smi` and run with the described `docker`-commands.\n    If the error still occurs, so try there could be an issue that docker can't use the GPU. Please try [this](https://cschranz.medium.com/set-up-your-own-gpu-based-jupyterlab-e0d45fcacf43) or similar tutorials on how to install the required drivers.\n\n### Contribution\n\nThis project has the intention to create a robust image for CUDA-based GPU applications,\nwhich is built on top of the official NVIDIA CUDA Docker image and [Jupyter's Docker Stacks](https://github.com/jupyter/docker-stacks).\nPlease help us to improve this project, by:\n\n* [filing a new issue](https://github.com/iot-salzburg/gpu-jupyter/issues/new)\n* [open a pull request](https://help.github.com/articles/using-pull-requests/)\n\n\n## Cite This Work\n\nPlease cite the GPU-Jupyter framework in your publication when you are using GPU-Jupyter for your academic work:\n\n```\nSchranz, C., Pilosov, M., Beeking, M. (2025).\nGPU-Jupyter: A Framework for Reproducible Deep Learning Research.\n[Manuscript submitted for publication] In Interdisciplinary Data Science Conference.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiot-salzburg%2Fgpu-jupyter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiot-salzburg%2Fgpu-jupyter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiot-salzburg%2Fgpu-jupyter/lists"}