Installing a Driver
If a device has been managed by FusionDirector, the driver version displayed on the FusionDirector GUI will be updated with a delay of at most one hour after a driver is installed. The version is updated immediately after the device is restarted.
Installation Modes
Select a driver installation mode by referring to Figure 8-2.
- If the OS kernel version in the operating environment is a derivative one of the kernel versions listed in the version mapping, the driver can be installed by compiling the source code. However, the compilation may fail.
- For EulerOS-Virtual-V200R009C10, the kernel version of the host OS must meet the requirements listed in the version mapping. The source code compilation is not supported.
- In the EulerOS 2.8 scenario, the kernel version of the OS must be the same as the default OS version in the version mapping. If they are inconsistent, update the kernel version. Otherwise, an error is reported during the installation, indicating that some chips cannot be started.
System Compatibility Requirements
- PCIe MSI-X interrupts are supported. At least 464 MSI-X interrupts can be allocated to each Atlas 300I inference card.
- Bar space requirements:
The size of the three bars required by an Atlas 300I inference card is 512 KB, 64 MB, and 256 MB respectively.
Environment Check
No. |
Check Item |
Command |
Description |
---|---|---|---|
1 |
OS kernel version |
uname -r |
If the .run package has been installed in the host system, the .run package fails to be started after the kernel is updated. If this problem occurs, resolve the problem. For details, see What Do I Do If the RUN Package Is Unavailable Because the RUN Package Is Not Uninstalled When Upgrading the OS Kernel?. |
2 |
GCC version |
gcc -v |
|
3 |
Whether a software package has been installed in the system |
lsmod|grep drv_pcie_host |
|
4 |
Presence status of the card |
lspci | grep d100 |
|
5 (optional) |
Linux tools required for driver installation |
N/A |
Check the required Linux tools according to Table 8-8 and install them. If the tools are not installed, the system displays a message during the installation. You can install the tools according to the message. |
6 (optional) |
Relevant configuration files |
N/A |
|
Direct Installation Using a Binary File
Installing a Driver (*.run)
This section uses the {product name}-npu-driver_x.x.x_linux-{arch}.run package as an example to describe how to install a driver on a host machine. Use the driver package that matches the host OS.
Precautions
- 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.
- 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.
Procedure
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).
If the --install for all option is used during the initial installation, retain it during any overwrite installation.
For the Atlas 300I inference card (model 3000), to ensure that the driver, firmware, and MCU versions match, see the MCU in "Upgrading the MCU" in the Atlas 300I Inference Card NPU Driver and Firmware Upgrade Guide (Models 3000, 3010) of the required version.
- 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.
- Run the following command to switch to the root user:
su - root
- Run the following command to go to the directory where the software package is stored, for example, /opt:
cd /opt
- Run the following command to grant the execute permission on the software package:
chmod +x {product name}-npu-driver_x.x.x_linux-{arch}.run
- Run the following command to check the consistency and integrity of the .run installation package:
./{product name}-npu-driver_x.x.x_linux-{arch}.run --check
If the following information is displayed, the software 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 "./{product name}-npu-driver_x.x.x_linux-{arch}.run does not contain an embedded MD5 checksum. and "./{product name}-npu-driver_x.x.x_linux-{arch}.run does not contain a CRC checksum" are displayed during verification, the MD5 and CRC encryption modes are not used. In this case, ignore them.
- Run the ./{product name}-npu-driver_x.x.x_linux-{arch}.run --full command to install the driver. The default installation path of the software package is /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 package after installation is stored: /etc/ascend_install.info
- During the .run package installation, the dynamic library libdcmi.so and header file dcmi_interface_api.h are copied to the /usr/local/dcmi/ directory.
- If the created running user is not HwHiAiUser, you need to specify a running user using the --install-username=username --install-usergroup=usergroup parameter when installing the driver package.
- If the root user is specified as the running user, the --install-for-all parameter must be included in the installation command as follows. In this scenario, security risks may exist.
--install-username=root --install-usergroup=root --install-for-all
- If the server does not have a BMC, you can only install the driver in the default path. If a specified path is used for the installation, loading of the ipmi_si driver will be blocked. As a result, the disk mounting is slow, affecting the normal running of the NPUs.
- Device-side system logs are transferred to the host by using the msnpureport tool. For details about the export operation and the storage path of the exported logs, see "msnpureport Instructions" in the Black Box Log Reference of the corresponding product and version. In a container, system logs on the device cannot be viewed and cannot be exported using the msnpureport tool.
- If the message "driver ko vermagic(*) is different from the os(*), need rebuild driver" is displayed during the driver installation, rectify the fault by referring to Installation from Source Code.
If you specify an installation path, for example, /test/HiAI/:
You can run the ./{product name}-npu-driver_x.x.x_linux-{arch}.run --full --install-path=/test/HiAI/ command to complete the 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 this requirement is not met, run the chmod 755 path command to change the permission on the path.
- 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. If this requirement is not met, run the chown root:group name path command to change the path owner to root.
If the following information is displayed, the driver is successfully installed:Driver package installed successfully!
- Determine whether to restart the system based on the displayed information. If the system needs to be restarted, run the following command. Otherwise, skip this step.
reboot
- 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.
+----------------------------------------------------------------------------------------------------+ | npu-smi 21.0.4 Version: 21.0.4.B030 | +-------------------+-----------------+--------------------------------------------------------------+ | NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page) | | Chip Device | Bus-Id | AICore(%) Memory-Usage(MB) | +===================+=================+==============================================================+ | 6 310 | OK | 12.8 73 0 / 970 | | 0 3 | 0000:89:00.0 | 0 2703 / 8192 | +-------------------+-----------------+--------------------------------------------------------------+ | 6 310 | OK | 12.8 74 0 / 970 | | 1 4 | 0000:8A:00.0 | 0 2867 / 8192 | +-------------------+-----------------+--------------------------------------------------------------+ | 6 310 | OK | 12.8 70 0 / 970 | | 2 5 | 0000:8B:00.0 | 0 2867 / 8192 | +-------------------+-----------------+--------------------------------------------------------------+ | 6 310 | OK | 12.8 65 0 / 970 | | 3 6 | 0000:8C:00.0 | 0 2867 / 8192 | +===================+=================+==============================================================+
- If the loading fails, run the dmesg command to view the Linux startup logs. If "/installation_path/driver/device/davinci_mini.fd copy err" is displayed, uninstall the current driver and use the default path to reinstall the driver again. For details, see Uninstalling a Driver (*.run).
- In the command output, the field following npu-smi indicates the npu-smi tool version, and the field following Version: indicates the driver version.
Installing a Driver (*.rpm)
The following uses the {product name}-npu-driver-x.x.x-<release>.{arch}.rpm package as an example to describe how to install the .rpm driver package. Replace the package name with the actual one.
Precautions
- If an .rpm software package of NPU 20.X.X or later is used for installation, the npu-smi tool is integrated in the driver package. During the driver installation, the npu-smi tool is automatically installed.
- The installation path of the .rpm package cannot be changed. You need to install the .rpm package according to the normal process. The --force command of the .rpm package cannot be used for installation and upgrade.
- Some internal functions of the Ascend 310 can be accessed and executed only by the HwHiAiUser user. The HwHiAiUser user is automatically created upon the first installation.
- If the .rpm package of NPU 1.X.X has been installed, uninstall it before installing the .rpm package of NPU 20.X.X or later.
- 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.
Procedure
Install the driver package and then the firmware package. For details about how to install the firmware, see Installing the Firmware (*.rpm).
- 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.
- Run the following command to switch to the root user:
su - root
- Run the following command in the directory where the software package is stored to install the driver package on the host:
rpm -ivh {product name}-npu-driver-x.x.x-<release>.{arch}.rpm
If the HwHiAiUser user does not exist during the installation, the system automatically creates it.
If the following information is displayed, the driver is successfully installed:Driver package installed successfully!
- Determine whether to restart the system based on the displayed information. If the system needs to be restarted, run the following command. Otherwise, skip this step.
reboot
- 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.
+----------------------------------------------------------------------------------------------------+ | npu-smi 21.0.4 Version: 21.0.4.B030 | +-------------------+-----------------+--------------------------------------------------------------+ | NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page) | | Chip Device | Bus-Id | AICore(%) Memory-Usage(MB) | +===================+=================+==============================================================+ | 6 310 | OK | 12.8 73 0 / 970 | | 0 3 | 0000:89:00.0 | 0 2703 / 8192 | +-------------------+-----------------+--------------------------------------------------------------+ | 6 310 | OK | 12.8 74 0 / 970 | | 1 4 | 0000:8A:00.0 | 0 2867 / 8192 | +-------------------+-----------------+--------------------------------------------------------------+ | 6 310 | OK | 12.8 70 0 / 970 | | 2 5 | 0000:8B:00.0 | 0 2867 / 8192 | +-------------------+-----------------+--------------------------------------------------------------+ | 6 310 | OK | 12.8 65 0 / 970 | | 3 6 | 0000:8C:00.0 | 0 2867 / 8192 | +===================+=================+==============================================================+
- If the loading fails, run the dmesg command to view the Linux startup logs. If "/installation_path/driver/device/davinci_mini.fd copy err" is displayed, uninstall the current driver and use the default path to reinstall the driver again. For details, see Uninstalling a Driver (*.run).
- In the command output, the field following npu-smi indicates the npu-smi tool version, and the field following Version: indicates the driver version.
Installing a Driver (*.deb)
With dpkg
Installation as the Default Running User HwHiAiUser
- 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.
- Run the following command to switch to the root user:
su - root
- Run the following command to go to the directory where the software package is stored, for example, /opt:
cd /opt
- (Optional) Run the following command to call --install-for-all to grant other users the permissions of the installation group:
export ASCEND_INSTALL_FOR_ALL=true
If the --install for all option is used during the initial installation, retain it during any overwrite installation.
If this parameter is included in the installation or upgrade command, all users have the same permission on the directories and files created by the runfile installation engineer as the installation group. Make sure the security risks are considered before you include this parameter.
- Run the following command to install the .deb driver package (replace the driver package name based on the site requirements):
dpkg -i {product name}-npu-driver_x.x.x_linux-{arch}.deb
If the following information is displayed, the driver is successfully installed:Driver package installed successfully!
- Determine whether to restart the system based on the displayed information. If the system needs to be restarted, run the following command. Otherwise, skip this step.
reboot
- Run the following command to query the driver installation information:
dpkg -l | grep Ascend
Specifying an Installation User
- 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.
- Run the following command to switch to the root user:
su - root
- Run the following command to go to the directory where the software package is stored, for example, /opt:
cd /opt
- (Optional) Run the following command to call --install-for-all to grant other users the permissions of the installation group:
export ASCEND_INSTALL_FOR_ALL=true
If the --install for all option is used during the initial installation, retain it during any overwrite installation.
If this parameter is included in the installation or upgrade command, all users have the same permission on the directories and files created by the runfile installation engineer as the installation group. Make sure the security risks are considered before you include this parameter.
- Set environment variables.
If the root user is specified as the environment variable, export ASCEND_INSTALL_FOR_ALL=true is required. In this scenario, permission control may have security risks.
- Set environment variables in export mode. In this mode, the environment variables take effect immediately but are valid only in the current window.
export ASCEND_USER_GROUP=usergroup
export ASCEND_USER_NAME=username
- Modify the ~/.bashrc file to set the permanent environment variables.
- Run the vi ~/.bashrc command in any directory as the installation 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.
- Set environment variables in export mode. In this mode, the environment variables take effect immediately but are valid only in the current window.
- Run the following commands to add the created user to the created user group:
groupadd ${ASCEND_USER_GROUP}
useradd -g ${ASCEND_USER_GROUP} -d /home/${ASCEND_USER_NAME} -m ${ASCEND_USER_NAME} -s /bin/bash
- Run the following command to install the .deb driver package (replace the driver package name based on the site requirements):
dpkg -i {product name}-npu-driver_x.x.x_linux-{arch}.deb
If the following information is displayed, the driver is successfully installed:Driver package installed successfully!
- Determine whether to restart the system based on the displayed information. If the system needs to be restarted, run the following command. Otherwise, skip this step.
reboot
- Run the following command to query the driver installation information:
dpkg -l | grep Ascend
- (Optional) Run the following commands to clear related environment variables:
unset ASCEND_USER_NAME
unset ASCEND_USER_GROUP
unset ASCEND_INSTALL_FOR_ALL
With apt-get
Installation as the Default User
- (Optional) Run the following command to call --install-for-all to grant other users the permissions of the installation group:
export ASCEND_INSTALL_FOR_ALL=true
If the --install for all option is used during the initial installation, retain it during any overwrite installation.
If this parameter is included in the installation or upgrade command, all users have the same permission on the directories and files created by the runfile installation engineer as the installation group. Make sure the security risks are considered before you include this parameter.
- Run the following command to install the .deb driver package in the local source:
- Initial installation
apt-get install ascend310-driver
- Reinstallation
apt-get --reinstall install ascend310-driver
If the following information is displayed, the driver is successfully installed:Driver package installed successfully!
- Initial installation
- Determine whether to restart the system based on the displayed information. If the system needs to be restarted, run the following command. Otherwise, skip this step.
reboot
- Run the following command to query the driver installation information:
apt list ascend310-driver
Specifying an Installation User
- (Optional) Run the following command to call --install-for-all to grant other users the permissions of the installation group:
export ASCEND_INSTALL_FOR_ALL=true
If the --install for all option is used during the initial installation, retain it during any overwrite installation.
If this parameter is included in the installation or upgrade command, all users have the same permission on the directories and files created by the runfile installation engineer as the installation group. Make sure the security risks are considered before you include this parameter.
- Set environment variables.
If the root user is specified as the environment variable, export ASCEND_INSTALL_FOR_ALL=true is required. In this scenario, permission control may have security risks.
- Set environment variables in export mode. In this mode, the environment variables take effect immediately but are valid only in the current window.
export ASCEND_USER_GROUP=usergroup
export ASCEND_USER_NAME=username
- Modify the ~/.bashrc file to set the permanent environment variables.
- Run the vi ~/.bashrc command in any directory as the installation 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.
- Set environment variables in export mode. In this mode, the environment variables take effect immediately but are valid only in the current window.
- Run the following commands to add the created user to the created user group:
groupadd ${ASCEND_USER_GROUP}
useradd -g ${ASCEND_USER_GROUP} -d /home/${ASCEND_USER_NAME} -m ${ASCEND_USER_NAME} -s /bin/bash
- Run the following command to install the .deb driver package in the local source:
- Initial installation
apt-get install ascend310-driver
- Reinstallation
apt-get --reinstall install ascend310-driver
If the following information is displayed, the driver is successfully installed:Driver package installed successfully!
- Initial installation
- Determine whether to restart the system based on the displayed information. If the system needs to be restarted, run the following command. Otherwise, skip this step.
reboot
- Run the following command to query the driver installation information:
apt list ascend310-driver
- (Optional) Run the following commands to clear related environment variables:
unset ASCEND_USER_NAME
unset ASCEND_USER_GROUP
unset ASCEND_INSTALL_FOR_ALL
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
Make Tool
Run the make -v command. If the version of Make is displayed, Make has been installed.
Installing Dependencies Using Default Kernel Source Code Path or Software Packages
- For the following OSs, check whether the software packages, such as DKMS, GCC, and linux-header, have been installed.
- For other OSs, check whether the path of the default kernel source code exists, for example: /lib/modules/`uname -r`/build.Run the ls /lib/modules/`uname -r`/build command to check whether the path exists.
- If it exists, the kernel is automatically used to compile the driver when the driver package is installed.
- If not, you can provide the source code path during installation. For details, see 8.
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-headers 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.
Ubuntu 20.04
You need to install the DKMS, GCC, and linux-headers 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
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.
CentOS 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.
EulerOS 2.10
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.
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, in the /opt directory.
- 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 directory generated after the decompression 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.
- Configure 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 a Driver (*.run)
This section uses the {product name}-npu-driver_x.x.x_linux-{arch}.run package as an example to describe how to install a driver on a host machine.
Prerequisites
Before installing the driver package, you need to check and install related dependencies. For details, see Installing Dependencies.
Precautions
- 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.
- 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.
Procedure
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).
If the --install for all option is used during the initial installation, retain it during any overwrite installation.
For the Atlas 300I inference card (model 3000), to ensure that the driver, firmware, and MCU versions match, see the MCU in "Upgrading the MCU" in the Atlas 300I Inference Card NPU Driver and Firmware Upgrade Guide (Models 3000, 3010) of the required version.
- 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.
- Run the following command to switch to the root user:
su - root
- Run the following command to go to the directory where the software package is stored, for example, /opt:
cd /opt
- Run the following command to grant the execute permission on the software package:
chmod +x {product name}-npu-driver_x.x.x_linux-{arch}.run
- Run the following command to check the consistency and integrity of the .run installation package:
./{product name}-npu-driver_x.x.x_linux-{arch}.run --check
If the following information is displayed, the software 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 "./{product name}-npu-driver_x.x.x_linux-{arch}.run does not contain an embedded MD5 checksum. and "./{product name}-npu-driver_x.x.x_linux-{arch}.run does not contain a CRC checksum" are displayed during verification, the MD5 and CRC encryption modes are not used. In this case, ignore them.
- Run the ./{product name}-npu-driver_x.x.x_linux-{arch}.run --full command to install the driver. The default installation path of the software package is /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 package after installation is stored: /etc/ascend_install.info
- During the .run package installation, the dynamic library libdcmi.so and header file dcmi_interface_api.h are copied to the /usr/local/dcmi/ directory.
- If the created running user is not HwHiAiUser, you need to specify a running user using the --install-username=username --install-usergroup=usergroup parameter when installing the driver package.
- If the root user is specified as the running user, the --install-for-all parameter must be included in the installation command as follows. In this scenario, security risks may exist.
--install-username=root --install-usergroup=root --install-for-all
- If the server does not have a BMC, you can only install the driver in the default path. If a specified path is used for the installation, loading of the ipmi_si driver will be blocked. As a result, the disk mounting is slow, affecting the normal running of the NPUs.
- Device-side system logs are transferred to the host by using the msnpureport tool. For details about the export operation and the storage path of the exported logs, see "msnpureport Instructions" in the Black Box Log Reference of the corresponding product and version. 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/:
You can run the ./{product name}-npu-driver_x.x.x_linux-{arch}.run --full --install-path=/test/HiAI/ command to complete the 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 this requirement is not met, run the chmod 755 path command to change the permission on the path.
- 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. If this requirement is not met, run the chown root:group name path command to change the path owner to root.
- (Optional) If the following information is displayed during the installation, the DKMS has not been installed and the default kernel source code path, for example, /lib/modules/`uname -r`/build, does not exist. Enter the following 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 following information is displayed, the driver is successfully installed:
Driver package installed successfully!
- Determine whether to restart the system based on the displayed information. If the system needs to be restarted, run the following command. Otherwise, skip this step.
reboot
- 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.
+----------------------------------------------------------------------------------------------------+ | npu-smi 21.0.4 Version: 21.0.4.B030 | +-------------------+-----------------+--------------------------------------------------------------+ | NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page) | | Chip Device | Bus-Id | AICore(%) Memory-Usage(MB) | +===================+=================+==============================================================+ | 6 310 | OK | 12.8 73 0 / 970 | | 0 3 | 0000:89:00.0 | 0 2703 / 8192 | +-------------------+-----------------+--------------------------------------------------------------+ | 6 310 | OK | 12.8 74 0 / 970 | | 1 4 | 0000:8A:00.0 | 0 2867 / 8192 | +-------------------+-----------------+--------------------------------------------------------------+ | 6 310 | OK | 12.8 70 0 / 970 | | 2 5 | 0000:8B:00.0 | 0 2867 / 8192 | +-------------------+-----------------+--------------------------------------------------------------+ | 6 310 | OK | 12.8 65 0 / 970 | | 3 6 | 0000:8C:00.0 | 0 2867 / 8192 | +===================+=================+==============================================================+
- If the loading fails, run the dmesg command to view the Linux startup logs. If "/installation_path/driver/device/davinci_mini.fd copy err" is displayed, uninstall the current driver and use the default path to reinstall the driver again. For details, see Uninstalling a Driver (*.run).
- In the command output, the field following npu-smi indicates the npu-smi tool version, and the field following Version: indicates the driver version.
Installing a Driver (*.rpm)
The following uses the {product name}-npu-driver-x.x.x-<release>.{arch}.rpm package as an example to describe how to install the .rpm driver package. Replace the package name with the actual one.
Prerequisites
Before installing the driver package, you need to check and install related dependencies. For details, see Installing Dependencies.
Precautions
- If an .rpm software package of NPU 20.X.X or later is used for installation, the npu-smi tool is integrated in the driver package. During the driver installation, the npu-smi tool is automatically installed.
- The installation path of the .rpm package cannot be changed. You need to install the .rpm package according to the normal process. The --force command of the .rpm package cannot be used for installation and upgrade.
- Some internal functions of the Ascend 310 can be accessed and executed only by the HwHiAiUser user. The HwHiAiUser user is automatically created upon the first installation.
- If the .rpm package of NPU 1.X.X has been installed, uninstall it before installing the .rpm package of NPU 20.X.X or later.
- 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.
Procedure
Install the driver package and then the firmware package. For details about how to install the firmware, see Installing the Firmware (*.rpm).
- 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.
- Run the following command to switch to the root user:
su - root
- Run the following command in the directory where the software package is stored to install the driver package on the host:
rpm -ivh {product name}-npu-driver-x.x.x-<release>.{arch}.rpm
If the HwHiAiUser user does not exist during the installation, the system automatically creates it.
If the following information is displayed, the driver is successfully installed:Driver package installed successfully!
- Determine whether to restart the system based on the displayed information. If the system needs to be restarted, run the following command. Otherwise, skip this step.
reboot
- 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.
+----------------------------------------------------------------------------------------------------+ | npu-smi 21.0.4 Version: 21.0.4.B030 | +-------------------+-----------------+--------------------------------------------------------------+ | NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page) | | Chip Device | Bus-Id | AICore(%) Memory-Usage(MB) | +===================+=================+==============================================================+ | 6 310 | OK | 12.8 73 0 / 970 | | 0 3 | 0000:89:00.0 | 0 2703 / 8192 | +-------------------+-----------------+--------------------------------------------------------------+ | 6 310 | OK | 12.8 74 0 / 970 | | 1 4 | 0000:8A:00.0 | 0 2867 / 8192 | +-------------------+-----------------+--------------------------------------------------------------+ | 6 310 | OK | 12.8 70 0 / 970 | | 2 5 | 0000:8B:00.0 | 0 2867 / 8192 | +-------------------+-----------------+--------------------------------------------------------------+ | 6 310 | OK | 12.8 65 0 / 970 | | 3 6 | 0000:8C:00.0 | 0 2867 / 8192 | +===================+=================+==============================================================+
- If the loading fails, run the dmesg command to view the Linux startup logs. If "/installation_path/driver/device/davinci_mini.fd copy err" is displayed, uninstall the current driver and use the default path to reinstall the driver again. For details, see Uninstalling a Driver (*.run).
- In the command output, the field following npu-smi indicates the npu-smi tool version, and the field following Version: indicates the driver version.
Installing a Driver (*.deb)
Before installing the driver package, you need to check and install related dependencies. For details, see Installing Dependencies.
With dpkg
Installation as the Default Running User HwHiAiUser
- 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.
- Run the following command to switch to the root user:
su - root
- Run the following command to go to the directory where the software package is stored, for example, /opt:
cd /opt
- (Optional) Run the following command to call --install-for-all to grant other users the permissions of the installation group:
export ASCEND_INSTALL_FOR_ALL=true
If the --install for all option is used during the initial installation, retain it during any overwrite installation.
If this parameter is included in the installation or upgrade command, all users have the same permission on the directories and files created by the runfile installation engineer as the installation group. Make sure the security risks are considered before you include this parameter.
- Run the following command to install the .deb driver package (replace the driver package name based on the site requirements):
dpkg -i {product name}-npu-driver_x.x.x_linux-{arch}.deb
If the following information is displayed, the driver is successfully installed:Driver package installed successfully!
- Determine whether to restart the system based on the displayed information. If the system needs to be restarted, run the following command. Otherwise, skip this step.
reboot
- Run the following command to query the driver installation information:
dpkg -l | grep Ascend
Specifying an Installation User
- 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.
- Run the following command to switch to the root user:
su - root
- Run the following command to go to the directory where the software package is stored, for example, /opt:
cd /opt
- (Optional) Run the following command to call --install-for-all to grant other users the permissions of the installation group:
export ASCEND_INSTALL_FOR_ALL=true
If the --install for all option is used during the initial installation, retain it during any overwrite installation.
If this parameter is included in the installation or upgrade command, all users have the same permission on the directories and files created by the runfile installation engineer as the installation group. Make sure the security risks are considered before you include this parameter.
- Set environment variables.
If the root user is specified as the environment variable, export ASCEND_INSTALL_FOR_ALL=true is required. In this scenario, permission control may have security risks.
- Set environment variables in export mode. In this mode, the environment variables take effect immediately but are valid only in the current window.
export ASCEND_USER_GROUP=usergroup
export ASCEND_USER_NAME=username
- Modify the ~/.bashrc file to set the permanent environment variables.
- Run the vi ~/.bashrc command in any directory as the installation 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.
- Set environment variables in export mode. In this mode, the environment variables take effect immediately but are valid only in the current window.
- Run the following commands to add the created user to the created user group:
groupadd ${ASCEND_USER_GROUP}
useradd -g ${ASCEND_USER_GROUP} -d /home/${ASCEND_USER_NAME} -m ${ASCEND_USER_NAME} -s /bin/bash
- Run the following command to install the .deb driver package (replace the driver package name based on the site requirements):
dpkg -i {product name}-npu-driver_x.x.x_linux-{arch}.deb
If the following information is displayed, the driver is successfully installed:Driver package installed successfully!
- Determine whether to restart the system based on the displayed information. If the system needs to be restarted, run the following command. Otherwise, skip this step.
reboot
- Run the following command to query the driver installation information:
dpkg -l | grep Ascend
- (Optional) Run the following commands to clear related environment variables:
unset ASCEND_USER_NAME
unset ASCEND_USER_GROUP
unset ASCEND_INSTALL_FOR_ALL
With apt-get
Installation as the Default User
- (Optional) Run the following command to call --install-for-all to grant other users the permissions of the installation group:
export ASCEND_INSTALL_FOR_ALL=true
If the --install for all option is used during the initial installation, retain it during any overwrite installation.
If this parameter is included in the installation or upgrade command, all users have the same permission on the directories and files created by the runfile installation engineer as the installation group. Make sure the security risks are considered before you include this parameter.
- Run the following command to install the .deb driver package in the local source:
- Initial installation
apt-get install ascend310-driver
- Reinstallation
apt-get --reinstall install ascend310-driver
If the following information is displayed, the driver is successfully installed:Driver package installed successfully!
- Initial installation
- Determine whether to restart the system based on the displayed information. If the system needs to be restarted, run the following command. Otherwise, skip this step.
reboot
- Run the following command to query the driver installation information:
apt list ascend310-driver
Specifying an Installation User
- (Optional) Run the following command to call --install-for-all to grant other users the permissions of the installation group:
export ASCEND_INSTALL_FOR_ALL=true
If the --install for all option is used during the initial installation, retain it during any overwrite installation.
If this parameter is included in the installation or upgrade command, all users have the same permission on the directories and files created by the runfile installation engineer as the installation group. Make sure the security risks are considered before you include this parameter.
- Set environment variables.
If the root user is specified as the environment variable, export ASCEND_INSTALL_FOR_ALL=true is required. In this scenario, permission control may have security risks.
- Set environment variables in export mode. In this mode, the environment variables take effect immediately but are valid only in the current window.
export ASCEND_USER_GROUP=usergroup
export ASCEND_USER_NAME=username
- Modify the ~/.bashrc file to set the permanent environment variables.
- Run the vi ~/.bashrc command in any directory as the installation 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.
- Set environment variables in export mode. In this mode, the environment variables take effect immediately but are valid only in the current window.
- Run the following commands to add the created user to the created user group:
groupadd ${ASCEND_USER_GROUP}
useradd -g ${ASCEND_USER_GROUP} -d /home/${ASCEND_USER_NAME} -m ${ASCEND_USER_NAME} -s /bin/bash
- Run the following command to install the .deb driver package in the local source:
- Initial installation
apt-get install ascend310-driver
- Reinstallation
apt-get --reinstall install ascend310-driver
If the following information is displayed, the driver is successfully installed:Driver package installed successfully!
- Initial installation
- Determine whether to restart the system based on the displayed information. If the system needs to be restarted, run the following command. Otherwise, skip this step.
reboot
- Run the following command to query the driver installation information:
apt list ascend310-driver
- (Optional) Run the following commands to clear related environment variables:
unset ASCEND_USER_NAME
unset ASCEND_USER_GROUP
unset ASCEND_INSTALL_FOR_ALL
Installation Using the Repacked Driver Package
Installing Dependencies
GCC and Kernel Source Code
Check whether the GCC and kernel source code of the target OS and kernel version exist. For details, see Installing Dependencies.
Makeself v2.4.0
Download the open-source tool Makeself v2.4.0 from https://github.com/megastep/makeself or https://github.com/megastep/makeself/releases/tag/release-2.4.0.
Pigz
- Ubuntu
dpkg-query -s pigz
- CentOS
rpm -qa |grep pigz
If Pigz has not been installed, use the software manager to install it, for example:
- Ubuntu
apt install pigz
- CentOS
yum install pigz
Repacking the Driver Package
Build a driver package that meets the requirements of the target OS version, kernel version, and GCC version. This section uses {product name}-npu-driver_x.x.x_linux-{arch}.run as an example to describe how to repack the driver package. During the repacking, use the driver package that matches the host OS.
You can repack a driver package using one of the following methods:
- Directly repacking the driver package
- Decompressing the .run package and repacking the driver package
- Using a repacking tool to repack the driver package
You are advised to use the following two methods.
- If the source code in the .run package does not need to be modified, you can directly repack the driver package. For details, see Directly Repacking the Driver Package.
- If the driver source code needs to be modified, decompress the .run package and repack the driver package. For details, see Decompressing the .run Package and Repacking the Driver Package.
Prerequisites
Dependencies have been installed before building. For details, see Installing Dependencies.
Directly Repacking the Driver Package
- Obtain the general driver package. For details, see Obtaining Software Packages.
- Upload the general driver package to any directory in the operating environment, for example, /opt.
- Run the following command to go to the directory where the software packages in 2 are stored, for example, /opt:
cd /opt
- Run the following command to add the execution permission for the general driver package:
chmod +x {product name}-npu-driver_x.x.x_linux-{arch}.run
- Run the following command as the root user to repack a driver package:
./{product name}-npu-driver_x.x.x_linux-{arch}.run --repack[package_name]
Example: ./{product name}-npu-driver_x.x.x_linux-{arch}.run --repack {product name}-npu-driver-repack.run
If package_name is left blank, a file named Original driver package name-custom.run is generated in the current path.
- Install the driver by referring to Installing a Driver (*.run).
Decompressing the .run Package and Repacking the Driver Package
- Obtain the general driver package. For details, see Obtaining Software Packages.
- Upload the general driver package to any directory in the operating environment, for example, /opt.
- Run the following command to go to the directory where the software packages in 2 are stored, for example, /opt:
cd /opt
- Run the following command to add the execution permission for the general driver package:
chmod +x {product name}-npu-driver_x.x.x_linux-{arch}.run
- Run the following command to decompress the general driver package to a specified directory:
./{product name}-npu-driver_x.x.x_linux-{arch}.run --noexec --extract=Destination path
Example: ./{product name}-npu-driver_x.x.x_linux-{arch}.run --noexec --extract=./tmp
- Run the following command as the root user to repack a driver package:
./{product name}-npu-driver_x.x.x_linux-{arch}.run --repack-path=<path> [package_name]
Example: ./{product name}-npu-driver_x.x.x_linux-{arch}.run --repack-path=tmp/ {product name}-npu-driver-repack.run
If package_name is left blank, a file named Original driver package name-custom.run is generated in the current path.
- Install the driver by referring to Installing a Driver (*.run).
Using a Repacking Tool to Repack the Driver Package.
- Obtain the source driver package and repacking tool package. For details, see Obtaining Software Packages.
- Upload the source driver package, repacking tool package, and open-source software package makeself-release-2.4.0.zip to the same directory in the operating environment, for example, in the /opt directory.
- Run the following command to go to the directory where the software packages in 2 are stored, for example, /opt:
cd /opt
- Run the following command to add the execution permission for the source driver package:
chmod +x {product name}-npu-driver_x.x.x_linux-{arch}.run
- Run the following command to decompress the source driver package to a specified directory:
./{product name}-npu-driver_x.x.x_linux-{arch}.run --noexec --extract=./tmp
- Run the following command to decompress the repacking tool package to the current directory:
tar -xzvf {product name}-npu-driver-repack-tools_x.x.x.tar.gz --strip-components 1
- Run the following command to decompress the software package makeself-release-2.4.0.zip:
unzip makeself-release-2.4.0.zip
- Run the following command to build a new driver package:
bash build.sh makeself.shPath Package decompression path Output package name
bash build.sh ./makeself-release-2.4.0/makeself.sh tmp/ {product name}-npu-driver-repack.run
- Install the driver. For details, see Installing a Driver (*.run).
Installing a Driver (*.run)
The following uses the {product name}-npu-driver-repack.run package in Repacking the Driver Package as an example to describe how to install the .run driver package. Replace the package name with the actual one.
Precautions
- 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.
- 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.
Procedure
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).
If the --install for all option is used during the initial installation, retain it during any overwrite installation.
For the Atlas 300I inference card (model 3000), to ensure that the driver, firmware, and MCU versions match, see the MCU in "Upgrading the MCU" in the Atlas 300I Inference Card NPU Driver and Firmware Upgrade Guide (Models 3000, 3010) of the required version.
- Upload the driver package built in Repacking the Driver Package to any directory (for example, /opt) in Linux.
- Use PuTTY to log in to the OS CLI of the server.
- Run the following command to switch to the root user:
su - root
- Run the following command to go to the directory where the software package is stored, for example, /opt:
cd /opt
- Run the following command to check the consistency and integrity of the .run installation package:
./{product name}-npu-driver-repack.run --check
If the following information is displayed, the installation 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 "./{product name}-npu-driver-repack.run does not contain an embedded MD5 checksum." and "./{product name}-npu-driver-repack.run does not contain a CRC checksum" are displayed during verification, the MD5 and CRC encryption modes are not used. In this case, ignore them.
- Run the installation command.
- If the installation path is not specified, run the ./{product name}-npu-driver-repack.run --full command.
- If you specify an installation path, for example, /test/HiAI/,You can run the ./{product name}-npu-driver-repack.run --full --install-path= /test/HiAI/ command to complete the installation.
- Installation log path: /var/log/ascend_seclog/ascend_install.log
- Path where the installation path, installation command, and user information of the package after installation is stored: /etc/ascend_install.info
- During the .run package installation, the dynamic library libdcmi.so and header file dcmi_interface_api.h are copied to the /usr/local/dcmi/ directory.
- If the created running user is not HwHiAiUser, you need to specify a running user using the --install-username=username --install-usergroup=usergroup parameter when installing the driver package.
- If the root user is specified as the running user, the --install-for-all parameter must be included in the installation command as follows. In this scenario, security risks may exist.
--install-username=root --install-usergroup=root --install-for-all
- If the server does not have a BMC, you can only install the driver in the default path. If a specified path is used for the installation, loading of the ipmi_si driver will be blocked. As a result, the disk mounting is slow, affecting the normal running of the NPUs.
- Device-side system logs are transferred to the host by using the msnpureport tool. For details about the export operation and the storage path of the exported logs, see "msnpureport Instructions" in the Black Box Log Reference of the corresponding product and version. In a container, system logs on the device cannot be viewed and cannot be exported using the msnpureport tool.
- If the message "driver ko vermagic(*) is different from the os(*), need rebuild driver" is displayed during the driver installation, rectify the fault by referring to Installation from Source Code.
If the following information is displayed, the driver is successfully installed:Driver package installed successfully!
- Determine whether to restart the system based on the displayed information. If the system needs to be restarted, run the following command. Otherwise, skip this step.
reboot
- 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.
+----------------------------------------------------------------------------------------------------+ | npu-smi 21.0.4 Version: 21.0.4.B030 | +-------------------+-----------------+--------------------------------------------------------------+ | NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page) | | Chip Device | Bus-Id | AICore(%) Memory-Usage(MB) | +===================+=================+==============================================================+ | 6 310 | OK | 12.8 73 0 / 970 | | 0 3 | 0000:89:00.0 | 0 2703 / 8192 | +-------------------+-----------------+--------------------------------------------------------------+ | 6 310 | OK | 12.8 74 0 / 970 | | 1 4 | 0000:8A:00.0 | 0 2867 / 8192 | +-------------------+-----------------+--------------------------------------------------------------+ | 6 310 | OK | 12.8 70 0 / 970 | | 2 5 | 0000:8B:00.0 | 0 2867 / 8192 | +-------------------+-----------------+--------------------------------------------------------------+ | 6 310 | OK | 12.8 65 0 / 970 | | 3 6 | 0000:8C:00.0 | 0 2867 / 8192 | +===================+=================+==============================================================+
- If the loading fails, run the dmesg command to view the Linux startup logs. If "/installation_path/driver/device/davinci_mini.fd copy err" is displayed, uninstall the current driver and use the default path to reinstall the driver again. For details, see Uninstalling a Driver (*.run).
- In the command output, the field following npu-smi indicates the npu-smi tool version, and the field following Version: indicates the driver version.