App Development Environment Setup
For details about how to deploy the development environment and operating environment, see the description of the corresponding Atlas product.
- Deploy the development environment, and then you can obtain the dependencies required for calling APIs and run the Python code file.
For Ascend devices, if the driver and firmware have been installed, the environment can be directly used as the operating environment to execute the Python code file that contains pyACL APIs.
For non-Ascend devices, the Python code file containing the pyACL APIs cannot be directly executed after the development environment is deployed. After the development is complete, upload the Python code file to the Ascend device environment where the operating environment has been deployed for verification.
- The Python code file can be executed in the operating environment only after the operating environment is deployed.
- Determine the component directory to reference based on what is installed in the operating environment to avoid runtime errors. For details about the installation scheme, see CANN Software Installation GuideCANN Software Installation Guide (Open Form).
After the CANN software is installed, log in to the environment as the CANN running 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.
- To perform the operations described in this section, you must log in to the development environment or operating environment as the running user and obtain the running user information 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 details about the installation scheme, see CANN Software Installation GuideCANN Software Installation Guide (Open Form).
Setting the Path for Flushing Generated Files
(Optional) Use environment variables ASCEND_CACHE_PATH and ASCEND_WORK_PATH to set the flushing path of files generated during the running of the pyACL application. ATC model conversion, intelligent AOE model optimization, performance data collection, and log collection functions are involved. Knowledge base files, optimization result files, performance data files, and log files will be flushed.
The following is a configuration example. For details, see Environment Variables.
export ASCEND_CACHE_PATH=/repo/task001/cache export ASCEND_WORK_PATH=/repo/task001/172.16.1.12_01_03
pyACL Dependencies
- pyACL does not have the installation dependencies but has the running dependencies. For details about how to deploy the development environment and operating environment, see CANN Software Installation Guide.
- The Python version on which the acl.so file in the generated pyACL depends ranges from 3.7.5 to 3.10.
Setting Environment Variables After the Installation
After installing the CANN package, you must configure the environment variables. Otherwise, import acl cannot be used.
- If you have installed the cann-toolkit package:
# Install the toolkit as the root user. . /usr/local/Ascend/ascend-toolkit/set_env.sh # Install the toolkit as a non-root user. . ${HOME}/Ascend/ascend-toolkit/set_env.sh - If you have installed the cann-nnrt package:
# Install NNRT as the root user. . /usr/local/Ascend/nnrt/set_env.sh # Install NNRT as a non-root user. . ${HOME}/Ascend/nnrt/set_env.sh - If you have installed the cann-nnae package:
# Install NNAE as the root user. . /usr/local/Ascend/nnae/set_env.sh # Install NNAE as a non-root user. . ${HOME}/Ascend/nnae/set_env.sh
After setting the environment variables, add import acl to the Python script. Then, you can use the functions in pyACL.