Skip to content

Skip NVML tests if the hardware doesn't support NVML#1585

Merged
mdboom merged 11 commits intoNVIDIA:mainfrom
mdboom:unsupported-nvml-hardware
Feb 6, 2026
Merged

Skip NVML tests if the hardware doesn't support NVML#1585
mdboom merged 11 commits intoNVIDIA:mainfrom
mdboom:unsupported-nvml-hardware

Conversation

@mdboom
Copy link
Contributor

@mdboom mdboom commented Feb 6, 2026

Some hardware, such as Jetson Orin, doesn't support NVML at all. We should skip the NVML-related tests on those platforms.

This is an alternative to most of #1583 (though it doesn't address the non-NVML change there).

@mdboom mdboom self-assigned this Feb 6, 2026
@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Feb 6, 2026

Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@mdboom mdboom requested review from Copilot and rwgk February 6, 2026 14:38
@mdboom
Copy link
Contributor Author

mdboom commented Feb 6, 2026

/ok to test

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the test suites to skip NVML-related tests on platforms where NVML is present in the Python bindings but not actually supported by the underlying hardware/driver (e.g., Jetson Orin), as an alternative approach to parts of #1583.

Changes:

  • Added an hardware_supports_nvml() probe helper (cached) that attempts a minimal NVML call to detect true NVML support.
  • Extended NVML-related skip conditions in cuda_core tests to include the new hardware probe.
  • Added a module-level skip for the cuda_bindings/tests/nvml test package when NVML isn’t supported by the platform.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
cuda_core/tests/test_device.py Extends to_system_device test to skip when NVML hardware support is missing.
cuda_core/tests/system/conftest.py Updates shared NVML skip marker to include a hardware support probe.
cuda_bindings/tests/nvml/init.py Skips the entire NVML test package at import time when NVML isn’t supported.
cuda_bindings/cuda/bindings/_test_helpers/arch_check.py Introduces hardware_supports_nvml() probe used by multiple test suites.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 34 to 37
if not _system.CUDA_BINDINGS_NVML_IS_COMPATIBLE or not hardware_supports_nvml():
with pytest.raises(RuntimeError):
device.to_system_device()
pytest.skip("NVML support requires cuda.bindings version 12.9.6+ or 13.1.2+")
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new hardware_supports_nvml() branch still asserts device.to_system_device() raises RuntimeError. On NVML-incompatible hardware (but bindings version compatible), to_system_device() can succeed up to constructing cuda.core.system.Device, which may then raise an nvml.NotSupportedError (not a RuntimeError), or potentially a different NVML error. This makes the test unreliable on the very platforms you’re trying to support. Consider splitting the cases: keep the RuntimeError assertion only for the version-incompatible path, and for not hardware_supports_nvml() just pytest.skip(...) (or assert the appropriate NVML exception type if you want coverage).

Copilot uses AI. Check for mistakes.
@github-actions

This comment has been minimized.

@mdboom
Copy link
Contributor Author

mdboom commented Feb 6, 2026

/ok to test

mdboom and others added 2 commits February 6, 2026 10:49
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mdboom
Copy link
Contributor Author

mdboom commented Feb 6, 2026

/ok to test

@mdboom
Copy link
Contributor Author

mdboom commented Feb 6, 2026

/ok to test

@mdboom
Copy link
Contributor Author

mdboom commented Feb 6, 2026

/ok to test

@mdboom
Copy link
Contributor Author

mdboom commented Feb 6, 2026

/ok to test

@mdboom
Copy link
Contributor Author

mdboom commented Feb 6, 2026

/ok to test

Copy link
Collaborator

@rwgk rwgk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mdboom
Copy link
Contributor Author

mdboom commented Feb 6, 2026

/ok to test

@rwgk rwgk mentioned this pull request Feb 6, 2026
@mdboom
Copy link
Contributor Author

mdboom commented Feb 6, 2026

/ok to test

@mdboom mdboom enabled auto-merge (squash) February 6, 2026 17:42
@mdboom mdboom merged commit 1d7c89e into NVIDIA:main Feb 6, 2026
86 checks passed
@github-actions

This comment has been minimized.

3 similar comments
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link

github-actions bot commented Feb 9, 2026

Doc Preview CI
Preview removed because the pull request was closed or merged.

@leofang leofang added the to-be-backported Trigger the bot to raise a backport PR upon merge label Mar 10, 2026
@github-actions
Copy link

Backport failed for 12.9.x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 12.9.x
git worktree add -d .worktree/backport-1585-to-12.9.x origin/12.9.x
cd .worktree/backport-1585-to-12.9.x
git switch --create backport-1585-to-12.9.x
git cherry-pick -x 1d7c89eded65451dfffcf0fb52622c10efb056b2

mdboom added a commit to mdboom/cuda-python that referenced this pull request Mar 10, 2026
* Skip NVML tests if the hardware doesn't support NVML

* Also skip converting between Device types

* Fix test_to_system_device test

* Update cuda_bindings/cuda/bindings/_test_helpers/arch_check.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fix test

* Simplify check

* Fix import when cuda_bindings is incompatible

* Fix logic

* Move over a single test from NVIDIA#1583

* Fix check

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mdboom mdboom mentioned this pull request Mar 10, 2026
leofang pushed a commit that referenced this pull request Mar 10, 2026
* Skip NVML tests if the hardware doesn't support NVML

* Also skip converting between Device types

* Fix test_to_system_device test

* Update cuda_bindings/cuda/bindings/_test_helpers/arch_check.py



* Fix test

* Simplify check

* Fix import when cuda_bindings is incompatible

* Fix logic

* Move over a single test from #1583

* Fix check

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

to-be-backported Trigger the bot to raise a backport PR upon merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants