Environment Preparation
Preparing the Ascend EP Environment
You need to prepare the development environment and operating environment by referring to CANN Software Installation Guide.
- The following installation paths are used as examples. Before starting the procedure, obtain the actual installation paths for subsequent operations.
- Install the Driver as the root user. /usr/local/Ascend is an example installation path, containing the driver and add-ons directories.
- Install the Toolkit as a non-root user (for example, HwHiAiUser). /home/HwHiAiUser/Ascend/ascend-toolkit/latest is an example installation path, containing the toolkit directory.
- This document uses the HwHiAiUser user as the running user of each component in the development environment and operating environment. You need to obtain the running user of the development environment and operating environment in advance before subsequent operations. During the installation of the Driver, the specified running user has been set to be forbidden to log in to the device due to service requirements. Otherwise, services will be abnormal. Therefore, you cannot directly log in to the host as the running user (that is, the ada process running user).
- You can run the export command to set environment variables in your current shell. The environment variables become unavailable when the shell is closed or the user exits.
- You can run the ps -ef | grep ada command to view the user (default user: HwHiAiUser) who starts the ada process and the process ID.
- The listening port (22118 by default) must be disabled in commercial use. If it is enabled, the system may run abnormally due to DoS attacks, unauthorized access, and unauthorized shell operations. Enable or disable the port by using the SOCK_SWITCH configuration option in the /ide_daemon/ide_daemon.cfg file in the home directory of the ada process running user in the operating environment. When SOCK_SWITCH is set to 0, the port is disabled. When SOCK_SWITCH is set to 1, the port is enabled. After the listening port is disabled, the adc command cannot be used.
Configuring the Operating Environment
- Install the Driver and Firmware on the operating environment. Then, you can view the ada process in the /usr/local/Ascend/driver/tools directory on the host.
Configuring the Environment Variables the adc Command Execution Depends On
Log in to the server as the running user of the Toolkit. After setting the environment variable, you do not need to switch to the directory where the adc command is located (for example, /home/HwHiAiUser/Ascend/ascend-toolkit/latest/toolkit/bin). Instead, you can run the adc [OPTIONS] command. If the environment variable has not been set, you need to switch to the directory where the adc command is located and run the ./adc [OPTIONS] command or the directory of the adc command/adc [OPTIONS] command.
Set the following environment variable:
export PATH=/home/HwHiAiUser/Ascend/ascend-toolkit/latest/toolkit/bin:$PATH
If GCC on the server that you have logged in to needs to be upgraded, run the gcc --version command to check the GCC version. If it is earlier than 7.3.0, upgrade GCC by referring to How Do I Install GCC 7.3.0? If GCC has been upgraded, skip this step. After GCC is upgraded, set the environment variables and start the ada daemon process as follows:
export PATH=/home/HwHiAiUser/Ascend/ascend-toolkit/latest/toolkit/tools/ide_daemon/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:{install_path}/lib64
nohup /usr/local/Ascend/driver/tools/ada &
In the preceding commands, replace {install_path} with the actual GCC 7.3.0 installation path, for example, /usr/local/gcc7.3.0/.