Skip to main content

cudaGraphAddNode

Function cudaGraphAddNode 

Source
pub unsafe extern "C" fn cudaGraphAddNode(
    pGraphNode: *mut cudaGraphNode_t,
    graph: cudaGraph_t,
    pDependencies: *const cudaGraphNode_t,
    dependencyData: *const cudaGraphEdgeData,
    numDependencies: size_t,
    nodeParams: *mut cudaGraphNodeParams,
) -> cudaError_t
Expand description

Adds a node of arbitrary type to a graph.

Creates a new node in graph described by nodeParams with numDependencies dependencies specified via pDependencies. numDependencies may be 0. pDependencies may be null if numDependencies is 0. pDependencies may not have any duplicate entries.

nodeParams is a tagged union. The node type should be specified in the type field, and type-specific parameters in the corresponding union member. All unused bytes - that is, reserved0 and all bytes past the utilized union member - must be set to zero. It is recommended to use brace initialization or memset to ensure all bytes are initialized.

Note that for some node types, nodeParams may contain “out parameters” which are modified during the call, such as nodeParams->alloc.dptr.

A handle to the new node will be returned in phGraphNode.

Note: Graph objects are not threadsafe. More here.

Note that this function may also return error codes from previous, asynchronous launches.

Note that this function may also return cudaError_t::CUDA_ERROR_NOT_INITIALIZED, cudaErrorInsufficientDriver or cudaError_t::CUDA_ERROR_NO_DEVICE if this call tries to initialize internal CUDA RT state.

Note that as specified by cudaStreamAddCallback no CUDA function may be called from callback. cudaError_t::CUDA_ERROR_NOT_PERMITTED may, but is not guaranteed to, be returned as a diagnostic in such case.

§Parameters

  • pGraphNode: Returns newly created node.
  • graph: Graph to which to add the node.
  • pDependencies: Dependencies of the node.
  • dependencyData: Optional edge data for the dependencies. If NULL, the data is assumed to be default (zeroed) for all dependencies.
  • numDependencies: Number of dependencies.
  • nodeParams: Specification of the node.

§Return value

See also: cudaGraphCreate, cudaGraphNodeSetParams, cudaGraphExecNodeSetParams.