aclrtSubscribeHostFunc

The Atlas 200/300/500 Inference Product does not support this API.

The Atlas Training Series Product does not support this API.

Description

Subscribes to the thread (created by the user) for processing the callback function in the stream if the model contains CPU operators and the aclmdlExecuteV2 or aclmdlExecuteAsyncV2 API is called to perform model inference. Then the aclrtProcessHostFunc API is called to trigger the callback function, and the aclrtUnSubscribeHostFunc API is called to unsubscribe from the thread after model execution.

Restrictions

  • aclrtSubscribeHostFunc can be called for multiple times to subscribe to the same thread for processing the callback function in multiple streams of the same device.
  • To ensure that tasks in a stream can be executed in order, aclrtSubscribeHostFunc cannot be called to subscribe to multiple threads for processing more than one callback function in the same stream.

Prototype

aclError aclrtSubscribeHostFunc(uint64_t hostFuncThreadId, aclrtStream exeStream)

Parameters

Parameter

Input/Output

Description

hostFuncThreadId

Input

Thread ID.

exeStream

Input

Stream.

Returns

The value 0 indicates success, and other values indicate failure. For details, see aclError.