cuda.core.Graph#

class cuda.core.Graph#

Represents an executable graph.

A graph groups a set of CUDA kernels and other CUDA operations together and executes them with a specified dependency tree. It speeds up the workflow by combining the driver activities associated with CUDA kernel launches and CUDA API calls.

Graphs must be built using a GraphBuilder object.

Methods

__init__(self)#
close(self)#

Destroy the graph.

launch(self, Stream stream: Stream)#

Launches the graph in a stream.

Parameters:

stream (Stream) – The stream in which to launch the graph

update(self, source: 'GraphBuilder | GraphDef') None#

Update the graph using a new graph definition.

The topology of the provided source must be identical to this graph.

Parameters:

source (GraphBuilder or GraphDef) – The graph definition to update from. A GraphBuilder must have finished building.

upload(self, Stream stream: Stream)#

Uploads the graph in a stream.

Parameters:

stream (Stream) – The stream in which to upload the graph

Attributes

property handle: CUgraphExec#

Return the underlying CUgraphExec object.

Caution

This handle is a Python object. To get the memory address of the underlying C handle, call int() on the returned object.