aclmdlExecuteAsyncV2
The
The
Description
Performs model inference based on the attributes configured by the aclmdlSetExecConfigOpt API until the inference result is returned. This API is enhanced based on aclmdlExecuteAsync. It can control the timeout interval of stream tasks and event tasks during model inference. This API is asynchronous.
Restrictions
- This API must be used together with other APIs to implement model execution. The API call sequence is as follows:
- Call aclmdlCreateExecConfigHandle to create a configuration object for model execution.
- Call aclmdlSetExecConfigOpt for multiple times to set the value of each attribute in the configuration object.
- Call aclmdlExecuteAsyncV2 to specify the configuration information required for model execution and execute the model.
- After the model is successfully executed, call the aclmdlDestroyExecConfigHandle API to destroy the model.
- This API is asynchronous. The API call delivers a task rather than executes a task. After this API is called, you need to call a synchronization API (for example, aclrtSynchronizeStream) to ensure that the task is complete. Otherwise, service exceptions (such as training or inference exception) or unknown situations (such as device link or card disconnection) may occur.
- Other restrictions are the same as those of aclmdlExecuteAsync.
Prototype
aclError aclmdlExecuteAsyncV2(uint32_t modelId, const aclmdlDataset *input, aclmdlDataset *output, aclrtStream stream, const aclmdlExecConfigHandle *handle)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
modelId |
Input |
Model ID for inference. A successful aclmdlLoadFromFile, aclmdlLoadFromMem, aclmdlLoadFromFileWithMem, or aclmdlLoadFromMemWithMem call returns a model ID. |
input |
Input |
Pointer to the input data for model inference. |
output |
Output |
Pointer to the output data for model inference. |
stream |
Input |
Stream. |
handle |
Input |
Pointer to the configuration object executed by the model. The value must be the same as that of handle in aclmdlSetExecConfigOpt. |
Returns
The value 0 indicates success, and other values indicate failure. For details, see aclError.