Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

[BUG]: cuda.bindings GL interop tests open EGL device 0 on headless multi-GPU hosts and fail with cudaErrorInvalidDevice

Aberta Para iniciantes
#3,212 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@0z5a já está trabalhando nisso.

Desde 29/10/2026.

  • #3276 de @0z5a — aberto

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
78/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
python
Domínio
testing

Direção de pesquisa

Leia cuda_bindings_13/tests/test_graphics_apis.py, especialmente _configure_pyglet_headless e test_cuda_gl_register_image_smoketest; compare com a correção do teste de cuda.core na issue #2865. Verifique como select_headless_egl_device_for_cuda(0) é importada e chamada, depois execute os testes da API gráfica em um host headless com várias GPUs, no qual uma GPU diferente da primeira esteja visível. O trabalho estará concluído quando os dois parâmetros de teste passarem sem definir PYGLET_HEADLESS_DEVICE manualmente.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

triage
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
Linguagem predominante
Cython
Estrelas
3.4k
Forks
341
Merge médio
1d 18h
PRs com merge (30d)
147

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de NVIDIA/cuda-python

Todas as issues de NVIDIA/cuda-python

Issues semelhantes

Mais issues de Testing & QA

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.