feat: round-trip test for the CUDA 13.4 CustomStorage checkpoint API - #12042
Closed
hhzhang16 wants to merge 2 commits into
Closed
feat: round-trip test for the CUDA 13.4 CustomStorage checkpoint API#12042hhzhang16 wants to merge 2 commits into
hhzhang16 wants to merge 2 commits into
Conversation
Signed-off-by: Hannah Zhang <hannahz@nvidia.com>
Signed-off-by: Hannah Zhang <hannahz@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview:
Adds a small standalone round-trip test for the CUDA 13.4 CustomStorage checkpoint API.
Details:
What the round-trip script does
Creates a clean artifact directory for the checkpoint files.
Creates two pipes between the parent and child processes. These pipes are for small communication + coordination messages, not for checkpoint bytes.
Forks before either process initializes CUDA -- this avoids inheriting partially initialized or inconsistent CUDA runtime state.
The child initializes CUDA, allocates an application buffer, and fills it with a deterministic pattern. Because the pattern is reproducible, the child can reconstruct the expected contents after restore without keeping a second copy.
The child tells the parent its application pointer and size. The default application buffer is 64 MiB.
The child waits while the parent performs checkpoint and restore.
The parent initializes CUDA and looks up
cuCheckpointOperationComplete, the CustomStorage entry point.The parent confirms that the child starts in
RUNNING, then locks it withcuCheckpointProcessLock(child_pid).The parent calls CUDA checkpoint with
customStorageInfo_outenabled. CUDA returns one storage extent containing:The CustomStorage pointer is where CUDA exposes its serialized checkpoint state for our code to copy. It is not necessarily the application buffer’s pointer.
The parent copies the checkpoint extent from GPU memory into a file through a bounded, pinned CPU buffer. Copies are chunked so the script does not need to allocate enough pinned memory for the complete checkpoint.
The parent writes a temporary manifest describing the extent, calls
cuCheckpointOperationComplete(handle), confirms the child is nowCHECKPOINTED, and only then publishes the manifest. A failed CUDA completion cannot leave an apparently valid checkpoint manifest.Before restore, the script validates the manifest, file size, device identity, and expected extent count.
The parent calls CUDA restore, reads the stored extent through the pinned CPU buffer, and copies each chunk back into CUDA-provided storage.
After restore completes, the script verifies the remaining state transitions:
CHECKPOINTED → LOCKED → RUNNINGThe parent unlocks the child. The child compares every restored application byte with the expected deterministic pattern and performs another CUDA operation to prove the restored process is still usable.
A 120-second watchdog prevents a driver or process hang from occupying a shared GPU indefinitely.
Tests
Results on Nscale:
595.58.03libcuda.socuCheckpointOperationComplete: presentNormal round trip
RUNNING → LOCKED → CHECKPOINTED → LOCKED → RUNNINGTruncated artifact
Same-size corruption
Where should the reviewer start?
Related Issues
🔗 This PR is linked to an issue:
🚫 This PR is NOT linked to an issue: