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.
git clone https://github.com/abuccts/rocm-container-runtime
cd rocm-container-runtime
# you can edit rocm-container-runtime.conf for configurations
bash install.shNOTE: the runtime only works for Debian distributions currently, changes are needed for other Linux distributions.
-
Docker daemon configuration file
Add the following fields into
/etc/docker/daemon.jsonand 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"
# 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 rocminfoNOTE: To use AMD GPUs in Docker, please follow ROCm's document to install drivers first.