ascend-npu-driver-install

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Ascend NPU Driver & Firmware Auto-Install

Ascend NPU Driver & Firmware Auto-Install

该技能为提供端到端自动化的NPU驱动和固件安装能力,覆盖从安装包校验到驱动生效验证的全流程,无需手动分步操作,严格遵循昇腾官方安装规范,适配主流Linux发行版。
This skill provides end-to-end automated NPU driver and firmware installation capabilities, covering the entire process from installation package verification to driver validity verification. No manual step-by-step operations are required, as it strictly follows Ascend's official installation specifications and is compatible with mainstream Linux distributions.

核心能力

Core Capabilities

  1. 基于官方正则自动提取指定文件夹内的驱动/固件包,强制校验包数量唯一性,仅允许1个驱动包+1个固件包;
  2. 安装包可执行权限按需赋权,无权限时自动执行
    chmod +x
    并二次校验赋权结果,避免权限问题导致安装失败;
  3. Python+Shell双重包校验,提前验证包格式、路径、文件有效性,拦截无效安装包;
  4. 系统依赖先验后装
  5. 严格按昇腾官方先驱动后固件顺序安装,安装后提供交互式重启选项+官方
    npu-smi
    原生命令验证驱动状态。
  1. Automatically extract driver/firmware packages from the specified folder based on official regular expressions, with mandatory verification of package quantity uniqueness—only 1 driver package + 1 firmware package is allowed;
  2. Grant executable permissions to installation packages on demand. If there are no permissions, automatically execute
    chmod +x
    and verify the permission assignment result a second time to avoid installation failures caused by permission issues;
  3. Dual package verification via Python+Shell, which verifies package format, path, and file validity in advance to block invalid installation packages;
  4. Pre-check system dependencies before installation
  5. Strictly follow Ascend's official driver-first then firmware installation order. After installation, an interactive restart option is provided along with the official
    npu-smi
    native command to verify driver status.

前置准备

Preparations

  • 该版本无需校验系内核,直接进行部署即可
  • This version does not require kernel verification; you can directly proceed with deployment

1. 脚本文件准备

1. Script File Preparation

将核心脚本
check_package.py
(Python包校验)和
install_npu_driver.sh
(Shell主安装)放在同一目录,本技能的根目录建议命名为
ascend-npu-driver-install
,与name字段保持一致。
Place the core scripts
check_package.py
(Python package verification) and
install_npu_driver.sh
(main Shell installation script) in the same directory. It is recommended to name the root directory of this skill
ascend-npu-driver-install
, which should be consistent with the name field.

2. 安装包要求

2. Installation Package Requirements

指定的安装包文件夹内仅存放1个符合昇腾官方命名格式的驱动.run包和1个固件.run包,无其他无关文件,包名格式严格遵循:
  • 驱动包:
    Ascend-hdk-<chip_type>-npu-driver_<version>_linux-<arch>.run
  • 固件包:
    Ascend-hdk-<chip_type>-npu-firmware_<version>.run
The specified installation package folder should only contain 1 driver .run package and 1 firmware .run package that comply with Ascend's official naming format, with no other irrelevant files. The package name format must strictly follow:
  • Driver package:
    Ascend-hdk-<chip_type>-npu-driver_<version>_linux-<arch>.run
  • Firmware package:
    Ascend-hdk-<chip_type>-npu-firmware_<version>.run

3. 系统环境要求

3. System Environment Requirements

  • 权限:必须拥有ROOT管理员权限,可通过
    sudo -i
    命令切换;
  • 系统:适配CentOS/RHEL、Ubuntu/Debian系列Linux发行版,支持yum/apt包管理器;
  • 基础环境:系统已预装Python3,离线无网络环境需手动提前安装gcc、make、dkms核心依赖;
  • 硬件:适配昇腾Ascend310P、Ascend910A、Ascend910B系列NPU芯片。
  • Permissions: Must have ROOT administrator privileges, which can be switched via the
    sudo -i
    command;
  • System: Compatible with CentOS/RHEL, Ubuntu/Debian series Linux distributions, supporting yum/apt package managers;
  • Basic Environment: Python3 is pre-installed on the system. For offline environments without network access, manually install in advance the core dependencies gcc, make, and dkms;
  • Hardware: Compatible with Ascend 310P, Ascend 910A, Ascend 910B series NPU chips.

