NPU Driver and Firmware Installation

In PM and container deployment scenarios, you only need to install the NPU driver and firmware on the PMs.

In VM deployment scenarios, you need to install the NPU driver and firmware on PMs and install only the NPU driver on VMs by referring to this section.

Installation Description

You can run the following command to check whether the driver is installed in the current environment. If the driver has been installed, its information will be returned.
npu-smi info
  • Initial installation: In scenarios where no driver is installed on a hardware device before delivery, or the installed driver and firmware on the hardware device have been uninstalled, you need to first install the driver and then the firmware.
  • Overwrite installation: In scenarios where the driver and firmware have been installed on a hardware device and you need to install them again, install the firmware and then the driver.

Preparing Users

This section describes how to create an installation and running user. If the user already exists, skip this section.

Table 1 User type

Component

Installation User

Running User

NPU driver and firmware

root

  • When the driver and firmware are installed, the running user and user group are specified as HwHiAiUser by default. Therefore, you need to create the running user and user group of HwHiAiUser before installing the software package.
  • If the created user and user group are not HwHiAiUser (including root), you must specify the running user when installing the driver and firmware.

The following users are used in the example steps:

  • The root user is used to install the driver and firmware.
  • The running user is the non-root user HwHiAiUser (default running user of the driver and firmware).
Run the following command to create the HwHiAiUser user and user group:
1
2
groupadd HwHiAiUser
useradd -g HwHiAiUser -d /home/HwHiAiUser -m HwHiAiUser -s /bin/bash

For the usage and configuration requirements of the default user HwHiAiUser, see Atlas Hardware Product Account List. You can create other non-root users on your own.

Note that if the --install-for-all parameter is not used during driver installation, the running user of the CANN package must be in the same user group as the running user of the driver and firmware.

Dependency Installation

  1. Run the following command to check whether the source is available.
    Debian/Ubuntu/veLinux:
    1
    apt-get update
    

    If the system reports an error or the waiting time becomes excessive, check whether the network is connected or modify the /etc/apt/sources.list file to an available source. (For example, to configure a Huawei image source, you can see the configuration method of the image source in the Huawei Open-Source Mirror Site).

    openEuler, CentOS, Kylin, BCLinux, UOS V20, AntOS, AliOS, CTyunOS, CULinux, Tlinux, MTOS, vesselOS:
    1
    yum makecache
    

    If the system reports an error or the waiting time becomes excessive, check whether the network is connected or modify the /etc/yum.repos.d/xxxx.repo file to an available source. (For example, to configure a Huawei image source, you can see the configuration method of the image source in the Huawei Open-Source Mirror Site).

  2. Run the following command to install dependencies.
    Debian/Ubuntu/veLinux:
    1
    apt-get install -y make dkms gcc linux-headers-$(uname -r)
    
    openEuler, CentOS, Kylin, BCLinux, UOS V20, AntOS, AliOS, CTyunOS, CULinux, Tlinux, MTOS, vesselOS:
    1
    yum install -y make dkms gcc kernel-headers-$(uname -r) kernel-devel-$(uname -r)
    

    If an error is reported or the dependency does not exist, see Installing Dependencies Required for Compiling Driver Source Code.

Driver and Firmware Installation

  1. Log in to the installation environment as the root user and upload the driver and firmware packages to any directory in the installation environment, for example, /home.
  2. Go to the directory where the software package is stored and run the following commands to add the execute permission:
    1
    2
    chmod +x Ascend-hdk-<chip_type>-npu-driver_<version>_linux-<arch>.run
    chmod +x Ascend-hdk-<chip_type>-npu-firmware_<version>.run
    
  3. Install the driver and firmware. The default installation path is /usr/local/Ascend.
    1. Run the following command to install the driver:
      1
      ./Ascend-hdk-<chip_type>-npu-driver_<version>_linux-<arch>.run --full --install-for-all
      
      If the following information is displayed, the driver is successfully installed:
      1
      Driver package installed successfully!
      

      If some Linux tools are missing after you run the preceding command, install them based on the command output. If an error message indicating that the dkms or dependency is missing is displayed, rectify the fault by referring to An Error Is Reported During Driver Installation.

    2. Run the following command to install the firmware.
      1
      ./Ascend-hdk-<chip_type>-npu-firmware_<version>.run --full
      

      If the following information is displayed, the firmware is successfully installed:

      1
      Firmware package installed successfully! Reboot now or after driver installation for the installation/upgrade to take effect
      

    If the running user and user group of the driver are not created as HwHiAiUser according to the example steps, you must specify the running user and user group when installing the driver and firmware packages. The following is an example command:

    ./Ascend-hdk-<chip_type>-npu-driver_<version>_linux-<arch>.run --full --install-username=<username> --install-usergroup=<usergroup>
  4. Determine whether to restart the system as prompted. If the system needs to be restarted, run the following command. Otherwise, skip this step.
    1
    reboot
    
  5. Run the following command to check whether the driver is successfully loaded:
    1
    npu-smi info
    

    If the driver information is displayed, the driver is successfully loaded. Otherwise, the loading fails. In this case, visit Support to seek help or submit a technical service ticket.