Problem
cuda_core/tests/test_graphics.py fails on headless Linux systems with multiple GPUs. The test fixture initializes CUDA Device(0) (subject to CUDA_VISIBLE_DEVICES), but pyglet's headless EGL backend selects its own default EGL device independently -- CUDA_VISIBLE_DEVICES reorders CUDA's device enumeration but has no effect on EGL's.
On systems where CUDA device 0 and EGL device 0 are different physical GPUs, cuGraphicsGLRegisterBuffer() / cuGraphicsGLRegisterImage() fail with CUDA_ERROR_INVALID_DEVICE, because CUDA-OpenGL interop resources must be registered on the CUDA device associated with the GL rendering context.
Repro environment
- Linux headless (no
DISPLAY/WAYLAND_DISPLAY)
- 2x NVIDIA RTX PRO 6000 Blackwell Server Edition
- CUDA Toolkit 13.3.1, driver 610.43.02
- cuda-core 1.2.0, cuda-bindings 13.3.1, pyglet 2.1.14
- Python 3.10-3.14t
Observed
144 failures across 6 Python environments (24 test_graphics.py cases per env). Device-mapping validation showed the pass/fail pattern flips with CUDA_VISIBLE_DEVICES and PYGLET_HEADLESS_DEVICE, confirming EGL device index and CUDA device ordinal diverge on this class of system rather than differing by a fixed offset.
Not a regression in GraphicsResource -- the underlying CUDA/EGL device mismatch existed in cuda-core 1.1.0 too but was masked because those tests were skipped there.
Problem
cuda_core/tests/test_graphics.pyfails on headless Linux systems with multiple GPUs. The test fixture initializes CUDADevice(0)(subject toCUDA_VISIBLE_DEVICES), butpyglet's headless EGL backend selects its own default EGL device independently --CUDA_VISIBLE_DEVICESreorders CUDA's device enumeration but has no effect on EGL's.On systems where CUDA device 0 and EGL device 0 are different physical GPUs,
cuGraphicsGLRegisterBuffer()/cuGraphicsGLRegisterImage()fail withCUDA_ERROR_INVALID_DEVICE, because CUDA-OpenGL interop resources must be registered on the CUDA device associated with the GL rendering context.Repro environment
DISPLAY/WAYLAND_DISPLAY)Observed
144 failures across 6 Python environments (24
test_graphics.pycases per env). Device-mapping validation showed the pass/fail pattern flips withCUDA_VISIBLE_DEVICESandPYGLET_HEADLESS_DEVICE, confirming EGL device index and CUDA device ordinal diverge on this class of system rather than differing by a fixed offset.Not a regression in
GraphicsResource-- the underlying CUDA/EGL device mismatch existed in cuda-core 1.1.0 too but was masked because those tests were skipped there.