AscendCL Initialization and Deinitialization

For the API call sequence for AscendCL initialization and deinitialization, see API Call Sequence.

Principles

Call aclInit to initialize AscendCL. Pass a JSON configuration file to the API call.

To use the default configurations, pass NULL or an empty JSON configuration file with only a pair of curly brackets {} to the aclInit call. The following is an example of passing a null pointer to the aclInit call:
aclError ret = aclInit(NULL);

Deinitialize AscendCL by using the aclFinalize call after all AscendCL API calls are complete or before the process exits.

Sample Code

You can view the complete code in Sample Overview.

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.

//Initialization
//The two dots (..) indicate a path relative to the directory of the executable file.
//For example, if the executable file is stored in the out directory, the two dots (..) point to the parent directory of the out directory.
const char *aclConfigPath = "../src/acl.json";
aclError ret = aclInit(aclConfigPath);

// ......

//Deinitialization
ret = aclFinalize();
// ......