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" // ...... //Create an event. aclrtEvent event; aclrtCreateEvent(&event); //Create two streams. aclrtStream s1; aclrtStream s2; aclrtCreateStream(&s1); aclrtCreateStream(&s2); //Append an event to s1. aclrtRecordEvent(event, s1); //Block s2 until the event is complete, that is, the completion of s1. //Wake up s2 for execution after s1 is complete. aclrtStreamWaitEvent(s2, event); //Explicitly destroy allocations. aclrtDestroyStream(s2); aclrtDestroyStream(s1); aclrtDestroyEvent(event); // ......