Skip to content

Skip privileged NVML discovery test for non-root Linux users - #3168

Open
isVoid wants to merge 2 commits into
NVIDIA:mainfrom
isVoid:fix/nvml-discovery-nonroot
Open

isVoid wants to merge 2 commits into
NVIDIA:mainfrom
isVoid:fix/nvml-discovery-nonroot

Conversation

@isVoid

@isVoid isVoid commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Description

Closes #3166.

Skip only test_discover_gpus when the process runs on Linux without root privileges. The NVML PCI rediscovery operation is documented as requiring administrator privileges; ordinary GPU enumeration and CUDA execution do not require this operation.

Observed during Linux ARM64 GB10 non-root container testing: this test raises nvml.UnknownError. The existing OperatingSystemError suppression does not cover it. An explicit privilege guard avoids broadly suppressing genuine driver errors.

Root Linux processes retain the existing test behavior. Windows does not evaluate os.geteuid() because the condition short-circuits. No other NVML test or production binding changes.

Validation

  • pytest -v -rs cuda_bindings/tests/nvml/test_pci.py: 2 passed, 2 skipped (the discovery test skips for non-root; one unrelated unsupported bridge-info subtest also skips).
  • Checked the marker condition for Linux non-root, Linux root, and Windows without geteuid.
  • Ruff check/format, applicable pre-commit hooks, and git diff --check passed.
  • Local GPU: NVIDIA A30, driver 595.84; Python 3.13, existing cuda-bindings 13.4.2.dev243+gf9de5797e wheel environment. No new source build or GB10 rerun for this public branch.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes. (Test-only change; API documentation already states the privilege requirement.)

@github-actions github-actions Bot added the cuda.bindings Everything related to the cuda.bindings module label Oct 20, 2026
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/cuda-python/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 2a335a66-0983-4fb6-9bdb-527324587df0
📥 Commits

Reviewing files that changed from the base of the PR and between 2a97736 and 709d727.

📒 Files selected for processing: 1
  • cuda_bindings_13/tests/nvml/test_pci.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Tests
    • Adjusted GPU discovery test execution to skip on Linux when administrator privileges are unavailable.
    • The test remains available on other platforms and for users with the required privileges.

The PCI discovery test skips on Linux when the process is not root. It remains available on other platforms and for root processes.

Changes: NVML PCI discovery test

Layer / File(s) Summary
Skip without Linux root privileges
cuda_bindings_13/tests/nvml/test_pci.py
The test checks the platform and process privileges. It skips on Linux when the process is not root.

Assessment against linked issues

Objective Addressed Explanation
Skip the privileged test for non-root Linux processes with an explicit explanation, while retaining it for root Linux processes and other platforms [#3166] ✅
Do not broadly suppress UnknownError [#3166] ✅

Suggested reviewers: mdboom

Priority: ⬇️ Low

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 709d7

No actionable merge-blocking risk is established.

✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

@isVoid isVoid self-assigned this Oct 21, 2026
@isVoid isVoid added test Improvements or additions to tests P2 Low priority - Nice to have labels Oct 21, 2026
@isVoid isVoid added this to the cuda.bindings 13.5.0 & 12.9.10 milestone Oct 21, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.bindings Everything related to the cuda.bindings module P2 Low priority - Nice to have test Improvements or additions to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: NVML PCI discovery test requires administrator privileges on Linux

1 participant