Skip to content

Use CUDA driver for CUDA device enumeration - #2533

Closed
isVoid wants to merge 1 commit into
NVIDIA:mainfrom
isVoid:agent/use-cuda-device-enumeration
Closed

Use CUDA driver for CUDA device enumeration#2533
isVoid wants to merge 1 commit into
NVIDIA:mainfrom
isVoid:agent/use-cuda-device-enumeration

Conversation

@isVoid

@isVoid isVoid commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • make cuda.core.Device.get_all_devices() enumerate devices through the CUDA driver instead of the NVML system-device list
  • use CudaDevice.get_all_devices() anywhere examples or tests require CUDA-compute devices or CUDA device counts
  • convert CUDA devices to their system-device representation for NVML-backed properties while retaining raw NVML enumeration tests

Root cause

On N1X, NVML enumerates both the RTX GPU and the NPU, while CUDA exposes only the RTX GPU. Using the NVML count for CUDA device construction makes a one-GPU system appear to have two CUDA devices: Device(1) then fails, and NVML compute-process queries against the NPU return NotSupported.

Impact

CUDA device enumeration and multi-GPU test gates now reflect CUDA-visible compute devices. Non-CUDA NVML devices such as the N1X NPU no longer trigger false multi-GPU behavior or CUDA-only system queries.

Validation

Tested locally on Windows 11 ARM64 / N1X with CUDA 13.4 and native Python 3.13.15 ARM64 (cp313-win_arm64):

  • observed nvml_devices=2 and cuda_devices=1
  • exact nvbug tests: 1 passed, 1 skipped; test_get_process_name passes and the two-GPU green-context test skips correctly
  • scoped changed-path suite: 1196 passed, 89 skipped
  • show_device_properties.py reports one GPU and exits successfully
  • Ruff check and format check pass
  • Cython lint (--no-pycodestyle) and git diff --check pass

@isVoid isVoid added this to the cuda.core 1.2.0 milestone Aug 7, 2026
@isVoid isVoid added bug Something isn't working cuda.core Everything related to the cuda.core module labels Aug 7, 2026
@copy-pr-bot

copy-pr-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

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.

@isVoid
isVoid force-pushed the agent/use-cuda-device-enumeration branch from d941211 to 882f9a9 Compare August 7, 2026 20:55
@isVoid isVoid closed this Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cuda.core Everything related to the cuda.core module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant