Configuring Environment Variables
After installing the software packages, you need to configure environment variables to ensure that the software can work properly.
- Configuring Python Environment Variables
- Configuring the Environment Variables of the Ascend Software
- (Optional) Disabling Password-Free Login
- (Optional) Configuring GCC Environment Variables
- (Optional) Configuring the NIC IP Address of the Device
(Optional) Disabling Password-Free Login
After the installation is complete, you are advised to cancel the root user login and password-free login based on the actual application scenario.
In Linux, if you use ssh-keygen to generate a key for password-free login, perform the following steps to disable password-free login:
- Go to the ~/ssh directory.
cd ~/.ssh
- Delete the corresponding public key file.
rm authorized_keys
Configuring Python 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
(Optional) Configuring GCC Environment Variables
- Log in to the server as the root user.
- Configure environment variables. (The /usr/local/gcc7.3.0 path is used as an example. Replace it with the actual GCC 7.3.0 path. You can run the find / -name gcc7.3.0 command to query the actual installation path.)
export LD_LIBRARY_PATH=/usr/local/gcc7.3.0/lib64:${LD_LIBRARY_PATH} export CC=/usr/local/gcc7.3.0/bin/gcc export CXX=/usr/local/gcc7.3.0/bin/g++ export PATH=/usr/local/gcc7.3.0/bin:${PATH} - Run the gcc --version command to check the GCC version. If the following information is displayed, the configuration is successful:
gcc (GCC) 7.3.0
- During the installation, the Docker user group is created and the Docker service is started. After the installation is complete, you can uninstall third-party components that may pose security risks, such as GCC, g++, and JDK, from the system.
- If you require GCC 7.3.0 to compile a model but the GCC version cannot be controlled using the environment variable due to user compilation script limitations, perform the following operations to modify the soft link.
Before modifying the soft link, run the find / -name gcc7.3.0 command to check whether the gcc7.3.0 folder exists. If no, GCC 7.3.0 is not installed. In this case, skip the following operations.
- Run the following command in any directory on the server, for example, usr/local/gcc7.3.0, to create a soft link based on the actual path of the gcc 7.3.0 folder:
ln -sf /usr/local/gcc7.3.0/bin/gcc /usr/bin/gcc
- Run the gcc --version command to check the GCC version. If the following information is displayed, the configuration is successful:
gcc (GCC) 7.3.0
- Run the following command in any directory on the server, for example, usr/local/gcc7.3.0, to create a soft link based on the actual path of the gcc 7.3.0 folder:
Configuring the Environment Variables of the Ascend Software
# Configure the following when installing a version earlier than Toolkit 8.5.0:
. /usr/local/Ascend/ascend-toolkit/set_env.sh
# Configure the following when installing Toolkit, NNRT, and NNAE 8.5.0 or later:
. /usr/local/Ascend/cann/set_env.sh
# Configure the following when installing a version earlier than NNRT 8.5.0:
. /usr/local/Ascend/nnrt/set_env.sh
# Configure the following when installing a version earlier than NNAE 8.5.0:
. /usr/local/Ascend/nnae/set_env.sh
# Configure the following when installing the ToolBox package:
. /usr/local/Ascend/toolbox/set_env.sh
- 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.
(Optional) Configuring the NIC IP Address of the Device
During distributed training, configure the NIC IP address of the device. For details, see Configuring the Parameter Plane Network.
If you want to configure the NIC IP addresses of devices in batches, use the device IP configuration script (ascend-deployer/ascend_deployer/tools/hccn.py) provided by MindCluster Ascend Deployer. For details, see Using HCCN Tool.