From 3c576e947fe0b4d33819f4cf6837f0e3e64e55a5 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Mon, 30 Nov 2026 13:58:47 -0500 Subject: [PATCH 1/2] test(cuda.core): observe checkpoint GPU migration with a fresh driver 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 #3586. Co-Authored-By: Claude Opus 5.5 --- cuda_core/tests/test_checkpoint.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/cuda_core/tests/test_checkpoint.py b/cuda_core/tests/test_checkpoint.py index a9f64e5aa9af..94e5b51d8f1b 100644 --- a/cuda_core/tests/test_checkpoint.py +++ b/cuda_core/tests/test_checkpoint.py @@ -22,8 +22,9 @@ import pytest +from cuda.bindings import driver from cuda.core import Device, checkpoint -from cuda.core._utils.cuda_utils import CUDAError +from cuda.core._utils.cuda_utils import CUDAError, handle_return # -- Skip condition ------------------------------------------------------- @@ -192,14 +193,25 @@ def _run_checkpoint_scenario_or_skip(scenario: str, *, timeout: int = 90) -> Non ) +def _context_device_uuid() -> str: + """Return the UUID of the GPU behind the current context, queried from the driver. + + ``Device.uuid`` is cached per device ordinal, so it keeps reporting the + pre-restore GPU after a checkpoint restore migrates the context. + """ + device = handle_return(driver.cuCtxGetDevice()) + uuid_hex = bytes(handle_return(driver.cuDeviceGetUuid(device)).bytes).hex() + return f"{uuid_hex[:8]}-{uuid_hex[8:12]}-{uuid_hex[12:16]}-{uuid_hex[16:20]}-{uuid_hex[20:]}" + + def _target_main(device_index: int) -> None: Device(device_index).set_current() - print(f"READY:{Device().uuid}", flush=True) + print(f"READY:{_context_device_uuid()}", flush=True) for line in sys.stdin: command = line.strip() if command == "uuid": - print(f"UUID:{Device().uuid}", flush=True) + print(f"UUID:{_context_device_uuid()}", flush=True) elif command == "exit": break @@ -291,17 +303,13 @@ def _scenario_rotation_migrates_context() -> None: gpu_mapping = _build_rotation_mapping(devices) target, uuid_origin = _start_target(0) - current_uuid = uuid_origin proc = checkpoint.Process(target.pid) try: for step in range(len(devices)): expected_uuid = devices[(step + 1) % len(devices)].uuid _checkpoint_restore(proc, gpu_mapping=gpu_mapping) observed_uuid = _target_uuid(target) - if observed_uuid == current_uuid: - _scenario_skip("Driver accepted GPU rotation but migration is a no-op on this hardware/driver version") assert observed_uuid == expected_uuid, f"Step {step}: expected UUID {expected_uuid}, got {observed_uuid}" - current_uuid = observed_uuid assert _target_uuid(target) == uuid_origin finally: @@ -331,9 +339,6 @@ def _scenario_swap_identical_gpus() -> None: _checkpoint_restore(proc, gpu_mapping=gpu_mapping) uuid_after = _target_uuid(target) - - if uuid_after == devices[i].uuid: - _scenario_skip("Driver accepted GPU swap but migration is a no-op on this hardware/driver version") assert uuid_after == devices[j].uuid finally: _stop_target(target) @@ -579,7 +584,6 @@ class TestCheckpointGpuMigration: NVBug 5437334). """ - # This test is not currently run in any CI job def test_rotation_migrates_context(self): """Rotate context through all GPUs and back to the origin. @@ -590,7 +594,6 @@ def test_rotation_migrates_context(self): """ _run_checkpoint_scenario_or_skip("rotation_migrates_context", timeout=180) - # This test is not currently run in any CI job def test_swap_identical_gpus(self): """Swap context between two GPUs of the same chip type. From 5be42502295ce1f358495806ed3e7efa26c6962a Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Mon, 30 Nov 2026 16:28:08 -0500 Subject: [PATCH 2/2] TEMP: touch cuda_bindings_13 to trigger bindings test artifacts for nightly check Throwaway commit for verifying #3586 in the nightly workflow; to be dropped before merge. Co-Authored-By: Claude Sonnet 5.5 --- cuda_bindings_13/cuda/bindings/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cuda_bindings_13/cuda/bindings/__init__.py b/cuda_bindings_13/cuda/bindings/__init__.py index ea1daae3e0b6..5218592c06c1 100644 --- a/cuda_bindings_13/cuda/bindings/__init__.py +++ b/cuda_bindings_13/cuda/bindings/__init__.py @@ -3,3 +3,5 @@ from cuda.bindings import utils from cuda.bindings._version import __version__ + +# TEMPORARY: touch cuda_bindings_13 so CI builds the bindings Cython-test artifacts (PR #3659 nightly check). Drop before merge.