Skip to content

[cuda.core] test_graphics.py fails on headless multi-GPU Linux: EGL device does not match current CUDA device #2864

Description

@rparolin

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P0High priority - Must do!bugSomething isn't workingcuda.coreEverything related to the cuda.core module

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions