Function: launch_kernel

Applicability

Product

Supported (√/x)

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas training products

Atlas inference products

Atlas 200I/500 A2 inference products

Function Usage

Starts the computation task of a kernel. Only Ascend C custom operators are supported.

Prototype

  • C Prototype
    1
    aclError aclrtLaunchKernel(aclrtFuncHandle funcHandle, uint32_t blockDim, const void *argsData, size_t argsSize, aclrtStream stream)
    
  • Python Function
    1
    ret = acl.rt.launch_kernel(func_handle, block_dim, args_data, args_size, stream)
    

Parameter Description

Parameter

Description

func_handle

Int, func_handle obtained by calling acl.rt.binary_get_function based on kernel_name.

block_dim

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 APIs, 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 the acl.rt.create_stream API call.

Return Value Description

Return Value

Description

ret

Int, error code: 0 on success; else, failure.

Restrictions

This API is asynchronous. The API call delivers a task rather than executes a task. After this API is called, call the synchronization API (for example, acl.rt.synchronize_stream) to ensure that the task is complete.