mcpField
A
ascend-npu-driver-install

ascend-npu-driver-install

github.com/ascendCloud & DevOps52135 installsUpdated 25w ago
Repository

About ascend-npu-driver-install

This skill automates Ascend NPU driver and firmware installation for administrators managing supported Linux hosts. It validates packages and prerequisites, installs in the specified order, and guides reboot and status verification.

Key features

  1. 01Driver and firmware package detection and validation
  2. 02Automatic executable permission handling
  3. 03System dependency and environment checks
  4. 04Ordered driver and firmware installation
  5. 05Reboot prompt and npu-smi verification

Use cases

  1. 01Deploy Ascend NPU on supported Linux hosts
  2. 02Check driver and firmware packages before installation
  3. 03Reboot and verify driver status after installation

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/ascend/agent-skills --skill ascend-npu-driver-install

After installing, type/ascend-npu-driver-installin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
ERROR_CODE.md
scripts/
check_package.py
install_npu_driver.sh

Details

From the project README

Ascend NPU Driver & Firmware Auto-Install

该技能为提供端到端自动化的NPU驱动和固件安装能力,覆盖从安装包校验到驱动生效验证的全流程,无需手动分步操作,严格遵循昇腾官方安装规范,适配主流Linux发行版。

核心能力

  1. 基于官方正则自动提取指定文件夹内的驱动/固件包,强制校验包数量唯一性,仅允许1个驱动包+1个固件包;
  2. 安装包可执行权限按需赋权,无权限时自动执行chmod +x并二次校验赋权结果,避免权限问题导致安装失败;
  3. Python+Shell双重包校验,提前验证包格式、路径、文件有效性,拦截无效安装包;
  4. 系统依赖先验后装
  5. 严格按昇腾官方先驱动后固件顺序安装,安装后提供交互式重启选项+官方npu-smi原生命令验证驱动状态。

前置准备

  • 该版本无需校验系内核,直接进行部署即可
1. 脚本文件准备

将核心脚本check_package.py(Python包校验)和install_npu_driver.sh(Shell主安装)放在同一目录,本技能的根目录建议命名为ascend-npu-driver-install,与name字段保持一致。

2. 安装包要求

指定的安装包文件夹内仅存放1个符合昇腾官方命名格式的驱动.run包和1个固件.run包,无其他无关文件,包名格式严格遵循:

  • 驱动包:Ascend-hdk-<chip_type>-npu-driver_<version>_linux-<arch>.run
  • 固件包:Ascend-hdk-<chip_type>-npu-firmware_<version>.run
3. 系统环境要求
  • 权限:必须拥有ROOT管理员权限,可通过sudo -i命令切换;
  • 系统:适配CentOS/RHEL、Ubuntu/Debian系列Linux发行版,支持yum/apt包管理器;
  • 基础环境:系统已预装Python3,离线无网络环境需手动提前安装gcc、make、dkms核心依赖;
  • 硬件:适配昇腾Ascend310P、Ascend910A、Ascend910B系列NPU芯片。

快速使用步骤

限制要求
  • 安装包的参数仅支持 --full、--install、--install-for-all
步骤1:为脚本添加可执行权限

进入脚本所在的技能根目录,执行以下命令为两个核心脚本赋予可执行权限:

chmod +x ./scripts/install_npu_driver.sh ./scripts/check_package.py
步骤2:执行自动化安装脚本

命令格式:./scripts/install_npu_driver.sh <NPU包文件夹完整路径> <驱动运行用户> 推荐示例(使用root用户进行安装):

./scripts/install_npu_driver.sh /opt/ascend/npu_pkgs root
步骤3:系统重启(驱动生效必做)

安装完成后脚本会弹出交互式重启提示,NPU驱动和固件生效必须重启系统,无重启则无法完成驱动加载:

  • 输入y:系统立即重启,完成NPU驱动内核加载;
  • 输入n:跳过立即重启,后续需手动执行reboot命令完成系统重启。
步骤 4:验证安装结果

系统重启后,执行昇腾官方原生命令验证 NPU 驱动加载状态:

npu-smi info

安装成功标识:命令输出内容包含NPU 芯片型号、Driver Version(驱动版本)、Firmware Version(固件版本),无任何报错信息。

核心脚本说明

check_package.py(Python 包校验脚本) 由 Shell 主脚本自动调用,无需手动执行,核心完成以下包校验工作: 检查安装包所在文件夹是否存在; 按昇腾官方正则匹配驱动 / 固件包,校验包数量唯一性; 验证包为有效文件(非目录); 检测包的可执行权限,无权限时给出警告提示; 输出校验通过的驱动 / 固件包完整绝对路径,供 Shell 脚本调用。 install_npu_driver.sh(Shell 主安装脚本) 技能核心执行脚本,按固定流程自动化运行,全程无需人工干预,执行流程为:ROOT/Python3环境检查 → 包路径正则提取 → 包可执行权限按需赋权 → Python包二次校验 → 运行用户/组自动创建 → 系统依赖先验后装 → NPU驱动安装 → NPU固件安装 → 交互式重启确认 → npu-smi原生验证

Comments

Markdown supported