Skip to content

test(cuda.core): observe checkpoint GPU migration with a fresh driver UUID query - #3659

Open
mdboom wants to merge 2 commits into
NVIDIA:mainfrom
mdboom:issue3586
Open

mdboom wants to merge 2 commits into
NVIDIA:mainfrom
mdboom:issue3586

Conversation

@mdboom

@mdboom mdboom commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Closes #3586. Part of #2077.

Summary

TestCheckpointGpuMigration::test_rotation_migrates_context and ::test_swap_identical_gpus skipped on every Linux multi-GPU runner (T4 x2, H100 x2, L4 x2) with "Driver accepted GPU rotation/swap but migration is a no-op on this hardware/driver version".

The cause is the test's observation, not the driver. The migrated target process reported Device().uuid, and cuda.core caches Device.uuid per device ordinal on first access. Nothing refreshes it after a checkpoint restore, so the target reported the pre-restore GPU whether or not the context moved, and the test turned that into a skip.

 _target_main  (the checkpointed process)
-    print(f"UUID:{Device().uuid}")           # cached per ordinal
+    print(f"UUID:{_context_device_uuid()}")  # cuCtxGetDevice + cuDeviceGetUuid, every time

 _scenario_rotation_migrates_context / _scenario_swap_identical_gpus
-    if observed == previous: skip("migration is a no-op on this hardware/driver version")
     assert observed == expected
  • A restore that succeeds with a mapping but leaves the context on the same GPU now fails the existing assertions instead of skipping.
  • The precise skips stay: masked CUDA_VISIBLE_DEVICES, fewer than 2 GPUs, no two GPUs of the same chip, and CUDA_ERROR_INVALID_VALUE (NVBug 5437334).
  • The "not currently run in any CI job" comments are removed.

Possible follow-up (not changed here): in a process that is migrated by checkpoint/restore, cuda.core's cached Device.uuid is stale. That is a library limitation, not only a test issue.

Evidence

CI coverage: on main both tests skip in every configuration; on the four Linux multi-GPU rows, with the "no-op" reason. After this change they should pass on:

  • linux-64 T4 x2 and H100 x2 (PR CI);
  • linux-aarch64 L4 x2, both rows (nightly).

Other rows keep their precise skips (Windows: checkpoint is Linux-only; single-GPU rows: fewer than 2 GPUs).

Locally: the local GPUs are different chips (RTX 5070, RTX A400), so migration can't be exercised here: a cross-chip restore is rejected with CUDA_ERROR_INVALID_VALUE, as expected. The fresh UUID query matches Device.uuid before migration, and test_checkpoint.py passes (29 passed; the 2 migration tests skip for "no same-chip pair").

Confirming in CI: in this PR's CI run, the linux-64 T4 x2 and H100 x2 cuda.core jobs should report both tests PASSED. For example:

gh run view <CI run id> --repo NVIDIA/cuda-python --log | grep -E "TestCheckpointGpuMigration::test_(rotation_migrates_context|swap_identical_gpus)"

If they fail there instead, the restore really did leave the context in place, which is a driver issue to report under #3586.

For the nightly L4 x2 rows (needs write access to NVIDIA/cuda-python):

  1. Wait for this PR's CI workflow run to finish successfully and note its run ID.
  2. gh workflow run ci-nightly.yml --repo NVIDIA/cuda-python --ref pull-request/<PR number> -f run-id=<run-id>
  3. In that nightly run, confirm the two tests PASSED in the "Nightly standard (linux-aarch64)" L4 x2 jobs.

Merge Danger

Door: two-way. Test-only change.

Blast Radius: two tests in cuda_core/tests/test_checkpoint.py. They can now fail on the multi-GPU rows where they used to skip, which is the point.

Reviewers: please feel free to push commits directly to this PR to improve it.

🤖 Generated with Claude Code

… UUID query

test_rotation_migrates_context and test_swap_identical_gpus skipped on
every Linux multi-GPU runner with "migration is a no-op". The migrated
target reported Device().uuid, which cuda.core caches per device ordinal,
so it kept returning the pre-restore GPU whether or not the context moved.

Query the UUID of the GPU behind the current context from the driver
(cuCtxGetDevice + cuDeviceGetUuid) instead, and drop the no-op skips: a
restore that succeeds with a mapping but leaves the context in place now
fails the existing assertions. The precise skips (masked devices, fewer
than 2 GPUs, no same-chip pair, CUDA_ERROR_INVALID_VALUE) stay.

Remove the "not currently run in any CI job" comments.

Closes NVIDIA#3586.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mdboom mdboom added this to the cuda.core 1.4.0 milestone Nov 30, 2026
@mdboom mdboom added test Improvements or additions to tests cuda.core Everything related to the cuda.core module labels Nov 30, 2026
@mdboom mdboom self-assigned this Nov 30, 2026
@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Tests
    • Strengthened checkpoint migration checks by verifying the GPU associated with the active CUDA context.
    • Rotation and swap restore scenarios now confirm that the expected destination GPU is active, including cases where migration previously completed without changing GPUs.
    • Checkpoint migration tests now run in CI, providing ongoing coverage of GPU selection and restore behavior.

