Following the API calls, add exception handling branches and specify log printing of error and information levels. The following is a code snippet of key steps only, which is not ready to be built or run.
#include "acl/acl.h" // ...... int32_t deviceId = 0 ; uint32_t modelId1 = 0; uint32_t modelId2 = 1; aclrtContext context; aclrtStream stream1; aclrtStream stream2; //If only one context is created, the thread uses this context by default. //If there are multiple contexts, aclrtSetCurrentContext should be called to set the context for the current thread. aclrtCreateContext(&context, deviceId); aclrtCreateStream(&stream1); //Call the task execution API. For example, the asynchronous model inference tasks are delivered to stream1. aclmdlDataset *input1; aclmdlDataset *output1; aclmdlExecuteAsync(modelId1, input1, output1, stream1); aclrtCreateStream(&stream2); //Call the task execution API. For example, the asynchronous model inference tasks are delivered to stream2. aclmdlDataset *input2; aclmdlDataset *output2; aclmdlExecuteAsync(modelId2, input1, output2, stream2); //Synchronize streams. aclrtSynchronizeStream(stream1); aclrtSynchronizeStream(stream2); //Destroy allocations. aclrtDestroyStream(stream1); aclrtDestroyStream(stream2); aclrtDestroyContext(context); // ....