Skip to content

Latest commit

 

History

History
157 lines (120 loc) · 5.77 KB

README.md

File metadata and controls

157 lines (120 loc) · 5.77 KB

SIRF Docker image

The image contains SIRF & all dependencies required by Jupyter.

Usage

  1. Install the latest docker version
  2. (optional) For GPU support (NVIDIA CUDA on Linux or Windows Subsystem for Linux 2 only)
# CPU version
docker run --rm -it -p 9999:8888 ghcr.io/synerbi/sirf:latest
# GPU version
docker run --rm -it -p 9999:8888 --gpus all ghcr.io/synerbi/sirf:latest-gpu

Tip

docker tag git branch/tag
latest, latest-gpu latest tag v*.*.*
M, M.m, M.m.p, M-gpu, M.m-gpu, M.m.p-gpu tag vM.m.p
edge, edge-gpu master

See ghcr.io/synerbi/sirf for a full list of tags.

The docker.yml workflow builds & pushes all the docker tags above. Additionally, core & core-gpu intermediate (cache) docker tags are built & pushed by the workflow, but are not intended for users.

The workflow will also build & test all PRs (without pushing any new image tags).

The Jupyter notebook should be accessible at http://localhost:9999. Jupyter password is virtual.

Warning

To sync the container user & host user permissions (useful when sharing folders), use --user and --group-add.

docker run --rm -it -p 9999:8888 --user jovyan:$(id -g) --group-add users \
  -v ./devel:/home/jovyan/work \
  ghcr.io/synerbi/sirf:latest

More config: https://jupyter-docker-stacks.readthedocs.io/en/latest/using/common.html#user-related-configurations.

Tip

To pass arguments to SIRF-Exercises/scripts/download_data.sh, use the docker environment variable SIRF_DOWNLOAD_DATA_ARGS.

docker run --rm -it -p 9999:8888 --user jovyan:$(id -g) --group-add users \
  -v /mnt/data:/share -e SIRF_DOWNLOAD_DATA_ARGS="-pm -D /share" \
  ghcr.io/synerbi/sirf:latest

Extending

You can build custom images on top of the SIRF ones, likely needing to switch between root and default user to install packages:

# CPU version
# FROM synerbi/sirf:latest
# GPU version
FROM synerbi/sirf:latest-gpu
USER root
RUN mamba install pytorch && fix-permissions "${CONDA_DIR}" /home/${NB_USER}
USER ${NB_UID}

Build

To build and/or run with advanced config, it's recommended to use Docker Compose.

We use an Ubuntu 24.04 base image (optionally with CUDA GPU support for CIL GPU features), build https://github.com/jupyter/docker-stacks scipy-notebook on top, and then install SIRF & its depdendencies.

The strategy is:

  1. Use either ubuntu:latest or a recent Ubuntu CuDNN runtime image from https://hub.docker.com/r/nvidia/cuda as base
  2. Build https://github.com/jupyter/docker-stacks/tree/main/images/scipy-notebook on top
  3. Copy & run the SIRF docker/build_*.sh scripts
  4. Clone the SIRF-SuperBuild & run cmake
  5. Copy some example notebooks & startup scripts

Docker Compose

All of this is done by compose.sh.

  1. Install the latest docker version

  2. Clone this repository and run the docker/compose.sh script

    git clone https://github.com/SyneRBI/SIRF-SuperBuild
    cd SIRF-SuperBuild
    docker/compose.sh -h  # prints help

Tip

For example, to -build the -development (master) branches of SIRF and its dependencies, including -gpu support and skipping tests:

docker/compose.sh -bdg -- --build-arg RUN_CTEST=0

Then to -run the container:

docker/compose.sh -rdg

More info

Tip

docker/compose.sh -h # prints help

Useful --build-args

CMake build arguments (e.g. for dependency version config) are (in increasing order of precedence) found in:

Useful --build-args:

You can determine which version of the SIRF-SuperBuild is built in the docker image:

docker/compose.sh -b -- --build-arg SIRF_SB_TAG=<git ref>

By default, the CTests are run while building the docker image. Note that this takes a few minutes. You can switch this off by setting --build-arg RUN_CTEST=0 before building the image.

docker-stacks

https://github.com/jupyter/docker-stacks is used to gradually build up images:

  • BASE_IMAGE=nvidia/cuda:11.7.1-cudnn8-devel-ubuntu22.04
  • docker-stacks-foundation -> synerbi/jupyter:foundation
  • base-notebook -> synerbi/jupyter:base
  • minimal-notebook -> synerbi/jupyter:minimal
  • scipy-notebook -> synerbi/jupyter:scipy
  • Dockerfile -> synerbi/jupyter:sirf

Note

synerbi/jupyter:* are only intermediate (cache) images not intended for users.