快速使用步骤

Quick Usage Steps

限制要求

Restrictions

  • 安装包的参数仅支持 --full、--install、--install-for-all
  • The installation package only supports parameters --full, --install, --install-for-all

步骤1:为脚本添加可执行权限

Step 1: Add Executable Permissions to Scripts

进入脚本所在的技能根目录,执行以下命令为两个核心脚本赋予可执行权限:
chmod +x ./scripts/install_npu_driver.sh ./scripts/check_package.py
Navigate to the root directory of the skill 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

步骤2:执行自动化安装脚本

Step 2: Execute the Automated Installation Script

命令格式
./scripts/install_npu_driver.sh <NPU包文件夹完整路径> <驱动运行用户>
推荐示例(使用root用户进行安装):
bash
./scripts/install_npu_driver.sh /opt/ascend/npu_pkgs root
Command Format:
./scripts/install_npu_driver.sh <full path of NPU package folder> <driver running user>
Recommended Example (install using the root user):
bash
./scripts/install_npu_driver.sh /opt/ascend/npu_pkgs root

步骤3:系统重启(驱动生效必做)

Step 3: System Restart (Mandatory for Driver to Take Effect)

安装完成后脚本会弹出交互式重启提示,NPU驱动和固件生效必须重启系统,无重启则无法完成驱动加载:
  • 输入
    y
    :系统立即重启,完成NPU驱动内核加载;
  • 输入
    n
    :跳过立即重启,后续需手动执行
    reboot
    命令完成系统重启。
After installation is complete, the script will display an interactive restart prompt. A system restart is mandatory for the NPU driver and firmware to take effect; without a restart, the driver cannot be loaded:
  • Enter
    y
    : The system restarts immediately to complete the NPU driver kernel loading;
  • Enter
    n
    : Skip the immediate restart; you need to manually execute the
    reboot
    command later to restart the system.

步骤 4:验证安装结果

Step 4: Verify Installation Result

系统重启后,执行昇腾官方原生命令验证 NPU 驱动加载状态:
npu-smi info
安装成功标识:命令输出内容包含NPU 芯片型号、Driver Version(驱动版本)、Firmware Version(固件版本),无任何报错信息。
After the system restarts, execute Ascend's official native command to verify the NPU driver loading status:
npu-smi info
Installation Success Indicator: The command output includes the NPU chip model, Driver Version, Firmware Version, with no error messages.

核心脚本说明

Core Scripts Description

check_package.py(Python 包校验脚本) 由 Shell 主脚本自动调用,无需手动执行,核心完成以下包校验工作: 检查安装包所在文件夹是否存在; 按昇腾官方正则匹配驱动 / 固件包,校验包数量唯一性; 验证包为有效文件(非目录); 检测包的可执行权限,无权限时给出警告提示; 输出校验通过的驱动 / 固件包完整绝对路径,供 Shell 脚本调用。 install_npu_driver.sh(Shell 主安装脚本) 技能核心执行脚本,按固定流程自动化运行,全程无需人工干预,执行流程为:ROOT/Python3环境检查 → 包路径正则提取 → 包可执行权限按需赋权 → Python包二次校验 → 运行用户/组自动创建 → 系统依赖先验后装 → NPU驱动安装 → NPU固件安装 → 交互式重启确认 → npu-smi原生验证
check_package.py (Python Package Verification Script) Automatically called by the main Shell script, no manual execution required. It mainly completes the following package verification tasks: Check if the folder containing installation packages exists; Match driver/firmware packages using Ascend's official regular expressions and verify the uniqueness of package quantity; Verify that the packages are valid files (not directories); Detect the executable permissions of the packages and issue a warning if there are no permissions; Output the full absolute paths of the verified driver/firmware packages for the Shell script to call. install_npu_driver.sh (Main Shell Installation Script) The core execution script of the skill, which runs automatically according to a fixed process without manual intervention throughout. The execution process is: ROOT/Python3 environment check → regular expression-based package path extraction → on-demand assignment of package executable permissions → secondary Python package verification → automatic creation of running user/group → pre-check and installation of system dependencies → NPU driver installation → NPU firmware installation → interactive restart confirmation → native npu-smi verification",