Installation from Source Code
If the kernel version of the current OS is updated or inconsistent with the default version, you can rebuild and install the driver based on the source code of the installation package. In this scenario, the kernel version upgrade is not triggered, and the corresponding kernel driver is built based on the current kernel version. During the installation, driver source code building will be automatically triggered. The software package will be automatically installed after the building is complete.
Before installation from source code, you need to check and install dependencies. Switch to the root user before performing the following operations.
Installing Dependencies
Dependencies of the Source Driver Package
- Make tool
Run the make -v command. If the version of Make is displayed, Make has been installed.
- Default kernel source code path: for example, /lib/modules/`uname -r`/buildRun the ls /lib/modules/`uname -r`/build command to check whether the path exists.
- If yes, the kernel is automatically used for driver compilation during the installation of the general software package.
- If no, you can provide the source code path during installation. For details, see 8.
Alternatively, check whether DKMS has been installed. For Kylin V10, Linx 6.0.90, UOS 20, Kylin V10 SP1, NeoKylin 7.6, and Tlinux 2.4, ignore the check of DKMS.
You are advised to use the dkms-2.6.1-1.el7.noarch.rpm software package.
Ubuntu 18.04
You need to install the DKMS, GCC, and linux-header software packages. Run the following commands to check whether these software packages have been installed:
dpkg-query -s dkms
dpkg-query -s gcc
dpkg-query -s linux-headers-$(uname -r)
If they have not been installed, obtain them from the OS vendor website and install them.
CentOS 7.6/8.2
You need to install the DKMS, GCC, kernel-headers, and kernel-devel software packages. Run the following commands to check whether these software packages have been installed:
rpm -qa | grep dkms
rpm -qa | grep gcc
rpm -qa | grep kernel-headers-$(uname -r)
rpm -qa | grep kernel-devel-$(uname -r)
If they have not been installed, obtain them from the OS vendor website and install them.
EulerOS 2.8
You need to install the GCC, kernel-headers, and kernel-devel software packages. Run the following commands to check whether these software packages have been installed:
rpm -qa | grep gcc
rpm -qa | grep kernel-headers-$(uname -r)
rpm -qa | grep kernel-devel-$(uname -r)
If they have not been installed, obtain them from the OS vendor website and install them.
SLES 12 SP5
- You need to install the GCC, kernel-default, and kernel-default-devel software packages. Run the following commands to check whether these software packages have been installed:
rpm -qa | grep gcc
rpm -qa | grep kernel-default
rpm -qa | grep kernel-default-devel
If they have not been installed, obtain them from the OS vendor website and install them.
- Check whether the value of allow_unsupported_modules in the 10-unsupported-modules.conf configuration file is 1.
Run the cat /etc/modprobe.d/10-unsupported-modules.conf command to check whether the value of allow_unsupported_modules in the modprobe restriction configuration file is 1.
If not, run the vi /etc/modprobe.d/10-unsupported-modules.conf command to change the value of allow_unsupported_modules to 1.In SLES 12 SP5, you can use the 10-unsupported-modules.conf configuration file to control the loading of non-built-in drivers during system startup. By default, the value of allow_unsupported_modules in the 10-unsupported-modules.conf configuration file is 0, indicating that non-built-in drivers cannot be loaded during system startup. If the value of allow_unsupported_modules is set to 1, non-built-in drivers can be loaded during system startup.
Linx 6.0.90
Check whether the auth sufficient pam_rootok.so field in the /etc/pam.d/su configuration file has been commented out. If it has been, rectify the fault by referring to Password Is Required for Switching from the root User to a Common User.
EulerOS 2.9
- Obtain the devel_tools.tar.gz tool package of the corresponding OS version.
- Upload the devel_tools.tar.gz package to any directory in the operating environment, for example, /opt.
- Go to the directory where the devel_tools.tar.gz package is stored and decompress the package.
cd /opt
tar -xzvf devel_tools.tar.gz
- In the extracted directory in 3, run the following commands to install software packages such as kernel-headers, GCC 7.3.0, elfutils-devel, and make.
- For EulerOS 2.9+AArch64, run the following commands:
rpm -ivh kernel-headers-4.19.90-vhulk2009.2.0.h269.eulerosv2r9.aarch64.rpm kernel-devel-4.19.90-vhulk2009.2.0.h269.eulerosv2r9.aarch64.rpm
rpm -ivh binutils-2.34-1.h11.eulerosv2r9.aarch64.rpm binutils-extra-2.34-1.h11.eulerosv2r9.aarch64.rpm binutils-devel-2.34-1.h11.eulerosv2r9.aarch64.rpm zlib-devel-1.2.11-17.eulerosv2r9.aarch64.rpm cpp-7.3.0-20190804.h39.eulerosv2r9.aarch64.rpm libmpc-1.1.0-4.eulerosv2r9.aarch64.rpm glibc-devel-2.28-59.eulerosv2r9.aarch64.rpm libxcrypt-devel-4.4.8-4.h2.eulerosv2r9.aarch64.rpm
rpm -ivh gcc-7.3.0-20190804.h39.eulerosv2r9.aarch64.rpm
rpm -ivh elfutils-devel-0.179-1.h3.eulerosv2r9.aarch64.rpm
rpm -ivh make-4.2.1-15.eulerosv2r9.aarch64.rpm
- For EulerOS 2.9+AArch64, run the following commands:
Tlinux 2.4
- Obtain the installation package of GCC 8.2.1 from https://mirrors.tencent.com/tlinux/2.4/arm64/tlinux-sclo/aarch64/tl/devtoolset-8/devtoolset-8-gcc-8.2.1-3.tl2.aarch64.rpm.
- Log in to the operating environment.
- Upload the GCC installation package to a specified path, for example, /tmp.
- Run the following command to install the GCC:
rpm -Uvh devtoolset-8-gcc-8.2.1-3.tl2.aarch64.rpm --force --nodeps
- After the installation is complete, run the following command to query the path of the executable file of GCC 8.2.1:
find / -name gcc
The red box in the following figure shows the path of the executable file.
- Set environment variables.
export PATH=/opt/rh/devtoolset-8/root/usr/bin/:$PATH
- Run the following command to check whether the GCC is successfully installed:
gcc --version
If the following information is displayed, the GCC version is the same as the target version, indicating that the installation is successful:
Installing the Driver (*.run)
The .run installation packages of the Atlas 300I inference card (model 3000) are host installation packages. You need to download and decompress them on a host OS. The following describes how to install the packages on a host. For details about how to install the packages in a container, see Installation in a Container.
You can obtain the NPU version from the driver package name. For example, if the driver package name is A300-3000-NPU_Driver-20.0.0-ARM64-Ubuntu18.04.run, the NPU version is 20.0.0.
Prerequisites
Before installing the driver package, you need to check and install related dependencies. For details, see Installing Dependencies.
Precautions
- The .run installation packages support one-click installation. You can select parameters as required to complete the installation. For details, see Parameter Description.
- If a driver package whose version is NPU 1.X.X is installed, uninstall it before installing the driver package of NPU 20.X.X or later.
- After the .run installation package is used, do not manually set the environment variable export LD_LIBRARY_PATH to the .so file of the original driver package. Otherwise, the tool in the .run installation package may connect to the dynamic library of the earlier version. The third-party library file path and non-run installation package release library file path are not affected.
- During the installation or upgrade of a software package, do not reset or power off the host or device. Otherwise, device boot or upgrade fails. If this problem occurs, resolve it by referring to Failed to Start the Device Due to Reset or Power-off.
Installing the NPU 20.X.X or Later Driver Package
The following uses the A300-3000-3010-npu-driver_x.x.x_ubuntu18.04-aarch64.run as an example to describe how to install the .run driver package. Replace the package name with the actual one.
For initial installation, install the driver and then firmware; for overwrite installation or upgrade, install the firmware and then driver. For details about how to install the firmware, see Installing the Firmware (*.run).
To ensure that the driver version, firmware version, and MCU version match each other, upgrade the MCU. For details, see "Upgrading the MCU" in the Atlas 300I Inference Card NPU Driver and Firmware Upgrade Guide (Models 3000, 3010).
- Upload the driver package obtained from Obtaining Software Packages to any directory (for example, /opt) in Linux.
- Use PuTTY to log in to the OS CLI of the server where the Atlas 300I inference card (model 3000) is located. For details, see Logging In to the CLI Using PuTTY over a Network Port.
- Run the following command to switch to the root user:
su - root
- Run the following command to go to the directory where the driver package is stored, for example, /opt:
cd /opt
- Run the following command to grant the execute permission on the driver package:
chmod +x A300-3000-3010-npu-driver_x.x.x_ubuntu18.04-aarch64.run
- Run the following command to check the consistency and integrity of the .run installation package:
./A300-3000-3010-npu-driver_x.x.x_ubuntu18.04-aarch64.run --check
If the following information is displayed, the driver package verification is successful:Verifying archive integrity... 100% SHA256 checksums are OK. All good.
The SHA256 encryption mode is used for software package verification. If "./A300-3000-3010-npu-driver_x.x.x_ubuntu18.04-aarch64.run does not contain an embedded MD5 checksum" and "./A300-3000-3010-npu-driver_x.x.x_ubuntu18.04-aarch64.run does not contain a CRC checksum" are displayed during the verification, the MD5 and CRC encryption modes are not used and can be ignored.
- Run the installation command.
- If you specify an installation path, for example, /test/HiAI/,
run the ./A300-3000-3010-npu-driver_x.x.x_ubuntu18.04-aarch64.run --full --install-path= /test/HiAI/ command to complete the installation.
- If the installation path is not specified, run the ./A300-3000-3010-npu-driver_x.x.x_ubuntu18.04-aarch64.run --full command to complete the installation.
- During the driver installation, the dynamic library libdcmi.so and header file dcmi_interface_api.h are copied to the /usr/local/dcmi/ directory.
- For details about how to resolve problems that may occur during the installation of the .run installation package, see FAQs.
- If the created running user is not HwHiAiUser, you need to specify a running user (specified by the --install-username=username --install-usergroup=usergroup parameter) when installing the driver package.
- If an installation path is specified during the driver installation:
- In the scenario where the specified path does not exist, a directory is automatically created during the installation. If there are multiple levels of directories, the directory is automatically created only when the last level of directory does not exist.
- In the scenario where the specified path exists:
- If the owner of all levels of directories in the path is the root user, ensure that the permission on all levels of directories is at least 755.
- If the owner of a level-1 directory in the path is not the root user, change the owner to the root user and ensure that the permission on all levels of directories is 755.
- Default installation path: /usr/local/Ascend
- Installation log path: /var/log/ascend_seclog/ascend_install.log
- Path where the installation path, installation command, and user information of the software package after installation are stored: /etc/ascend_install.info
- If you install the driver using an NPU 20.0.X or NPU 20.1.X driver package as a non-HwHiAiUser user, uninstall it, and then reinstall it as the HwHiAiUser user, error message "/home/HwHiAiUser: Permission denied" may be reported. In this case, ignore the error.
- If an NPU 20.2.X or later software package is used for installation, the system logs on the device are transmitted to the host using the msnpureport tool for viewing. For details about the export operation and the storage path of the exported logs, see "msnpureport Instructions" in the Ascend 310 Black Box Log Reference.
In a container, system logs on the device cannot be viewed and cannot be exported using the msnpureport tool.
- If you specify an installation path, for example, /test/HiAI/,
- (Optional) For a source driver package, if the following information is displayed, DKMS has not been installed and the default kernel source code path, for example, /lib/modules/`uname -r`/build, does not exist. Enter the required information as prompted.
[WARNING]rebuild ko has something wrong, detail in /var/log/ascend_seclog/ascend_rebuild.log Do you want to try build driver after input kernel absolute path? [y/n]:
If you want to continue the installation, enter y.
When the following information is displayed, enter the actual path of the kernel source code, for example, /lib/modules/`uname -r`/build-bak:
Please input your kernel absolute path:
Press Enter to continue the installation.
- If DKMS and related components such as kernel-header and kernel-devel have been installed, the system automatically compiles and installs the DKMS driver.
- If DKMS has not been installed but the default kernel source code path (for example, /lib/modules/`uname -r`/build) already exists, the kernel is automatically used for driver compilation.
- If the system displays a message indicating that the installation is successful, the driver is successfully installed. Determine whether to restart the system based on the displayed information. If the system needs to be restarted, perform the following operations. Otherwise, skip this step.
- After the installation is complete, run the reboot command on the host OS to reboot the host or power off and then power on the host.
- After the host is rebooted, the driver and services are automatically installed. The Ascend 310 automatically enters the OS.
- Run the npu-smi info command to check whether the driver is successfully loaded.If the following message is displayed, the loading is successful. Otherwise, the installation fails. Contact Huawei technical support.
+------------------------------------------------------------------------------+ | npu-smi 20.0.1 Version: 1.73.5.10.050 | +-------------------+-----------------+----------------------------------------+ | NPU Name | Health | Power(W) Temp(C) | | Chip Device | Bus-Id | AICore(%) Memory-Usage(MB) | +===================+=================+========================================+ | 2049 310 | OK | 12.8 50 | | 0 0 | 0000:85:00.0 | 0 2621 / 8192 | +-------------------+-----------------+----------------------------------------+ | 2049 310 | OK | 12.8 51 | | 1 1 | 0000:86:00.0 | 0 2621 / 8192 | +-------------------+-----------------+----------------------------------------+ | 2049 310 | OK | 12.8 52 | | 2 2 | 0000:87:00.0 | 0 2621 / 8192 | +-------------------+-----------------+----------------------------------------+ | 2049 310 | OK | 12.8 55 | | 3 3 | 0000:88:00.0 | 0 2621 / 8192 | +===================+=================+========================================+
In the command output, the field following npu-smi indicates the npu-smi tool version, and the field following Version: indicates the driver version.
Follow-up Procedure
If an NPU 20.2.X or later package is used for installation, skip this step. If an NPU 20.0.X or NPU 20.1.X software package is used for installation, the ADA enables the listening port 22118 by default. To ensure system security, disable this port in a commercial environment.
/usr/local/Ascend/driver is the default installation path for installing the driver (add-ons is installed with the driver) as the root user. The following uses this path as an example to describe the operation procedure. Replace it with the actual path.
When you install the OS as the root user, the HwHiAiUser user is the default process running user in the OS. The following uses the HwHiAiUser user as an example to describe the operation procedure.
Run the su - HwHiAiUser command to switch to the running user, log in to the OS, and open the /home/HwHiAiUser/ide_daemon/ide_daemon.cfg file.
If the value of SOCK_SWITCH is 0, the ADA port is disabled.
If the value of SOCK_SWITCH is 1, the ADA port is enabled. You need to manually change the value of SOCK_SWITCH to 0.
Run the wq! command to save the settings and exit.
- Switch to the /usr/local/Ascend/driver/tools directory and run the following commands in sequence to set environment variables and restart the ada process or run the reboot command to restart the OS.
Set the environment variable.
export LD_LIBRARY_PATH=/usr/local/Ascend/add-ons:$LD_LIBRARY_PATH
Query the ID of the ada process.
ps -ef | grep ada
Stop the ada process.
kill -9 ada process ID
Start the ada process.
If the message "ada is exist, don't start again" is displayed when you run the following command, the system has automatically started the ada process.
/usr/local/Ascend/driver/tools/ada
Installing the NPU 1.X.X Driver Package
The following uses A800-3000-NPU-Ubuntu18.04-ARM-Vx.x.x.run as an example to describe how to install the .run driver package. Replace the package name with the actual one.
Only the full mode is supported for installation.
- Upload the driver package obtained from Obtaining Software Packages to any directory (for example, /opt) in Linux.
- Use PuTTY to log in to the OS CLI of the server where the Atlas 300I inference card (model 3000) is located. For details, see Logging In to the CLI Using PuTTY over a Network Port.
- Run the following command to switch to the root user:
su - root
- Run the following command to go to the directory where the driver package is stored, for example, /opt:
cd /opt
- Run the following command to grant the execute permission on the driver package:
chmod +x A800-3000-NPU-Ubuntu18.04-ARM-Vx.x.x.run
- Run the following command to check the consistency and integrity of the .run installation package:
./A800-3000-NPU-Ubuntu18.04-ARM-Vx.x.x.run --check
If the following information is displayed, the driver package verification is successful:Verifying archive integrity... 100% SHA256 checksums are OK. All good.
- Set the installation path.
- If you need to specify the installation path, you need to create it first. /test/HiAI/ is used as an example. Run the mkdir /test/HiAI/ command to create the installation path, and then select the installation path to install the software.
- If you do not need to specify the installation path, the installation package will be installed in the default path /usr/local/HiAI.
- Run the installation command.
One-click installation is supported.
- If you specify an installation path, for example, /test/HiAI/,
run the ./A800-3000-NPU-Ubuntu18.04-ARM-Vx.x.x.run --full --path /test/HiAI/ command to complete the installation.
- If the installation path is not specified, run the ./A800-3000-NPU-Ubuntu18.04-ARM-Vx.x.x.run --full command to complete the installation.
- During the driver installation, the dynamic library libdcmi.so and header file dcmi_interface_api.h are copied to the /usr/local/dcmi/ directory.
- For details about how to resolve problems that may occur during the installation of the .run installation package, see FAQs.
- During the installation, the Ascend 310 driver and firmware installation and upgrade logs are stored in the /var/log/HiAI-install.log file. You can run the ./*.run --viewlog command to view the logs. The npu-smi tool installation logs are stored in /var/log/it_logs.
- If the message "drv_dkms_env_check failed, details in: /var/log/HiAI-install.log" is displayed during driver installation, view the log information. If the log information contains "The program'dkms' is currently not installed", the DKMS is missing. Install the DKMS. For details, see "drv_dkms_env_check failed, details in: /var/log/HiAI-install.log" Is Displayed During Driver Installation.
- If you specify an installation path, for example, /test/HiAI/,
- After the .run installation package is installed, you need to reset the host. After the host is reset, the running Ascend 310 software and mini firmware are the latest ones. To reset the host, perform the following steps:
- After the installation is complete, run the reboot command on the host OS to reboot the host or power off and then power on the host.
- After the host is rebooted, the driver and services are automatically installed. The Ascend 310 automatically enters the OS.
- Run the npu-smi info command to check whether the driver is successfully loaded.If the following message is displayed, the loading is successful. Otherwise, the loading fails. Contact Huawei technical support.
root@atlas-G560:~# npu-smi info +------------------------------------------------------------------------------+ | npu-smi 1.1.2 Version: 1.1.T19.B880 | +-------------------+-----------------+----------------------------------------+ | NPU Name | Health | Power(W) Temp(C) | | Chip | Bus-Id | AICore(%) Memory-Usage(MB) | +===================+=================+========================================+ | 77 HI1910 | Warning | 12.8 61 | | 0 | 0000:4F:00.0 | 0 2457 / 8192 | +-------------------+-----------------+----------------------------------------+ | 77 HI1910 | OK | 12.8 58 | | 1 | 0000:53:00.0 | 0 2375 / 8192 | +-------------------+-----------------+----------------------------------------+ | 77 HI1910 | OK | 12.8 57 | | 2 | 0000:57:00.0 | 0 2375 / 8192 | +-------------------+-----------------+----------------------------------------+ | 77 HI1910 | OK | 12.8 58 | | 3 | 0000:5B:00.0 | 0 2375 / 8192 | +===================+=================+========================================+
In the command output, the field following npu-smi indicates the npu-smi tool version, and the field following Version: indicates the driver/processor firmware version.