Function: launch_kernel

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas training product

Atlas inference product

Atlas 200I/500 A2 inference product

Description

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

Prototype

  • C Prototype
    1
    aclError aclrtLaunchKernel(aclrtFuncHandle funcHandle, uint32_t numBlocks, const void *argsData, size_t argsSize, aclrtStream stream)
    
  • Python Function
    1
    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 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

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.