Skip to content

Migrate pynvml.py to cuda.core.system - #8022

Open
mdboom wants to merge 6 commits into
NVIDIA:mainfrom
mdboom:pynvml-to-cuda.core.system
Open

Migrate pynvml.py to cuda.core.system#8022
mdboom wants to merge 6 commits into
NVIDIA:mainfrom
mdboom:pynvml-to-cuda.core.system

Conversation

@mdboom

@mdboom mdboom commented Apr 28, 2026

Copy link
Copy Markdown

Migrates usage of pynvml.py to the new Cython and cybind-based cuda.core.system.

I was unable to get my environment set up to test this locally, so there may be issues.

@copy-pr-bot

copy-pr-bot Bot commented Apr 28, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the conda conda issue label May 19, 2026
@mdboom
mdboom marked this pull request as ready for review May 19, 2026 13:48
@mdboom
mdboom requested review from a team as code owners May 19, 2026 13:48
@mdboom
mdboom requested review from betatim and jameslamb May 19, 2026 13:48
@coderabbitai

coderabbitai Bot commented May 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 6ffbb46f-bdc1-4d1c-90a5-1f7d73099775

📥 Commits

Reviewing files that changed from the base of the PR and between 2f3b843 and 1f7cf38.

📒 Files selected for processing (1)
  • python/cuml/tests/conftest.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • python/cuml/tests/conftest.py

📝 Walkthrough

Summary by CodeRabbit

  • Dependencies
    • Updated CUDA packages to require cuda-bindings>=12.9.6 and cuda-core>=1.0.0, excluding CUDA 13.0/13.1; removed nvidia-ml-py.
  • Tests
    • Test environment now uses native CUDA system APIs for GPU detection and memory queries, improving reliability across devices.

Walkthrough

Updates dependency declarations to add cuda-bindings>=12.9.6,!=13.0.*,!=13.1.* and cuda-core>=1.0.0 and remove nvidia-ml-py>=12; updates test utilities to use cuda.core.system for device/memory queries and introduces _get_nvml_device_handle.

Changes

pynvml to cuda.core.system migration

Layer / File(s) Summary
Dependency configuration updates
conda/environments/all_cuda-129_arch-aarch64.yaml, conda/environments/all_cuda-129_arch-x86_64.yaml, conda/environments/all_cuda-132_arch-aarch64.yaml, conda/environments/all_cuda-132_arch-x86_64.yaml, dependencies.yaml, python/cuml/pyproject.toml
Adds cuda-bindings>=12.9.6 (excluding 13.0.* and 13.1.*) and cuda-core>=1.0.0 to environment and test dependency lists; removes nvidia-ml-py>=12.
Test NVML helper implementation
python/cuml/tests/conftest.py
Imports cuda.core.system, adds _get_nvml_device_handle(device_id) to obtain Device objects from index or UUID (handles MIG parent devices), and updates _get_gpu_memory() to compute GiB and return None when unsupported.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes


Possibly related issues


Suggested labels

improvement, non-breaking


Suggested reviewers

  • jameslamb
  • csadorf
  • betatim
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: migrating from pynvml.py to cuda.core.system, which is reflected across all modified files.
Description check ✅ Passed The description is relevant to the changeset, explaining the migration from pynvml.py to cuda.core.system and acknowledging testing limitations.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@csadorf

csadorf commented May 19, 2026

Copy link
Copy Markdown
Contributor

@mdboom Is it safe to assume that this can wait to be release in 26.08 rather than 26.06?

@mdboom

mdboom commented May 19, 2026

Copy link
Copy Markdown
Author

@mdboom Is it safe to assume that this can wait to be release in 26.08 rather than 26.06?

Yes. There is no concrete timeline to deprecate pynvml, so no urgency on this.

@betatim betatim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One question about how things will work for packages built for different cuda versions. Otherwise looks fine to me

Comment thread dependencies.yaml
- numpydoc<1.9
# 'nvidia-ml-py' provides the 'pynvml' module
- nvidia-ml-py>=12
- cuda-bindings>=12.9.6,!=13.0.*,!=13.1.*

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do the versions here correspond to the version of CUDA that the user has installed?

Will this also work for the -cu13 package that we upload to pypi?

@betatim

betatim commented May 27, 2026

Copy link
Copy Markdown
Contributor

Can you merge the latest changes from main into your branch and regenerate the dependency files? That should make the conflicts go away and make the "recently updated" check happy

@csadorf

This comment has been minimized.

@csadorf csadorf added Build or Dep Issues related to building the code or dependencies tests Unit testing for project labels Jun 12, 2026
@csadorf

This comment has been minimized.

@csadorf csadorf added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build or Dep Issues related to building the code or dependencies conda conda issue Cython / Python Cython or Python issue improvement Improvement / enhancement to an existing function non-breaking Non-breaking change tests Unit testing for project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants