Skip to content

samples: run the cuda.core GL interop samples headless (EGL) instead of waiving without DISPLAY #3576

Todo

Description

@mdboom

Part of #2077.

Problem

Three cuda.core GL interop samples never run in CI:

  • samples/cuda_core/glInteropFluid
  • samples/cuda_core/glInteropMipmapLod
  • samples/cuda_core/glInteropPlasma

They are exercised by cuda_core/tests/example_tests/test_samples.py::test_sample[...] and waive themselves in every configuration:

  • Linux: each sample waives when DISPLAY is unset (for example, glInteropFluid.py prints "No DISPLAY available; waiving glInteropFluid."), and CI runners have no display.
  • Windows: the samples can't load opengl32 on the runners.

The bindings GL test (cuda_bindings_13/tests/test_graphics_apis.py) solved the Linux case with a headless EGL context on the NVIDIA GPU behind CUDA device 0 (cuda_python_test_helpers.graphics, #3276). It passes on 20 Linux configurations. The samples could do the same.

glInteropFluidNumbaCudaMlir has the same display problem, and additionally needs numba-cuda-mlir (see #3578).

Fix

Teach the GL samples to fall back to a headless EGL context when no display is available, instead of waiving: pyglet's headless option, with the EGL device matched to the CUDA device. The samples are user-facing, so keep the headless path small and readable, or put it in a shared sample utility.

Waive only when neither a display nor an NVIDIA EGL device is available. If the samples render to a window, have the headless path render offscreen and validate the result, rather than just exiting cleanly.

Done when

The three samples pass on the Linux GPU rows (and the MLIR variant wherever numba-cuda-mlir is installed), still waive cleanly where no NVIDIA GL is available, and the sample keys are removed from the test_samples.py marker.

Guidance for PRs that address this issue

  • When making a fix that allows a test to run in CI, remove the comment about the test not running in CI from the code.
  • When making a test run only in nightly CI, we need to concretely confirm that in nightly CI. Include instructions in the PR about how to kick off a nightly run for the specific PR in order to test that (see below).
  • For every PR note that the reviewer should feel free to push commits directly to the PR to improve things. @mdboom does not have the bandwidth to shepard each of them through.
  • Every PR should include a way to confirm automatically that the tests are now running in at least one CI configuration.

Running the nightly test suites for a PR

The nightly workflow can test a PR's own wheels and tests, but it has to be started by hand. Starting it needs write access to NVIDIA/cuda-python, so ask a maintainer if you don't have it.

  1. Wait for the PR's CI workflow run to finish successfully, and note its run ID, the number in its URL (.../actions/runs/<run-id>).

  2. Start CI: Nightly optional-deps on the PR's mirror branch, with that run ID. Either:

    • In the GitHub UI: Actions → CI: Nightly optional-deps → Run workflow. Set Use workflow from to pull-request/<PR number>, enter the run ID in the run-ID field, and leave the link-checker-only box unchecked.

    • From the command line:

      gh workflow run ci-nightly.yml --repo NVIDIA/cuda-python --ref pull-request/<PR number> -f run-id=<run-id>
      

    Supply the run ID. Without it, the nightly run tests main's latest wheels and tests, not the PR's.

  3. Link the nightly run in the PR. Then confirm that the affected tests ran and passed, rather than skipped, in the relevant nightly jobs.

The nightly run tests the commit of that CI run. Repeat these steps after pushing changes that affect the nightly-only tests.

Activity

  1. added
    test
    cuda.core
    example
    on Nov 25, 2026
  2. self-assigned this
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

cuda.coreexampletest

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions