Executes a model for inference. This API is asynchronous.
//...... aclmdlExecuteAsync(modelId1, input, output, stream1); aclmdlExecuteAsync(modelId1, input, output, stream2); aclrtSynchronizeStream(stream1); aclrtSynchronizeStream(stream2); //......
The acldvppMalloc and hi_mpi_dvpp_malloc APIs are dedicated memory allocation APIs for media data processing. To reduce copy, the output of media data processing is used as the input of model inference to implement memory reuse.
Hardware has memory alignment and supplement requirements. If you use one of these APIs to allocate a large memory block, and divide and manage the memory, the alignment and supplement restrictions of the corresponding API must be met. For details, see Secondary Memory Allocation.
aclError aclmdlExecuteAsync(uint32_t modelId, const aclmdlDataset *input, aclmdlDataset *output, aclrtStream stream)
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. |
0 on success; else, failure.