Function: launch_kernel
Applicable Products
- Ascend 950PR&950DT products: Supported
- Atlas A3 products: Supported
- Atlas A2 products: Supported
- Atlas 200I/500 A2 inference products: Supported
- Atlas inference products: Supported
- Atlas training products: Supported
Function
Starts the computation task of a kernel. Only Ascend C custom operators are supported.
Prototype
-
C Prototype
aclError aclrtLaunchKernel(aclrtFuncHandle funcHandle, uint32_t numBlocks, const void *argsData, size_t argsSize, aclrtStream stream) -
Python Function
ret = acl.rt.launch_kernel(func_handle, num_blocks, args_data, args_size, stream)
Parameters
| Parameter | Description |
|---|---|
| func_handle | int, func_handle obtained by calling acl.rt.binary_get_function based on kernel_name. |
| num_blocks | Int, number of cores on which the kernel function will be executed. |
| args_data | Int, pointer to the memory address of the device that stores all input parameters of the kernel. For details about the memory allocation API, see Memory Management. |
| args_size | Int, size of the args_data parameter, in bytes. |
| stream | Int, stream for executing a task, which can be a created stream for saving resources or newly created by calling acl.rt.create_stream. |
Return Values
| Return Value | Description |
|---|---|
| ret | Int, error code. If 0 is returned, the operation is successful. If other values are returned, the operation fails. |
Constraints
This API is asynchronous. A successful call indicates only that the task has been delivered, not that it has completed. After calling this API, call a synchronization API (for example, acl.rt.synchronize_stream) to ensure that the task is complete.