diff --git a/projects/amdsmi/README.md b/projects/amdsmi/README.md index cd9c306b41..065d1a5d5b 100644 --- a/projects/amdsmi/README.md +++ b/projects/amdsmi/README.md @@ -139,6 +139,21 @@ Check out [Getting to Know Your GPU: A Deep Dive into AMD SMI -- ROCm Blogs](https://rocm.blogs.amd.com/software-tools-optimization/amd-smi-overview/README.html) for a rundown. +### Docker container configuration + +To ensure proper functionality of AMD SMI within a Docker container, the +following configuration options must be included. These settings are +particularly important for managing memory partitions, as partitioning depends +on loading and unloading kernel drivers. + +- `--cap-add=SYS_MODULE` + +- `-v /lib/modules:/lib/modules` + +See [Using AMD SMI in a Docker +container](https://rocm.docs.amd.com/projects/amdsmi/en/latest/how-to/setup-docker-container.html) +for more information. + ## Building AMD SMI This section describes the prerequisites and steps to build AMD SMI from source. diff --git a/projects/amdsmi/docs/data/how-to/setup-docker-container/docker-run-example.jpg b/projects/amdsmi/docs/data/how-to/setup-docker-container/docker-run-example.jpg new file mode 100644 index 0000000000..1185283bd5 Binary files /dev/null and b/projects/amdsmi/docs/data/how-to/setup-docker-container/docker-run-example.jpg differ diff --git a/projects/amdsmi/docs/how-to/setup-docker-container.md b/projects/amdsmi/docs/how-to/setup-docker-container.md new file mode 100644 index 0000000000..bd9d2072b2 --- /dev/null +++ b/projects/amdsmi/docs/how-to/setup-docker-container.md @@ -0,0 +1,39 @@ +--- +myst: + html_meta: + "description lang=en": "Docker container configuration and setup procedures for AMD SMI." + "keywords": "api, smi, lib, system, management, interface, ROCm, docker, systemd, modprobe" +--- + +# Using AMD SMI in a Docker container + +To ensure proper functionality of AMD SMI within a Docker container, the +following configuration options must be included. These settings are +particularly important for managing memory partitions, as partitioning depends +on loading and unloading drivers (with `systemd` dependencies): + +* `--cap-add=SYS_MODULE` + + This option adds the `SYS_MODULE` capability to the container, allowing it to + load and interact with kernel modules. + + ```{note} + Granting `SYS_MODULE` increases the container's privileges and reduces + isolation from the host. Use this option only with trusted containers and + images. + ``` + +* `-v /lib/modules:/lib/modules` + + By mounting the `/lib/modules/` directory into the container, the container + gains access to the host's kernel modules, allowing it to load and interact + with them. Without this access, operations requiring module loading like + memory partitioning would fail. + +For example: + +```{image} ../data/how-to/setup-docker-container/docker-run-example.jpg +:alt: Command line example of running a Docker container for AMD SMI +:align: center +:width: 100% +``` diff --git a/projects/amdsmi/docs/index.md b/projects/amdsmi/docs/index.md index 3d002be3ae..2c828caa22 100644 --- a/projects/amdsmi/docs/index.md +++ b/projects/amdsmi/docs/index.md @@ -32,6 +32,7 @@ AMD SMI is the successor to . * [Python library usage](./how-to/amdsmi-py-lib.md) * [Go library usage](./how-to/amdsmi-go-lib.md) * [CLI tool usage](./how-to/amdsmi-cli-tool.md) +* [Use AMD SMI in a Docker container](./how-to/setup-docker-container.md) ::: :::{grid-item-card} Reference diff --git a/projects/amdsmi/docs/sphinx/_toc.yml.in b/projects/amdsmi/docs/sphinx/_toc.yml.in index 5c8ed2a316..5ef2a8a2d5 100644 --- a/projects/amdsmi/docs/sphinx/_toc.yml.in +++ b/projects/amdsmi/docs/sphinx/_toc.yml.in @@ -19,6 +19,8 @@ subtrees: title: Go library usage - file: how-to/amdsmi-cli-tool.md title: CLI tool usage + - file: how-to/setup-docker-container.md + title: Use AMD SMI in a Docker container - caption: Reference entries: