aclrtLaunchKernel
Applicable Products
Product |
Supported |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Function
Starts the compute task of an operator. This is an asynchronous API. The operator here is a custom operator developed by using Ascend C.
Prototype
1 | aclError aclrtLaunchKernel(aclrtFuncHandle funcHandle, uint32_t numBlocks, const void *argsData, size_t argsSize, aclrtStream stream) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
funcHandle |
Input |
Kernel function handle. For details about the type definition, see aclrtFuncHandle. Call aclrtBinaryGetFunction to obtain funcHandle based on kernelName. |
numBlocks |
Input |
Number of cores on which the kernel function will be executed. |
argsData |
Input |
Pointer to the device memory address that stores all input parameters of the kernel function. For details about memory allocation APIs, see Memory Management. The device that executes the task delivered by this API must be the same as the device that contains the memory used by argsData. |
argsSize |
Input |
Size of parameter values in argsData, in bytes. |
stream |
Input |
Stream for executing the task. For details about the type definition, see aclrtStream. |
Returns
0 on success; otherwise, failure. For details, see aclError.
Reference
All the APIs listed in the table below can start the compute task of an operator. However, their functions and usage methods are different.
API |
How Kernel Function Parameter Values Are Passed |
Where Kernel Function Parameter Values Are Stored |
Task Configurable |
|---|---|---|---|
Specify the pointer to the device memory address that stores all input parameters of the kernel function. |
Device memory |
No |
|
Specify the pointer to the device memory address that stores all input parameters of the kernel function. |
Device memory |
Yes |
|
Specify the parameter list handle aclrtArgsHandle. |
Host memory |
Yes |
|
Specify the pointer to the host memory address that stores all input parameters of the kernel function. |
Host memory |
Yes |
|
Specify the parameter array that stores all input parameters of the kernel function. Each element in the array points to the data of a kernel function parameter. |
Host memory |
Yes |