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}/latest/tools/ncs/lib64/:${install_path}/latest/${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.
# Install Toolkit as the root user. . /usr/local/Ascend/ascend-toolkit/set_env.sh # Install Toolkit as a non-root user. . ${HOME}/Ascend/ascend-toolkit/set_env.sh - The AOE tool 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, specify Python 3.7.5. export PATH=/usr/local/python3.7.5/bin:$PATH
You need to use the actual Python 3.7.5 installation path. You can also write the preceding commands to the ~/.bashrc file and run the source ~/.bashrc command to make them valid 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 a custom script for future use.