cuda.bindings._v2.driver.graph_add_kernel_node_v2#
- cuda.bindings._v2.driver.graph_add_kernel_node_v2(
- intptr_t h_graph,
- dependencies,
- size_t num_dependencies,
- node_params,
Creates a kernel execution node and adds it to a graph.
Creates a new kernel execution node and adds it to
h_graphwithnum_dependenciesdependencies specified viadependenciesand arguments specified innode_params. It is possible fornum_dependenciesto be 0, in which case the node will be placed at the root of the graph.dependenciesmay not have any duplicate entries. A handle to the new node will be returned inph_graph_node. TheCUDA_KERNEL_NODE_PARAMSstructure is defined as:. **View CUDA Toolkit Documentation for a C++ code example**. When the graph is launched, the node will invoke kernelfuncon a (gridDimXxgridDimYxgridDimZ) grid of blocks. Each block contains (blockDimXxblockDimYxblockDimZ) threads.sharedMemBytessets the amount of dynamic shared memory that will be available to each thread block. Kernel parameters tofunccan be specified in one of two ways:. 1) Kernel parameters can be specified viakernelParams. If the kernel has N parameters, thenkernelParamsneeds to be an array of N pointers. Each pointer, fromkernelParams[0] tokernelParams[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 for non-cooperative kernels can also be packaged by the application into a single buffer that is passed in viaextra. This places the burden on the application of knowing each kernel parameter’s size and alignment/padding within the buffer. Theextraparameter exists to allow this function to take additional less commonly used arguments.extraspecifies 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.CU_LAUNCH_PARAM_END, which indicates the end of theextraarray;.CU_LAUNCH_PARAM_BUFFER_POINTER, which specifies that the next value inextrawill be a pointer to a buffer containing all the kernel parameters for launching kernelfunc;.CU_LAUNCH_PARAM_BUFFER_SIZE, which specifies that the next value inextrawill be a pointer to a size_t containing the size of the buffer specified withCU_LAUNCH_PARAM_BUFFER_POINTER;.
The error
CUDA_ERROR_INVALID_VALUEwill be returned if kernel parameters are specified with bothkernelParamsandextra(i.e. bothkernelParamsandextraare non-NULL).CUDA_ERROR_INVALID_VALUEwill be returned ifextrais used for a cooperative kernel. ThekernelParamsorextraarray, as well as the argument values it points to, are copied during this call.- Parameters:
h_graph (intptr_t) – Graph to which to add the node.
dependencies (object) –
Dependencies of the node. It can be:
num_dependencies (size_t) – Number of dependencies.
node_params (intptr_t) – Parameters for the GPU execution node.
- Returns:
Returns newly created node.
- Return type:
intptr_t
Note
Kernels launched using graphs 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
cuGraphAddKernelNode_v2