[BUG]: cuda.bindings GL interop tests open EGL device 0 on headless multi-GPU hosts and fail with cudaErrorInvalidDevice
维护者通常 1 天内回复
评估
调研方向
阅读 cuda_bindings_13/tests/test_graphics_apis.py,尤其是 _configure_pyglet_headless 和 test_cuda_gl_register_image_smoketest;与 issue #2865 中 cuda.core 测试的修复进行比较。检查 select_headless_egl_device_for_cuda(0) 的导入和调用方式,然后在一台有多块 GPU、且可见 GPU 中有一块不是第一块的 headless 主机上运行 graphics API 测试。无需手动设置 PYGLET_HEADLESS_DEVICE,两个测试参数都通过时即为完成。
由索引模型根据 Issue 内容生成。
描述
Is this a duplicate?
- I confirmed there appear to be no duplicate issues for this bug and that I agree to the Code of Conduct
Type of Bug
Something else (test-only failure)
Component
cuda.bindings
Describe the bug
cuda_bindings_13/tests/test_graphics_apis.py::test_cuda_gl_register_image_smoketest (both parameters) fails on a headless 8-GPU B300 host when the tests see one GPU through CUDA_VISIBLE_DEVICES:
AssertionError: cudaGraphicsGLRegisterImage returned cudaErrorInvalidDevice
assert 'cudaErrorInvalidDevice' in {'cudaErrorOperatingSystem', 'cudaSuccess'}
CUDA_VISIBLE_DEVICES does not reorder EGL's device enumeration, so the headless context lands on EGL device 0, which is not the GPU behind CUDA device 0. #2865 fixed exactly this for cuda.core's tests/test_graphics.py with select_headless_egl_device_for_cuda. The cuda.bindings test has its own _configure_pyglet_headless, and that function still sets only pyglet.options["headless"]. The nightly GH200 / GB300 rows have one GPU, so they never see this.
On the B300 host the EGL devices report these CUDA ordinals (eglQueryDeviceAttribEXT(EGL_CUDA_DEVICE_NV), with only the 6th GPU visible):
- EGL device 5 → CUDA ordinal 0.
- Every other EGL device → none.
How to Reproduce
On a headless multi-GPU Linux host, with EGL available and no DISPLAY:
CUDA_VISIBLE_DEVICES=<uuid of a GPU other than the first> pytest cuda_bindings_13/tests/test_graphics_apis.py
Expected behavior
The test registers against the GL context on the GPU it uses for CUDA, as the cuda.core test does.
Proposed fix
Call select_headless_egl_device_for_cuda(0) in the bindings test's _configure_pyglet_headless, the same way cuda.core does. These tests register against CUDA device 0. With that change, tests/test_graphics_apis.py passes 3/3 on the host above without any extra environment variable. Without the change, it passes only when PYGLET_HEADLESS_DEVICE=5 is set by hand. I have the change ready as a PR if this sounds right.
The fix was written with Claude Opus 5.5 and reviewed by the contributor.
Environment
GPU: B300 (cc 10.3, x86_64, 8 GPUs, one visible) | driver 610.57.04 | CUDA 13.4.2 (local CTK) | Python 3.12 | cuda-python 2da9c65a
- 主要语言
- Cython
- 星标
- 3.4k
- 派生
- 341
- 平均合并
- 1 天 18 小时
- 30 天内合并 PR
- 148
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NVIDIA/cuda-python 的其他 Issue
-
CI/CD P1
难度 2/5 1-3 小时 新手友好度 78/100
NVIDIA/cuda-python#3273 · 1 条评论 ·
维护者通常 1 天内回复
-
[BUG]: multi-GPU cuda.core samples take the CUDA device count from NVML and break under CUDA_VISIBLE_DEVICES可能已有人在做 @Andy-Jost 于 1 天前认领。 未关闭bug cuda.core P2
难度 2/5 1-3 小时 新手友好度 78/100
NVIDIA/cuda-python#3215 · 已指派 1 人 ·
维护者通常 1 天内回复
-
lychee should specify which links are failing可能已有人在做 @kkonnerharris 于 2 天前认领。 未关闭triage
难度 2/5 1-3 小时 新手友好度 67/100
NVIDIA/cuda-python#3204 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
[BUG]: cleanup-pr-previews never removes previews of deleted PRs可能已有人在做 @rwgk 于 22 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
NVIDIA/cuda-python#2952 · 已指派 1 人 ·
维护者通常 1 天内回复
-
[DOC]: cuda.core 1.1.1 note misstates program cache permissions可能已有人在做 @leofang 于 36 天前认领。 未关闭documentation P1
难度 1/5 1 小时以内 新手友好度 88/100
NVIDIA/cuda-python#2717 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 NVIDIA/cuda-python 的全部 Issue
相似的 Issue
-
ai-driven-fuzzing bug claude Minor
难度 2/5 1-3 小时 新手友好度 82/100
linagora/cozy-client#1767 ·
维护者通常 1 天内回复
-
Seed a JRNYAx price before the last close so asset-detail S1.3 doesn't fail from 08:00Z to the open未关闭bug tests
难度 2/5 1-3 小时 新手友好度 83/100
lognorman20/monaco#7231 ·
-
enhancement ready-for-agent
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
follow-up
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 83/100
维护者通常 3 天内回复