Dhruv.Contact
Back home

CudaCKPT

Abstract

Checkpoint and restore single-GPU CUDA processes on Linux without touching application source. An LD_PRELOAD shim intercepts the CUDA Driver API, snapshots GPU allocations, streams, and modules, then coordinates with CRIU for full process state. Result: 95% less recomputation, <4% runtime overhead, and 1.8GB/s checkpoint throughput — with a production CLI, Prometheus metrics, and versioned images.

Highlights

  • Transparent LD_PRELOAD interception — no application source changes required
  • Reduced recomputation by 95% with <4% runtime overhead and 1.8GB/s checkpoint throughput
  • Versioned images with CRC32C, compression, sparse pages, delta snapshots, and Prometheus metrics
GoCCUDACRIULinuxHPC

cudackpt

CI Release Go CUDA

Checkpoint and restore single-GPU CUDA processes on Linux — without modifying your application.

cudackpt intercepts the CUDA Driver API through an LD_PRELOAD shim, snapshots device memory and stream state, coordinates with CRIU for CPU/process state, and restores execution from a versioned on-disk image.

Status: v0.3.0 — early release. Validate on your stack before production use. See Limitations.

Features

  • Transparent interceptionLD_PRELOAD shim; no app source changes
  • Full-stack checkpoint — GPU allocations, streams, modules, and process state via CRIU
  • Versioned images — manifest with CRC32C, optional compression, sparse pages, dedup, and delta snapshots
  • Production tooling — rollback, image retention GC, promote-image, restore event logs, Prometheus metrics
  • Operator-friendly CLI — checkpoint, restore, inspect, validate, report, and granular RPC controls

Quick start

git clone https://github.com/thedhruvhegde/cudackpt.git
cd cudackpt
make
sudo make install

Run your CUDA app under the shim, then checkpoint from another terminal:

export LD_PRELOAD=/usr/lib/libcudackpt.so
./your_cuda_app

cudackpt ps -v
cudackpt checkpoint <pid> /var/lib/cudackpt/run-1
kill <pid>
cudackpt restore /var/lib/cudackpt/run-1

Install the .deb from Releases on Ubuntu/Debian, or build from source above.

Architecture

flowchart LR
  subgraph app [Target Process]
    A[CUDA Application]
    S[libcudackpt.so]
    A --> S
  end
  subgraph ctrl [Control Plane]
    C[cudackpt CLI]
    O[Orchestrator]
    C --> O
  end
  S <-->|Unix socket RPC| O
  O --> G[GPU Snapshot]
  O --> R[CRIU dump/restore]
  G --> I[Versioned Image]
  R --> I

Checkpoint sequence:

  1. Freeze tracked CUDA streams via RPC.
  2. Copy live device allocations to host (device.bin) with per-chunk CRC32C.
  3. Write manifest, device metadata, and environment into a versioned image directory.
  4. Invoke CRIU to capture process memory, file descriptors, and registers.

Restore reverses the order: CRIU restore → GPU memory remap at original virtual addresses → resume signal to the application.

Requirements

ComponentVersion
OSLinux x86_64
NVIDIA driverCUDA 12.x compatible
CUDA toolkit12.x (nvcc, cmake)
Go1.22+
CRIU3.x with criu check passing
Privilegessudo for CRIU and /run/cudackpt socket directory

Optional: Docker with NVIDIA Container Toolkit for containerized e2e; self-hosted GitHub Actions runner with GPU for full e2e CI.

Installation

git clone https://github.com/thedhruvhegde/cudackpt.git
cd cudackpt
./scripts/install-hooks.sh   # optional: local commit hooks
make
sudo make install DESTDIR=

Installed artifacts:

PathRole
/usr/lib/libcudackpt.soLD_PRELOAD shim
/usr/bin/cudackptControl CLI and orchestrator

Systemd units and agent daemon: sudo make install-systemd (see docs/OPERATIONS.md).

Usage

Run a CUDA application under the shim:

export LD_PRELOAD=/path/to/build/libcudackpt.so
./your_cuda_app

In another terminal:

cudackpt ps -v
cudackpt checkpoint <pid> /var/lib/cudackpt/run-1
cudackpt validate /var/lib/cudackpt/run-1
cudackpt inspect /var/lib/cudackpt/run-1
cudackpt report /var/lib/cudackpt/run-1
kill <pid>
cudackpt restore /var/lib/cudackpt/run-1

Granular RPC controls:

cudackpt freeze <pid>
cudackpt snapshot <pid> /tmp/image
cudackpt gpu-restore <pid> /tmp/image
cudackpt resume <pid>
cudackpt status <pid>

See docs/CLI.md for the complete command reference.

Testing

make test
go test ./...
./scripts/run_shim_smoke.sh
sudo scripts/check_env.sh
sudo make checkpoint
sudo make e2e-fast
sudo make all-tests

Docker e2e (requires GPU passthrough):

./scripts/run_docker_e2e.sh

Diagnostics on failure:

./scripts/diag.sh /tmp/cudackpt-e2e

Enable shim debug logging:

export CUDACKPT_DEBUG=1

Image layout

FilePurpose
manifest.binVersioned header and chunk index (ptr, size, offset, seq, CRC32C)
device.binConcatenated device memory pages
dev.binGPU device index
meta.binPID, device, LD_PRELOAD, CUDA_VISIBLE_DEVICES
criu/CRIU process image
snapshot.errSnapshot failure diagnostics
restore.errGPU restore failure diagnostics

Documentation

Limitations

  • Single GPU only; multi-GPU, MIG, NCCL, and CUDA graphs are rejected.
  • GPU restore relies on deterministic reallocation or fixed virtual-address remap; bit-exact resume is workload-dependent.
  • CRIU plus CUDA is experimental; validate on your stack before production use.

License

Proprietary — all rights reserved. See LICENSE for terms and licensing inquiries.

Connect with Dhruv Hegde

More of Dhruv Hegde's open-source work on GitHub and LinkedIn.

More projects

← Project gallery