cuda.bindings._v2.driver.stream_begin_capture_to_graph#

cuda.bindings._v2.driver.stream_begin_capture_to_graph(
intptr_t h_stream,
intptr_t h_graph,
dependencies,
dependency_data,
size_t num_dependencies,
int mode,
)#

Begins graph capture on a stream to an existing graph.

Begin graph capture on h_stream, placing new nodes into an existing graph. When a stream is in capture mode, all operations pushed into the stream will not be executed, but will instead be captured into h_graph. The graph will not be instantiable until the user calls cuStreamEndCapture. Capture may not be initiated if stream is CU_STREAM_LEGACY. Capture must be ended on the same stream in which it was initiated, and it may only be initiated if the stream is not already in capture mode. The capture mode may be queried via cuStreamIsCapturing. A unique id representing the capture sequence may be queried via cuStreamGetCaptureInfo. If mode is not CU_STREAM_CAPTURE_MODE_RELAXED, cuStreamEndCapture must be called on this stream from the same thread.

Parameters:
  • h_stream (intptr_t) – Stream in which to initiate capture.

  • h_graph (intptr_t) – Graph to capture into.

  • dependencies (object) –

    Dependencies of the first node captured in the stream. Can be NULL if num_dependencies is 0. It can be:

    • an int as the pointer address to the array, or

    • a Python sequence of ints (as pointer addresses).

  • dependency_data (intptr_t) – Optional array of data associated with each dependency.

  • num_dependencies (size_t) – Number of dependencies.

  • mode (StreamCaptureMode) – Controls the interaction of this capture sequence with other API calls that are potentially unsafe. For more details see cuThreadExchangeStreamCaptureMode.

Note

Kernels captured using this API must not use texture and surface references. Reading or writing through any texture or surface reference is undefined behavior. This restriction does not apply to texture and surface objects.

See also

cuStreamBeginCaptureToGraph