Device Synchronization

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"
// ......
//Specify a device.
aclrtSetDevice(0);

//Create a context.
aclrtContext ctx;
aclrtCreateContext(&ctx, 0);

//Create a stream explicitly.
aclrtStream stream;
aclrtCreateStream(&stream);

//Block app execution until the compute device has completed all preceding requested tasks.
aclrtSynchronizeDevice();

//Destroy allocations.
aclrtDestroyStream(stream);
aclrtDestroyContext(ctx);
aclrtResetDevice(0);