Automatic Environment Variable Configuration
This section describes the basic environment variables related to program build and execution that are configured by default using the set_env.sh script after the CANN software is installed, and the environment variables related to the installation packages that need to be manually configured during subsequent program build and execution.
After the CANN software is installed, the basic environment variables on which program build and execution depend are automatically configured by default. However, the environment variables automatically become invalid after the user process ends. You can also run the following environment variable scripts to configure the environment variables in one-click mode:
# The following is an example of configuring environment variables during installation as the root user: # Install the toolkit package. source /usr/local/Ascend/cann/set_env.sh # Install the ATB acceleration library of the nnal package. source /usr/local/Ascend/nnal/atb/set_env.sh # Install the SiP acceleration library of the nnal package. source /usr/local/Ascend/nnal/asdsip/set_env.sh
# The following is an example of configuring environment variables during installation as a non-root user:
# Install the toolkit package.
source ${HOME}/Ascend/cann/set_env.sh
# Install the ATB acceleration library of the nnal package.
source ${HOME}/Ascend/nnal/atb/set_env.sh
# Install the SiP acceleration library of the nnal package.
source ${HOME}/Ascend/nnal/asdsip/set_env.sh
You can also configure permanent environment variables by modifying the ~/.bashrc file. The procedure is as follows:
- Run the vi ~/.bashrc command in any directory as the running user to open the .bashrc file and append the preceding lines to the file.
- Run the :wq! command to save the file and exit.
- Run the source ~/.bashrc command for the modification to take effect immediately.