[OMEGA-407] Enable GPU passthrough support in Omega Docker image - #343
paul-v-snet wants to merge 5 commits into
Conversation
|
I've converted the PR to draft since it appears that the issue is not fixed by this PR on native Linux systems. |
|
Hi, -- thanks! How NuNet does GPU passthrough to Docker containers on native LinuxFor reference, since NuNet's Device Management Service (DMS) runs GPU workloads in Docker on native Linux in production. Short version: for NVIDIA, NuNet writes no passthrough code of its own. It adds no 1. Host prerequisite: driver + NVIDIA Container Toolkit, registered with DockerFor a hand-built host, the DMS README lists it as a manual step: README.md L457-L463 (driver, then Container Toolkit, then reboot). NuNet GPU appliances automate the same step in cloud-init. This is what runs on a NuNet GPU host (Ubuntu 24.04); the provisioning input is not in a public repo, so it is quoted rather than linked: packages:
- nvidia-driver-550-server
runcmd:
# ... docker-ce installed first ...
- install -d -m 0755 /usr/share/keyrings
- bash -lc 'curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg'
- bash -lc 'arch=$(dpkg --print-architecture); echo "deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://nvidia.github.io/libnvidia-container/stable/deb/${arch} /" > /etc/apt/sources.list.d/nvidia-container-toolkit.list'
- apt-get update
- DEBIAN_FRONTEND=noninteractive apt-get install -y nvidia-container-toolkit
- nvidia-ctk runtime configure --runtime=docker --cdi.enabled=true
- systemctl restart dockerDetails that matter:
2. The container request: one
|
| # Existing files here may be written and truncated, but not created or removed. | ||
| # The CUDA driver names its threads via /proc/self/task/<tid>/comm. | ||
| read_write_files: | ||
| - /proc |
There was a problem hiding this comment.
@paul-v-snet was you intention keeping minimal required permissions for /proc access? While I totally agree with such intention I would suggest do not introduce the new categories when existing category (read_write) doesn't impose know security risk. The original intention behind this configuration was to keep policy.yaml compatible with OpenShell format. In OpenShell I believe one should replace both device_access and read_write_files by read_write category. But if it is not flexible enough (I mean there is security risk in using them) then I would suggest moving to the most flexible one, to the something which allows describing policy in detail (for example see https://github.com/landlock-lsm/landlockconfig).
I would suggest adding IOCTL_DEV into READ_WRITE_FILE_ACCESS permission set and move devices under read_write.
Description
The reason the agent cannot access the GPU is that the Landlock filesystem policy does not include the required NVIDIA driver and device paths. As a result, the main agent process cannot access the GPU, and its child processes cannot access it either because they inherit the same Landlock restrictions.
To fix the issue, it is sufficient to add the required paths to
policy.yamland implement a mechanism for adding them dynamically. The set of required paths may differ depending on the system and configuration. At the same time, if a path specified in the policy does not exist on the current system, Landlock cannot apply the policy and returns an error.Therefore, all potentially required NVIDIA paths were added to
policy.yaml, but before applying the policy, theapplymethod collects only the NVIDIA driver and device paths that actually exist on the current system and applies the policy using that set.This should support different GPU configurations, including multiple GPUs exposed to the Docker container, as well as different environments such as native Linux and WSL.
How Has This Been Tested?
--device nvidia.com/gpu=allpassed to the container. Before the fix, the agent's ownnvidia-smi -Lshell call returnedFailed to initialize NVML: N/A, while a plaindocker exec ... nvidia-smi -Lon the same running container detected the GPU correctly.nvidia-smi -Linvoked by the agent from inside the container worked correctly, the agent gained access to the GPUs and was able to use them successfully.Checklist