Repository navigation
Description
Part of #2077.
Problem
cuda_bindings_12/tests/test_graphics_apis.py::test_graphics_api_smoketest never runs in CI. It requires DISPLAY or WAYLAND_DISPLAY on Linux and skips with "No display available for the OpenGL smoke test" on every Linux runner. On Windows it skips with "pyglet not available or could not create GL context".
cuda_bindings_13 replaced this test with test_cuda_gl_register_image_smoketest, which creates a headless EGL context on the GPU that backs CUDA device 0. That uses cuda_python_test_helpers.graphics (select_headless_egl_device_for_cuda, gl_context_not_on_nvidia_gpu_reason, tcc_skip_reason, and others; #3276). The CUDA 13 test passes on 20 Linux configurations. cuda_bindings_12 tests already import cuda_python_test_helpers, so the same helpers are available there.
Separately, the CUDA 13 test is weaker than it looks. It accepts cudaErrorOperatingSystem as a pass (cuda_bindings_13/tests/test_graphics_apis.py:115), so a passing run doesn't prove that an image was registered. That allowance predates the helper that now verifies the GL context is on an NVIDIA GPU.
Fix
- Port the CUDA 13 headless-EGL test and its
_gl_contextsetup tocuda_bindings_12/tests/test_graphics_apis.py, using the cross-root procedure in CONTRIBUTING.md ("Transferring fixes between bindings roots"). Then remove the oldtest_graphics_api_smoketest. - In both roots, require
cudaSuccess(and a non-zero resource, then unregister) once_gl_contexthas confirmed an NVIDIA GL context. DropcudaErrorOperatingSystemfrom the accepted results, unless there's a documented case where it's expected on NVIDIA GL.
Done when
The CUDA 12 GL test passes on the Linux CUDA 12 rows, both roots require cudaSuccess, and the CUDA 12 marker is removed.
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.
-
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>). -
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. -
-
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