Development Workflow
This section uses model inference as an example to describe the process of developing an app using acl APIs.
- Prepare the environment.
- Create code directories.
Create directories to store code files, build scripts, test images, model files, and more.
The following is an example for reference:
├App name ├── model // Model files │ ├── xxxxxx ├── data │ ├── xxx.jpg // Image test data ├── inc // Header files that declare functions │ ├── xxx.h ├── out // Output files ├── src │ ├── xxx.json // Configuration files for system initialization │ ├── CMakeLists.txt // Build scripts │ ├── xxx.cpp // Implementation files
- Build a model.
For model inference, the offline model adapted to the Ascend AI Processor (.om file) is mandatory. For details, see Building a Model.
- Develop an app.
- Perform initialization. For details, see Initialization and Deinitialization.
Before using acl APIs to develop an app, you must call aclInit for initialization. Failure to do so may result in errors when internal resources are being initialized, which can then lead to service exceptions.
- Allocate runtime resources. For details, see Runtime Resource Allocation and Deallocation.
- Transfer data. For details, see Data Transfer.
- Run model inference. For details, see Model Inference with Static-Shape Inputs.
Perform data postprocessing if required. For example, for an image classification app, you might need to identify the class indexes with the top confidence values.
After model inference is complete, destroy the allocations related to the inference.
- When data processing is complete, destroy runtime allocations. For details, see Runtime Resource Allocation and Deallocation.
- Perform deinitialization. For details, see Initialization and Deinitialization.
- Perform initialization. For details, see Initialization and Deinitialization.
- Build and run the app. This includes model conversion, code compilation, and app execution. For details, see App Build and Run.