Development and Operating Environment Setup
For details about how to set up the development environment and operating environment, see CANN Software Installation Guide of the corresponding Atlas product.
- Once the development environment is set up, you can obtain the API header files and the library files required for building and running an app.
For Ascend devices, if the Driver and firmware have been installed, the environment can be directly used as the operating environment to execute the compiled executable app files.
- Once the operating environment is set up, you can run the executable file generated after app build.
- Determine the component directory to reference based on what is installed in the operating environment to avoid runtime errors. For the installation options, see CANN Software Installation Guide.
After the CANN software is installed, to build and run your app as the CANN running user, log in to the environment as the said user and run the source ${install_path}/set_env.sh command to set environment variables. In the command, replace ${install_path} with the CANN software installation directory.
- If NNRT is installed in the operating environment, reference the corresponding AscendCL directory during development.
- Header file path: CANN component directory/nnrt/latest/include/acl
- Library file path: CANN component directory/nnrt/latest/lib64
- If NNAE is installed in the operating environment, reference the corresponding AscendCL directory during development.
- Header file path: CANN component directory/nnae/latest/include/acl
- Library file path: CANN component directory/nnae/latest/lib64
- If NNRT is installed in the operating environment, reference the corresponding AscendCL directory during development.
- To perform the operations (including model conversion, code compilation, and app execution) described in this section, you must log in to the development environment or operating environment as the running user. You need to obtain the running user of each component for subsequent operations.
- Determine the component directory to reference based on what is installed in the operating environment to avoid runtime errors. For the installation options, see CANN Software Installation Guide.
- (Optional) Use environment variables ASCEND_CACHE_PATH and ASCEND_WORK_PATH to set the flushing path of the files generated during the building and running of the AscendCL app. This operation involves functions such as ATC model conversion, AscendCL app build and configuration, intelligent AOE model tuning, performance data collection, and log collection. The files flushed include operator building cache files, knowledge base files, tuning result files, performance data files, and log files.
The following is a configuration example. For details about the configuration, see Environment Variables.
export ASCEND_CACHE_PATH=/repo/task001/cache export ASCEND_WORK_PATH=/repo/task001/172.16.1.12_01_03
Run the export command to make the environment variable take effect only in the current terminal window and only for the Ascend AI app processes started after the environment variable is set.
If you write the export command to the ~/.bashrc file to make the environment variable permanent, the environment variable takes effect for all Ascend AI app processes of the user. This method may affect other app processes that do not require device ID adjustment. Therefore, exercise caution when using this method. To write the export command to the ~/.bashrc file, perform the following steps:
- Run the vi ~/.bashrc command in any directory as the installation user and append the preceding commands to the file.
- Run the :wq! command to save the file and exit.
- Run the source ~/.bashrc command to make the environment variable take effect.