Repository navigation
Conversation
…n the GL interop tests NVIDIA#2865 made cuda.core's graphics tests pick the EGL device that backs the current CUDA device, because CUDA_VISIBLE_DEVICES does not reorder EGL's device enumeration. The cuda.bindings GL interop tests still opened EGL device 0, so on a headless multi-GPU host where CUDA device 0 is another GPU, cudaGraphicsGLRegisterImage returned cudaErrorInvalidDevice. Use the same select_headless_egl_device_for_cuda helper for CUDA device 0, which these tests register against. Tests written with Claude Opus 5.5 and reviewed by the contributor. Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
📝 Summary
Priority: Change: Bug fix · Severity of issue fixed: Medium Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: NVIDIA/cuda-python
- Branch: main
- File: .coderabbit.yaml
- Commit: d4c71ef
- Layers: Repository YAML
- Review profile: CHILL
- Plan: Enterprise
- Run ID:
46af7fb4-1cde-4e8a-b31c-452aeaab3457
Files selected for processing: 1-
cuda_bindings_13/tests/test_graphics_apis.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.
-
| # headless multi-GPU systems EGL device 0 may not be the physical GPU | ||
| # behind CUDA device 0, which these tests register against. Pick the | ||
| # EGL device that the driver reports as corresponding to it. | ||
| egl_device = select_headless_egl_device_for_cuda(0) |
There was a problem hiding this comment.
important: Preserve GL-unavailable skips during the probe.
If find_library("EGL") finds a library that cannot be loaded, the selector raises ImportError before the existing is_gl_context_unavailable handler. The tests now fail instead of skipping. Include _configure_pyglet_headless() in that handler’s try block. (raw.githubusercontent.com)
|
/ok to test c9f0ddf |
|
Description
Closes #3212.
On headless multi-GPU hosts, EGL device 0 can differ from CUDA device 0 when
CUDA_VISIBLE_DEVICESselects a subset. The GL interop tests then register a texture from the wrong GPU and can fail withcudaErrorInvalidDevice. Use the existing shared EGL selection helper, as cuda.core's graphics tests do, before creating the headless context. If the extension cannot identify a device, the existing pyglet default remains in use.The original fix was written with Claude Opus 5.5 and reviewed by the contributor.
Testing
2da9c65a: patchedtest_graphics_apis.pypassed 3/3 with only the sixth GPU visible and noPYGLET_HEADLESS_DEVICEoverride. Before the fix, the two registration parameters failed unless the matching EGL device was selected manually.git diff --checkpassed. GPU/GL tests have not been rerun on this head.