Initializing AscendCL
This section describes the APIs and precautions for initializing and deinitializing the AscendCL, and provides sample code.
Principles
Call the aclInit API to initialize AscendCL. The configuration file is in JSON format. For details, see the description in aclInit.
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 Image Classification with ResNet-50 (Synchronous Inference).
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.
1 2 3 4 5 6 7 8 9 10 11 |
//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(); // ...... |