SuperAPI AI Directory

ascend-npu-driver-install

Coding & development

View repository

Updated 10-15 19:57

About this skill

Ascend NPU Driver & Firmware Auto-Install

This skill providesend-to-end automated NPU driver and firmware installation capability, covering the entire process from installation package verification to driver effectiveness verification, without the need for manual step-by-step operations, strictly following Ascend official installation specifications, and adapting to mainstream Linux distributions.

Core Capabilities

  1. Automatically extract the driver/firmware packages in the specified folder based on official regular expressions, and strictly verify the uniqueness of the package quantity, allowing only 1 driver package + 1 firmware package;
  2. Executable permissions for installation packages are granted on demand. If there is no permission, it is automatically executedchmod +xand the permission granting result is verified a second time to avoid installation failure caused by permission issues;
  3. Dual package verification with Python + Shell, verifying package format, path, and file validity in advance to intercept invalid installation packages;
  4. Verify system dependencies before installation
  5. Strictly follow the Ascend officialdriver first, then firmwareinstallation order. After installation, provide an interactive restart option + officialnpu-sminative commands to verify driver status.

Prerequisites

  • This version does not require kernel verification; deployment can be performed directly

1. Script File Preparation

Place the core scriptcheck_package.py(Python package verification) andinstall_npu_driver.sh(Shell main installation) inthe same directory. The root directory of this skill is recommended to be namedascend-npu-driver-install, consistent with the name field.

2. Installation Package Requirements

In the specified installation package folder,store only 1driver .run package and 1 firmware .run package that conform to the Ascend official naming format, with no other unrelated files. The package name format strictly follows:

  • Driver package:Ascend-hdk-<chip_type>-npu-driver_<version>_linux-<arch>.run
  • Firmware package:Ascend-hdk-<chip_type>-npu-firmware_<version>.run

3. System Environment Requirements

  • Permissions: Must haveROOT administrator permissions, can switch viasudo -icommand;
  • System: Compatible with CentOS/RHEL, Ubuntu/Debian series Linux distributions, supports yum/apt package managers;
  • Basic environment: Python3 is preinstalled on the system. In an offline environment without network, you need tomanually install in advancethe core dependencies gcc, make, and dkms;
  • Hardware: Compatible with Ascend Ascend310P, Ascend910A, and Ascend910B series NPU chips.

Quick Usage Steps

Restrictions

  • The parameters of the installation package only support --full, --install, --install-for-all

Step 1: Add executable permissions to the scripts

Enter the skill root directory where the scripts are located, and execute the following command to grant executable permissions to the two core scripts:

chmod +x ./scripts/install_npu_driver.sh ./scripts/check_package.py

Step 2: Execute the automated installation script

Command format:./scripts/install_npu_driver.sh <NPU包文件夹完整路径> <驱动运行用户> Recommended example(install using the root user):

./scripts/install_npu_driver.sh /opt/ascend/npu_pkgs root

Step 3: System restart (required for the driver to take effect)

After installation is complete, the script will display an interactive restart prompt.The NPU driver and firmware must take effect only after the system is restarted. Without a restart, driver loading cannot be completed:

  • Entery: the system restarts immediately to complete NPU driver kernel loading;
  • Entern: Skip immediate restart; subsequent manual execution is requiredrebootThe command completes the system restart.

Step 4: Verify the installation result

After the system restarts, execute the official Ascend native command to verify the NPU driver loading status:

npu-smi info

Installation success indicator: The command output contains the NPU chip model, Driver Version, and Firmware Version, with no error messages.

Core Script Description

check_package.py (Python package verification script) Automatically called by the main Shell script; no manual execution is required. It mainly completes the following package verification work: Check whether the folder where the installation package is located exists; Match the driver/firmware packages according to the official Ascend regular expression, and verify the uniqueness of the package count; Verify that the package is a valid file (not a directory); Detect the executable permission of the package, and give a warning if there is no permission; Output the complete absolute paths of the driver/firmware packages that pass verification, for the Shell script to call. install_npu_driver.sh (main Shell installation script) The core execution script of the skill runs automatically according to a fixed process, with no manual intervention throughout. The execution process is: ROOT/Python3 environment check → regular expression extraction of package paths → grant executable permissions to packages as needed → secondary Python package verification → automatic creation of the running user/group → install system dependencies after checking them first → install NPU driver → install NPU firmware → interactive restart confirmation → npu-smi native verification