pai/contrib/rocm-container-runtime
Yifan Xiong d5987e1d30
Add ROCm container runtime (#4645)
Add ROCm container runtime.
2020-06-28 10:37:00 +08:00
..
README.md Add ROCm container runtime (#4645) 2020-06-28 10:37:00 +08:00
install.sh Add ROCm container runtime (#4645) 2020-06-28 10:37:00 +08:00
rocm-container-runtime Add ROCm container runtime (#4645) 2020-06-28 10:37:00 +08:00
rocm-container-runtime.conf Add ROCm container runtime (#4645) 2020-06-28 10:37:00 +08:00

README.md

ROCm Container Runtime

rocm-container-runtime is a wrapper for runc.

If environment variable AMD_VISIBLE_DEVICES is set in OCI config, the runtime will inject necessary fields into OCI config to use AMD GPUs in containers.

The runtime is the same as ROCm-docker on the host, but provides flexibility for AMD GPUs on Kubernetes.

The runtime achieves similar functionality to nvidia-container-runtime, but is for AMD GPUs on ROCm Platform.

Installation

git clone https://github.com/abuccts/rocm-container-runtime
cd rocm-container-runtime
# you can edit rocm-container-runtime.conf for configurations
bash install.sh

NOTE: the runtime only works for Debian distributions currently, changes are needed for other Linux distributions.

Docker Engine Setup

  • Docker daemon configuration file

    Add the following fields into /etc/docker/daemon.json and restart Docker service:

    {
      "runtimes": {
        "rocm": {
          "path": "/usr/bin/rocm-container-runtime",
          "runtimeArgs": []
        }
      }
    }
    

    You can optionally set it to default runtime in /etc/docker/daemon.json:

    "default-runtime": "rocm"
    

Docker Usage

# use 4 AMD GPUs
docker run --runtime=rocm -e AMD_VISIBLE_DEVICES=0,1,2,3 --security-opt seccomp=unconfined rocm/rocm-terminal rocminfo

# use the 3rd AMD GPU
docker run --runtime=rocm -e AMD_VISIBLE_DEVICES=2 --security-opt seccomp=unconfined rocm/rocm-terminal rocminfo

NOTE: To use AMD GPUs in Docker, please follow ROCm's document to install drivers first.