Before You Start
Environment Setup
- Install the software package. Install the driver, firmware, and CANN software package. For details, see the CANN Software Installation Guide.
- Configure the environment variable. The current operator compiler depends on the AOE tool. Therefore, you need to set basic CANN environment variables and environment variables required by the AOE tool.
- Basic environment variables of the CANN software
The CANN portfolio provides a process-level environment variable setting script to automatically set environment variables. The following commands are used as examples, in which the default installation paths are under the root or non-root user. Replace them with actual installation paths.
# Configure environment variables after installing the Toolkit package as the root user. source /usr/local/Ascend/cann/set_env.sh # Configure environment variables after installing the Toolkit package as a non-root user. source ${HOME}/Ascend/cann/set_env.sh - AOE depends on Python. Take Python 3.7.5 as an example. Run the following commands as the running user to configure the environment variables related to Python 3.7.5:
# Set the Python 3.7.5 library path. export LD_LIBRARY_PATH=/usr/local/python3.7.5/lib:$LD_LIBRARY_PATH # If multiple Python 3 versions exist in the user environment, use Python 3.7.5. export PATH=/usr/local/python3.7.5/bin:$PATH
Replace the Python 3.7.5 installation path based on the actual requirements. You can also write the preceding commands to the ~/.bashrc file and run the source ~/.bashrc command to make the modification take effect immediately.
- Before tuning, you can configure other optional environment variables by referring to the following example. For details, see Table 1.
export ASCEND_DEVICE_ID=0 export TUNE_BANK_PATH=/home/HwHiAiUser/custom_tune_bank export TE_PARALLEL_COMPILER=8 export REPEAT_TUNE=False
You can write the commands for configuring environment variables to the custom script for future use.
- Basic environment variables of the CANN software
- In the debug build compilation scenario, you need to install the binary packages installed in the actual scenario in advance, including static and dynamic binary packages.
Tool Acquisition
The tool is stored in the ${INSTALL_DIR}/compiler/bin/op_compiler directory.
Replace ${INSTALL_DIR} with the CANN component directory. For example, if the installation is performed by the root user, the default file storage path is /usr/local/Ascend/cann.