warp.capture_save#

warp.capture_save(graph, path, inputs=None, outputs=None)[source]#

Serialize a captured graph to a .wrp file for later replay.

The graph must have been captured with apic=True. For graphs containing recorded kernels, the .wrp file and its companion _modules directory must be kept together.

Parameters:
  • graph (Graph) – A Graph captured with apic=True.

  • path (str) – Output path. The .wrp extension is added if missing. Creates <stem>.wrp and <stem>_modules/.

  • inputs (dict | None) – Named input arrays (e.g., {"positions": pos_array}).

  • outputs (dict | None) – Named output arrays (e.g., {"results": result_array}).

If the same array appears in both inputs and outputs (e.g., for in-place operations), both names will refer to the same memory region. Updating either via set_param on the loaded graph affects the same data. Each name binds the array’s entire base allocation rather than a view offset. Arrays passed to set_param and get_param must have the same byte capacity as that serialized region.