warp.capture_save#
- warp.capture_save(
- graph,
- path,
- inputs=None,
- outputs=None,
- source_fallback=False,
Serialize a captured graph to a
.wrpfile for later replay.The graph must have been captured with
apic=True. For graphs containing recorded kernels, the.wrpfile and its companion_modulesdirectory must be kept together. Setsource_fallback=Trueto retain generated CUDA source so a loader can compile a local module when the packaged PTX or CUBIN is incompatible. Otherwise, only compiled binaries are exported.- Parameters:
path (str) – Output path. Warp adds the
.wrpextension if needed and creates<stem>.wrpand<stem>_modules/.inputs (dict | None) – Named input arrays (e.g.,
{"positions": pos_array}).outputs (dict | None) – Named output arrays (e.g.,
{"results": result_array}).source_fallback (bool) – Whether to package CUDA source and its compile recipe for recompilation on the replay device. Every captured CUDA module needs its generated
.cufile, unchanged since the module was loaded, beside the module binary, and a hashed binary name (strip_hash=Truemodules are not supported). Known blockers are reported together before writing the artifact. Guest hardware, driver, and compiler compatibility is checked at load time.
- Raises:
RuntimeError – If
source_fallback=Trueand any captured CUDA module has missing or changed generated source, an unverified binary name (for example,strip_hash=True), or a source-recompilation dependency that cannot be packaged: caller-provided CUDA include directories, LLVM-CUDA compilation, or LTO-IR/fatbin link inputs.
If the same array appears in both
inputsandoutputs(e.g., for in-place operations), both names will refer to the same memory region. Updating either viaset_paramon the loaded graph affects the same data. Each name binds the array’s entire base allocation rather than a view offset. Arrays passed toset_paramandget_parammust have the same byte capacity as that serialized region.