Graph Management
- Provided by: nvidia-cuda-dev (Version: 10.1.243-3)
- Source: nvidia-cuda-toolkit
- Report a bug
\brief graph management functions of the CUDA runtime API (cuda_runtime_api.h)
This section describes the graph management functions of CUDA runtime application programming interface.
Creates a new node which executes an embedded graph, and adds it to graph with numDependencies dependencies specified via pDependencies. It is possible for numDependencies to be 0, in which case the node will be placed at the root of the graph. pDependencies may not have any duplicate entries. A handle to the new node will be returned in pGraphNode.
The node executes an embedded child graph. The child graph is cloned in this call.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
The number of dependencies to be added is defined by numDependencies Elements in pFrom and pTo at corresponding indices define a dependency. Each node in pFrom and pTo must belong to graph.
If numDependencies is 0, elements in pFrom and pTo will be ignored. Specifying an existing dependency will return an error.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Creates a new node which performs no operation, and adds it to graph with numDependencies dependencies specified via pDependencies. It is possible for numDependencies to be 0, in which case the node will be placed at the root of the graph. pDependencies may not have any duplicate entries. A handle to the new node will be returned in pGraphNode.
An empty node performs no operation during execution, but can be used for transitive ordering. For example, a phased execution graph with 2 groups of n nodes with a barrier between them can be represented using an empty node and 2*n dependency edges, rather than no empty node and n^2 dependency edges.
Parameters:
Returns:
Note:
See also:
Creates a new CPU execution node and adds it to graph with numDependencies dependencies specified via pDependencies and arguments specified in pNodeParams. It is possible for numDependencies to be 0, in which case the node will be placed at the root of the graph. pDependencies may not have any duplicate entries. A handle to the new node will be returned in pGraphNode.
When the graph is launched, the node will invoke the specified CPU function. Host nodes are not supported under MPS with pre-Volta GPUs.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Creates a new kernel execution node and adds it to graph with numDependencies dependencies specified via pDependencies and arguments specified in pNodeParams. It is possible for numDependencies to be 0, in which case the node will be placed at the root of the graph. pDependencies may not have any duplicate entries. A handle to the new node will be returned in pGraphNode.
The cudaKernelNodeParams structure is defined as:
struct cudaKernelNodeParams
{
void* func;
dim3 gridDim;
dim3 blockDim;
unsigned int sharedMemBytes;
void **kernelParams;
void **extra;
};
When the graph is launched, the node will invoke kernel func on a (gridDim.x x gridDim.y x gridDim.z) grid of blocks. Each block contains (blockDim.x x blockDim.y x blockDim.z) threads.
sharedMem sets the amount of dynamic shared memory that will be available to each thread block.
Kernel parameters to func can be specified in one of two ways:
1) Kernel parameters can be specified via kernelParams. If the kernel has N parameters, then kernelParams needs to be an array of N pointers. Each pointer, from kernelParams[0] to kernelParams[N-1], points to the region of memory from which the actual parameter will be copied. The number of kernel parameters and their offsets and sizes do not need to be specified as that information is retrieved directly from the kernel's image.
2) Kernel parameters can also be packaged by the application into a single buffer that is passed in via extra. This places the burden on the application of knowing each kernel parameter's size and alignment/padding within the buffer. The extra parameter exists to allow this function to take additional less commonly used arguments. extra specifies a list of names of extra settings and their corresponding values. Each extra setting name is immediately followed by the corresponding value. The list must be terminated with either NULL or CU_LAUNCH_PARAM_END.
The error cudaErrorInvalidValue will be returned if kernel parameters are specified with both kernelParams and extra (i.e. both kernelParams and extra are non-NULL).
The kernelParams or extra array, as well as the argument values it points to, are copied during this call.
Note:
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Creates a new memcpy node and adds it to graph with numDependencies dependencies specified via pDependencies. It is possible for numDependencies to be 0, in which case the node will be placed at the root of the graph. pDependencies may not have any duplicate entries. A handle to the new node will be returned in pGraphNode.
When the graph is launched, the node will perform the memcpy described by pCopyParams. See cudaMemcpy3D() for a description of the structure and its restrictions.
Memcpy nodes have some additional restrictions with regards to managed memory, if the system contains at least one device which has a zero value for the device attribute cudaDevAttrConcurrentManagedAccess.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Creates a new memset node and adds it to graph with numDependencies dependencies specified via pDependencies. It is possible for numDependencies to be 0, in which case the node will be placed at the root of the graph. pDependencies may not have any duplicate entries. A handle to the new node will be returned in pGraphNode.
The element size must be 1, 2, or 4 bytes. When the graph is launched, the node will perform the memset described by pMemsetParams.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Gets a handle to the embedded graph in a child graph node. This call does not clone the graph. Changes to the graph will be reflected in the node, and the node retains ownership of the graph.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
This function creates a copy of originalGraph and returns it in pGraphClone. All parameters are copied into the cloned graph. The original graph may be modified after this call without affecting the clone.
Child graph nodes in the original graph are recursively copied into the clone.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Creates an empty graph, which is returned via pGraph.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Destroys the graph specified by graph, as well as all of its nodes.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Removes node from its graph. This operation also severs any dependencies of other nodes on node and vice versa.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Destroys the executable graph specified by graphExec.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Sets the parameters of a kernel node in an executable graph hGraphExec. The node is identified by the corresponding node node in the non-executable graph, from which the executable graph was instantiated.
node must not have been removed from the original graph. The func field of nodeParams cannot be modified and must match the original value. All other values can be modified.
The modifications take effect at the next launch of hGraphExec. Already enqueued or running launches of hGraphExec are not affected by this call. node is also not modified by this call.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Returns a list of graph's dependency edges. Edges are returned via corresponding indices in from and to; that is, the node in to[i] has a dependency on the node in from[i]. from and to may both be NULL, in which case this function only returns the number of edges in numEdges. Otherwise, numEdges entries will be filled in. If numEdges is higher than the actual number of edges, the remaining entries in from and to will be set to NULL, and the number of edges actually returned will be written to numEdges.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Returns a list of graph's nodes. nodes may be NULL, in which case this function will return the number of nodes in numNodes. Otherwise, numNodes entries will be filled in. If numNodes is higher than the actual number of nodes, the remaining entries in nodes will be set to NULL, and the number of nodes actually obtained will be returned in numNodes.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Returns a list of graph's root nodes. pRootNodes may be NULL, in which case this function will return the number of root nodes in pNumRootNodes. Otherwise, pNumRootNodes entries will be filled in. If pNumRootNodes is higher than the actual number of root nodes, the remaining entries in pRootNodes will be set to NULL, and the number of nodes actually obtained will be returned in pNumRootNodes.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Returns the parameters of host node node in pNodeParams.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Sets the parameters of host node node to nodeParams.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Instantiates graph as an executable graph. The graph is validated for any structural constraints or intra-node constraints which were not previously validated. If instantiation is successful, a handle to the instantiated graph is returned in pGraphExec.
If there are any errors, diagnostic information may be returned in pErrorNode and pLogBuffer. This is the primary way to inspect instantiation errors. The output will be null terminated unless the diagnostics overflow the buffer. In this case, they will be truncated, and the last byte can be inspected to determine if truncation occurred.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Returns the parameters of kernel node node in pNodeParams. The kernelParams or extra array returned in pNodeParams, as well as the argument values it points to, are owned by the node. This memory remains valid until the node is destroyed or its parameters are modified, and should not be modified directly. Use cudaGraphKernelNodeSetParams to update the parameters of this node.
The params will contain either kernelParams or extra, according to which of these was most recently set on the node.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Sets the parameters of kernel node node to pNodeParams.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Executes graphExec in stream. Only one instance of graphExec may be executing at a time. Each launch is ordered behind both any previous work in stream and any previous launches of graphExec. To execute a graph concurrently, it must be instantiated multiple times into multiple executable graphs.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Returns the parameters of memcpy node node in pNodeParams.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Sets the parameters of memcpy node node to pNodeParams.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Returns the parameters of memset node node in pNodeParams.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Sets the parameters of memset node node to pNodeParams.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
This function returns the node in clonedGraph corresponding to originalNode in the original graph.
clonedGraph must have been cloned from originalGraph via cudaGraphClone. originalNode must have been in originalGraph at the time of the call to cudaGraphClone, and the corresponding cloned node in clonedGraph must not have been removed. The cloned node is then returned via pClonedNode.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Returns a list of node's dependencies. pDependencies may be NULL, in which case this function will return the number of dependencies in pNumDependencies. Otherwise, pNumDependencies entries will be filled in. If pNumDependencies is higher than the actual number of dependencies, the remaining entries in pDependencies will be set to NULL, and the number of nodes actually obtained will be returned in pNumDependencies.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Returns a list of node's dependent nodes. pDependentNodes may be NULL, in which case this function will return the number of dependent nodes in pNumDependentNodes. Otherwise, pNumDependentNodes entries will be filled in. If pNumDependentNodes is higher than the actual number of dependent nodes, the remaining entries in pDependentNodes will be set to NULL, and the number of nodes actually obtained will be returned in pNumDependentNodes.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Returns the node type of node in pType.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
The number of pDependencies to be removed is defined by numDependencies. Elements in pFrom and pTo at corresponding indices define a dependency. Each node in pFrom and pTo must belong to graph.
If numDependencies is 0, elements in pFrom and pTo will be ignored. Specifying a non-existing dependency will return an error.
Parameters:
Returns:
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
Generated automatically by Doxygen from the source code.