Setting Environment Variables
Before applying AOE tuning, run the export command to configure environment variables on the current terminal. Configurations in this mode become invalid after the shell terminal is closed.
- Required environment variables
- Run the following command in the development environment as the running user to configure the environment variables required by the AOE tool. Replace ${install_path} with the actual installation path of the CANN software and ${arch} with the actual architecture of the operating system.
export LD_LIBRARY_PATH=${install_path}/cann/share/info/ncs/lib64/:${install_path}/cann/${arch}-linux/devlib/:$LD_LIBRARY_PATHYou can also write the preceding commands to the ~/.bashrc file and run the source ~/.bashrc command to make them valid immediately.
- 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 in the development environment as the running user to set environment variables:
# 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.
- Run the following command in the development environment as the running user to configure the environment variables required by the AOE tool. Replace ${install_path} with the actual installation path of the CANN software and ${arch} with the actual architecture of the operating system.
- Optional environment variables: AOE tuning environment variables in the development environment. The following is an example:
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 into the custom script for future use.