Repository navigation
fix(samples): respect CUDA_VISIBLE_DEVICES in multi-GPU cuda.core samples - #3220
mangeshraut712 wants to merge 3 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
📝 Summary
Priority: Change: Bug fix · Severity of issue fixed: Medium Merge Risk:
|
Signed-off-by: Mangesh Raut <mbr63@drexel.edu>
|
I checked the review feedback and local lint. The Codex review did not publish a concrete finding and CodeRabbit reported no actionable comments; I only fixed the Ruff formatting violation in the sample-verification test. |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

Minor · 📐 Maintainability & Code Quality · README.md:135
samples/cuda_core/simpleP2P/README.md:135
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winsuggestion: Update the expected output label.
The sample now prints
CUDA-visible device count, but the README still documentsCUDA-capable device count. Update the expected output to match the sample.Suggested fix
-CUDA-capable device count: 2 +CUDA-visible device count: 2

Review info
-
Run configuration-
- Source mode: Auto
- Repository: NVIDIA/cuda-python
- Branch: main
- File: .coderabbit.yaml
- Commit: 590a8bf
- Layers: Repository YAML
- Review profile: CHILL
- Plan: Enterprise
- Run ID:
1aaa474b-1907-4383-bd88-538c5da36f9c
Files selected for processing: 3-
samples/cuda_core/multiGPUGradientAverage/multiGPUGradientAverage.pysamples/cuda_core/simpleMultiGpu/simpleMultiGpu.pysamples/cuda_core/simpleP2P/simpleP2P.py
Files with no reviewable changes: 2-
- samples/cuda_core/multiGPUGradientAverage/multiGPUGradientAverage.py
- samples/cuda_core/simpleP2P/simpleP2P.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.
-
Closes #3215.
Summary
Updated
simpleP2P,simpleMultiGpu, andmultiGPUGradientAverageto size device enumeration withlen(Device.get_all_devices()), which follows CUDA runtime visibility includingCUDA_VISIBLE_DEVICES. Corrected the two affected READMEs and added a focused regression test. Keptsystem.get_num_devices()unchanged for NVML system inventory use.Files
samples/cuda_core/simpleP2P/simpleP2P.pysamples/cuda_core/simpleP2P/README.mdsamples/cuda_core/simpleMultiGpu/simpleMultiGpu.pysamples/cuda_core/simpleMultiGpu/README.mdsamples/cuda_core/multiGPUGradientAverage/multiGPUGradientAverage.pycuda_core/tests/example_tests/test_sample_verification.pyTip
b462a85c70f6184c928a21dff11a19f50bd49d91Test plan
git diff --check