The checkpoint migration tests now query the active context’s device UUID through the CUDA driver. Rotation and swap scenarios assert the expected UUID after restore instead of skipping when the UUID appears unchanged.

Changes: GPU migration test updates

Layer / File(s) Summary
Context UUID observation and migration assertions
cuda_core/tests/test_checkpoint.py
The target reports the device UUID obtained from the active context. Rotation and swap scenarios assert the expected UUID after restore, and comments stating that the tests do not run in CI are removed.

Assessment against linked issues

Objective Addressed Explanation
Use the active context’s device UUID and remove the no-op migration skip for the rotation and swap tests (#3586). ✅
Confirm that the tests run and pass, or skip only under a precise documented condition, on Linux multi-GPU CI runners (#3586). ❓ No CI results are provided to confirm the tests pass on those runners.

Suggested reviewers: rwgk, andy-jost

Change: Other

Merge Risk: Minimal · up to 5be42

This PR changes how the checkpoint migration tests identify the active GPU and makes them fail on a no-op migration instead of skipping. No production behavior changes. The temporary comment in the bindings package should be removed before merge.

Architecture risk: Low · up to 5be42

The change affects 2 source areas.

Changed areas: cuda_bindings_13, cuda_core

Review details

Systems and components

  • observed — 1 changed file mapped to cuda_bindings_13.
  • observed — 1 changed file mapped to cuda_core.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3c576e9 and 5be4250.

Files selected for processing: 1

  • cuda_bindings_13/cuda/bindings/__init__.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 7 remain after this review.

@jpascucci-nv jpascucci-nv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sol 6.1 high found no actionable findings. Lgtm.

@jpascucci-nv

Copy link
Copy Markdown
Contributor

(We still need to wait for success in T4x2 and H100x2 migration tests. )

@github-actions

Copy link
Copy Markdown
Contributor

@mdboom
mdboom enabled auto-merge (squash) November 30, 2026 20:31
@mdboom
mdboom disabled auto-merge November 30, 2026 20:31
@mdboom

mdboom commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

CI / nightly verification

PR CI (run 46490211814, head 3c576e9, latest results for all 63 test jobs): both TestCheckpointGpuMigration::test_rotation_migrates_context and ::test_swap_identical_gpus report PASSED on the two PR-CI multi-GPU rows:

  • linux-64 py3.14, CTK13.5.0, T4 x2
  • linux-64 py3.14t, CTK13.5.0, H100 x2 (PARALLEL PASSED)

The other 61 rows SKIP both tests, with the intended precise reasons ("GPU migration tests require at least 2 GPUs" / "No two GPUs of the same chip type found").

Nightly L4 x2 (linux-aarch64): not confirmed. I dispatched it as described (gh workflow run ci-nightly.yml --ref pull-request/3659 -f run-id=46490211814): nightly run 46513263627. All four "Nightly standard (linux-aarch64)" jobs, including both L4 x2 rows, failed at the Download cuda.bindings Cython tests step, before pytest started:

Artifact not found for name: cuda-bindings-python314-cuda13.5.0-linux-aarch64-3c576e947fe0b4d33819f4cf6837f0e3e64e55a5-tests

PR CI run 46490211814 has no cuda-bindings-*-tests artifacts for any platform. build-wheel.yml only builds and uploads them when TEST_BINDINGS == 'true', which this cuda_core-only PR doesn't trigger. For comparison, a recent main CI run does have them. So the nightly can't be run against this PR's CI run as the description says, and the L4 x2 pass is still unverified. The scheduled nightlies on main passed their L4 x2 rows (e.g. run 46340711468) but fail on the gh200/gb300 rows.

Other nightly jobs (numba-cuda, numba-cuda-mlir, cuda-core, some PyTorch) also failed in this dispatch. I haven't looked into those, and they don't involve the migration tests. The run was still in progress at the time of writing.

Ways to get the L4 x2 evidence: (a) run the nightly against a CI run for this SHA that builds the bindings tests, or (b) confirm after merge from the first scheduled nightly. The PR description's nightly steps should probably be amended.

…ightly check

Throwaway commit for verifying NVIDIA#3586 in the nightly workflow; to be dropped before merge.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the cuda.bindings Everything related to the cuda.bindings module label Nov 30, 2026

This branch has not been deployed

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

Labels

cuda.bindings Everything related to the cuda.bindings module cuda.core Everything related to the cuda.core module test Improvements or additions to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(cuda.core): checkpoint GPU-migration tests skip on every multi-GPU runner because migration looks like a no-op

2 participants