For the API call sequence for AscendCL initialization and deinitialization, see API Call Sequence.
Call aclInit to initialize AscendCL. Pass a JSON configuration file to the API call.
aclError ret = aclInit(NULL);
Deinitialize AscendCL by using the aclFinalize call after all AscendCL API calls are complete or before the process exits.
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(); // ......