playbooks: run nvidia-smi tasks outside the ssh cgroup so they survive the login GPU guard - #1397
Open
100-JM wants to merge 2 commits into
Open
playbooks: run nvidia-smi tasks outside the ssh cgroup so they survive the login GPU guard#1397100-JM wants to merge 2 commits into
100-JM wants to merge 2 commits into
Conversation
…e the login GPU guard
With slurm_login_on_compute enabled, login-compute-setup restricts the ssh
service's cgroup to /dev/nvidiactl so interactive users cannot reach GPUs
outside a Slurm job. Ansible arrives over the same ssh service, so every
task that runs nvidia-smi afterwards is restricted too (the filter is
per-cgroup, become does not help):
nvidia-smi -> rc=6, "No devices were found"
nvidia-smi -acp UNRESTRICTED -> rc=6
nvidia-smi --query-gpu=mig.mode -> rc=0 with "No devices were found"
That breaks the second run slurm-single-node.md asks for ("reboot manually
when prompted and then run Ansible again"): gpu-clocks.yml and the
nvidia-cuda.yml driver test fail, and nvidia-mig.yml treats the
"No devices" text as a MIG-capable GPU because it only filtered 'N/A'.
Run those nvidia-smi invocations through
`systemd-run --wait --pipe --collect --quiet`. The command executes in a
transient unit under system.slice, outside the ssh cgroup, so the check
is still real instead of being skipped. Make the MIG probe accept only
Enabled/Disabled. nvidia-driver.yml has the same test; it is left alone
here to avoid conflicting with NVIDIA#1396 and can take the same wrapper after
that lands.
Verified on a DGX B300 (DGX OS 7.5.0, driver 580.126.20) with the guard
active: plain nvidia-smi in the ssh session returns rc=6, while
`sudo systemd-run --wait --pipe --collect --quiet nvidia-smi -L` lists all
eight GPUs with rc=0.
Signed-off-by: 백지명 <wlaud9805@gmail.com>
…-smi call sites The nvidia-mig-manager role repeats the MIG probe that nvidia-mig.yml runs, with the same 'grep -v N/A' filter, and utilities/nvidia-set-gpu-clocks.yml locks/resets clocks with plain nvidia-smi. Both run over the Ansible connection and hit the same ssh-cgroup device guard on slurm_login_on_compute nodes. Apply the same systemd-run wrapper, accept only Enabled/Disabled from the MIG probe, and make that probe become root explicitly since the rest of the role already requires it. Signed-off-by: 백지명 <wlaud9805@gmail.com>
100-JM
marked this pull request as ready for review
September 6, 2026 07:54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With
slurm_login_on_compute: true,roles/slurm/tasks/login-compute-setup.ymlsetsDeviceAllow=/dev/nvidiactlon the ssh service so users cannot touch GPUs outside a Slurm job. Ansible connects through that same ssh service, so its own processes land in the restricted cgroup (/system.slice/ssh.service) andbecomedoes not change that — the device filter is per cgroup, not per user. Every task that runsnvidia-smiafter the guard is applied therefore sees no GPUs:This breaks the second Ansible run that
docs/slurm-cluster/slurm-single-node.mdasks for ("reboot manually when prompted and then run Ansible again"):playbooks/utilities/gpu-clocks.yml—nvidia-smi -acp UNRESTRICTEDallow_user_set_gpu_clocks: yes)playbooks/nvidia-software/nvidia-cuda.yml—test nvidia-smislurm_cluster_install_cuda: yes)playbooks/nvidia-software/nvidia-mig.yml—… | grep -v 'N/A'No devices were found→ treated as a MIG-capable noderoles/nvidia-mig-manager/tasks/main.yml— same probe, same filterplaybooks/utilities/nvidia-set-gpu-clocks.yml—nvidia-smi -lgc/-rgcscripts/validation/validate_slurm.pyalready documents the phenomenon for the validator and usessrunas the authoritative test; the playbook tasks above were still running plainly over ssh.Observed on a DGX B300, DGX OS 7.5.0, driver 580.126.20, DeepOps master.
Fix
Run every one of those
nvidia-smiinvocations throughsystemd-run --wait --pipe --collect --quiet. The command executes in a transient unit undersystem.slice, outside the ssh cgroup, so the check still runs for real instead of being skipped. Both MIG probes (playbook and role) now accept onlyEnabled/Disabledand get an explicitbecome: true(the rest of that play/role already requires root). Behaviour on nodes without the guard is unchanged.nvidia-driver.ymlcarries the sametest nvidia-smi; it is deliberately not touched here to avoid conflicting with #1396, and can take the same wrapper once that lands.Side note:
nvidia-smi -acpis deprecated in current drivers ("This option is deprecated … Treating as warning and moving on") and has no effect on Blackwell; a comment records that, the task is kept as-is otherwise.Verification
On the affected node with the guard active, same ssh session:
ansible-playbook --syntax-checkpasses for the four playbooks;ansible-lint26.1.1 with the project config reports 0 failures.systemd-run --wait/--pipe/--collectneed systemd ≥ 236, which every supported Ubuntu/RHEL release ships.