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.
- 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.
- If CentOS is used on the host, the listening port (22118 by default) for starting the ada process is blocked by the firewall that is enabled by default. To use the listening port, you need to configure the firewall policy.
- Log in to the host as the running user and switch to the root user.
- Ensure that the environment is connected and the source is available, and run the following commands to install iptables and iptables-services.
If a message indicates that iptables and iptables-services have been installed, you do not need to install them again.
yum install -y iptables yum install iptables-services
- Run the iptables -I INPUT -p tcp --dport 22118 -j ACCEPT command to configure the firewall policy. After the configuration is complete, run the iptables -L command to view the result.
# iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT tcp -- anywhere anywhere tcp dpt:22118
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
Preparing the Ascend RC Environment
Prepare for the installation and configuration of the developer board by referring to Atlas 200 DK User Guide. After the installation is complete, you can view the ada process in the /var directory of the developer board.
If you need to run the adc command on the server where the Toolkit is installed, install the Toolkit and the standard-form ACLlib (dependency for profile data collection) by referring to CANN Software Installation Guide. (Running the adc command on the server where Toolkit is installed is used as an example for procedure description.)
- Install the Toolkit and standard-form ACLlib in the development environment as a non-root user (for example, HwHiAiUser) in /home/HwHiAiUser/Ascend/ascend-toolkit/latest, which is an example installation path containing the toolkit and acllib directories.
- 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 is exited.
- 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 Environment Variables the adc Command Execution Depends On
- If you run the adc command on the server where Toolkit is installed:
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 you run the adc command on the developer board, you do not need to set the environment variable. Instead, run the adc command directly, for example, /var/adc --help.