昇腾Ascend之npu-smi工具在Atlas 200I DK A2的简单使用

本文详细介绍了在基于Atlas200DK的开发板上使用npu-smi工具进行NPU设备状态监控、基本操作、命令解释以及配置AICPU和controlCPU数量的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、参考资料

npu-smi工具

二、测试环境

设备型号:Atlas 200 DK(Model: 3000)
Operating System + Version: Ubuntu 22.04 LTS
CPU Type: 4核TAISHANV200M处理器
AI CPU number: 1
control CPU number: 3
RAM: 4GB 
miscroSD: 128GB
root@davinci-mini:~# npu-smi info -t cpu-num-cfg -i 0 -c 0
        Current AI CPU number          : 1
        Current control CPU number     : 3
        Current data CPU number        : 0

三、npu-smi工具的常用操作

信息查询(info)

查询所有芯片的AI CPU、control CPU和data CPU数量

npu-smi info --help

root@davinci-mini:~# npu-smi info --help
Usage: npu-smi info <watch|proc|-h|-m|-l|-t type> [Options...]

Commands:
       watch          Show all device's status in scrolling format
       proc           Show device's matrix process status in scrolling format
       -h, --help     Show this help text and exit
       -m             Show all device's mapping information
       -l             Show all device's topology information
       -t type        Show information for type
                      type: board, flash, memory, usages, sensors, temp, power, volt, mac-addr,
                            common, health, product, ecc, ip, sys-time, i2c_check, work-mode,
                            ecc-enable, p2p-enable, ssh-enable, license, customized-info,
                            device-share, nve-level, aicpu-config, pcie-err, mcu-monitor,
                            err-count, boot-area, vnpu-mode, info-vnpu, vnpu-svm, cpu-num-cfg,
                            first-power-on-date, proc-mem, phyid-remap, vnpu-cfg-recover, key-manage,
                            template-info, pkcs-enable, p2p-mem-cfg, pwm-mode, pwm-duty-ratio,
                            boot-select, topo.

Options:
       -i %d          Card ID
       -c %d          Chip ID
       -p %d          Chip Physical ID
参数描述
-ttype: board, flash, memory, usages, sensors, temp, power, volt, mac-addr,
common, health, product, ecc, ip, sys-time, i2c_check, work-mode,
ecc-enable, p2p-enable, ssh-enable, license, customized-info,
device-share, nve-level, aicpu-config, pcie-err, mcu-monitor,
err-count, boot-area, vnpu-mode, info-vnpu, vnpu-svm, cpu-num-cfg,
first-power-on-date, proc-mem, phyid-remap, vnpu-cfg-recover, key-manage,
template-info, pkcs-enable, p2p-mem-cfg, pwm-mode, pwm-duty-ratio,
boot-select, topo.
-iNPU设备id。通过 npu-smi info -l 命令查出的NPU ID即为设备id。

查询基本信息

# 每秒刷新一次
watch -n 1 npu-smi info
Every 1.0s: npu-smi info                                               davinci-mini: Wed Apr 10 09:50:12 2024

+--------------------------------------------------------------------------------------------------------+
| npu-smi 23.0.rc3                                 Version: 23.0.rc3                                     |
+-------------------------------+-----------------+------------------------------------------------------+
| NPU     Name                  | Health          | Power(W)     Temp(C)           Hugepages-Usage(page) |
| Chip    Device                | Bus-Id          | AICore(%)    Memory-Usage(MB)                        |
+===============================+=================+======================================================+
| 0       310B4                 | OK              | 8.2          68                15    / 15            |
| 0       0                     | NA              | 0            3076 / 3513                             |
+===============================+=================+======================================================+
字段描述说明
npu-sminpu-smi 工具版本
Version驱动版本
NPUNPU 设备id
Name芯片名称,目前支持310B1和310B4两种芯片名称。
310B1:表示芯片算力规格为20T。
310B4:表示芯片算力规格为8T。
Health芯片的健康状态,有如下五种状态:
OK:正常
Warning:一般告警
Alarm:重要告警
Critical:紧急告警
UNKNOWN:该设备不存在或未启动
Power(W)芯片功率
Temp©芯片温度(单位°C)
Hugepages-Usage(page)大页占比(单位page),每一个page的大小是2048KB。
Chip芯片id
Device芯片编号
Bus-IdBUS id
AICore(%)AICore占用率
Memory-Usage(MB)内存占比

查询所有芯片监测数据

# 查询所有设备上所有芯片的监测数据
npu-smi info watch  

# 查询指定设备上所有芯片的监测数据
npu-smi info watch -i <npu_id> 
root@davinci-mini:~# npu-smi info watch
NpuID(Idx)  ChipId(Idx) Pwr(W)      Temp(C)     AI Core(%)  AI Cpu(%)   Ctrl Cpu(%) Memory(%)   Memory BW(%)
0           0           8.2         69          0           0           25          87          1
0           0           8.2         69          0           0           18          87          1
0           0           8.2         68          0           0           23          87          2
0           0           8.2         68          0           0           17          87          1
0           0           8.2         68          0           0           22          87          3
0           0           8.2         69          0           0           22          87          1
0           0           8.2         68          0           0           17          87          2

参数解释

字段描述说明
NpuID(Idx)设备id
ChipId(Idx)芯片id
Pwr(W)功率(单位W)
Temp©温度(单位°C)
AI Core(%)AI Core占用率
AI Cpu(%)AI Cpu占用率
Ctrl Cpu(%)Ctrl Cpu占用率
Memory(%)内存占用率
Memory BW(%)内存带宽占用率

查询所有NPU设备

npu-smi info -l
root@davinci-mini:~# npu-smi info -l
        Card Count                     : 1

        NPU ID                         : 0
        Product Name                   : IT22MMDB
        Serial Number                  : 102357609442
        Chip Count                     : 1
字段说明描述
Card CountNPU卡个数
NPU IDNPU设备id
Product Name产品名称
Serial Number产品序列号
Chip Count芯片个数

查询所有芯片统计信息

npu-smi info -t usages -i <npu_id>
root@davinci-mini:~# npu-smi info -t usages -i 0
        NPU ID                         : 0
        Chip Count                     : 1

        Chip ID                        : 0
        Memory Capacity(MB)            : 3513
        Memory Usage Rate(%)           : 87
        Hugepages Total(page)          : 15
        Hugepages Usage Rate(%)        : 100
        Aicore Usage Rate(%)           : 0
        Aicpu Usage Rate(%)            : 0
        Ctrlcpu Usage Rate(%)          : 16
        Memory Bandwidth Usage Rate(%) : 2
字段描述说明
NPU ID设备id
Chip ID芯片id
Chip Count芯片个数
Memory Capacity(MB)内存容量(单位MB)
Memory Usage Rate(%)内存占用率
Hugepages Total(page)大页容量(单位page),每一个page的大小是2048KB
Hugepages Usage Rate(%)大页占用率
Aicore Usage Rate(%)Aicore占用率
Aicpu Usage Rate(%)Aicpu占用率
Ctrlcpu Usage Rate(%)Ctrlcpu占用率
Memory Bandwidth Usage Rate(%)内存带宽占用率

查询指定芯片信息

npu-smi info -t board -i <npu_id> -c <chip_id>
root@davinci-mini:~# npu-smi info -t board -i 0 -c 0
        NPU ID                         : 0
        Chip ID                        : 0
        Chip Type                      : Ascend
        Chip Name                      : 310B4
        Chip Version                   : V1
        Board ID                       : 0xc79c
        Module Board ID                : 0x44
        PCB ID                         : NA
        BOM ID                         : 1
        Die ID                         : V1, 77420E14 02010A20 A0771917 4B69090A 65E00000

参数解释

字段解释说明
NPU IDNPU 设备id
Chip ID芯片id
Chip Type芯片类型
Chip Name芯片名称,目前支持310B1和310B4两种芯片名称。
310B1:表示芯片算力规格为20T。
310B4:表示芯片算力规格为8T。
Chip Version芯片版本
Board ID整机类型
PCB IDPCB版本编号
BOM IDBOM版本编号
Die ID芯片Die编号

查询详细信息

npu-smi info -t board -i <npu_id>
root@davinci-mini:~# npu-smi info -t board -i 0
        NPU ID                         : 0
        Product Name                   : IT22MMDB
        Model                          : Model=
        Manufacturer                   : Huawei
        Serial Number                  : 102357609442
        Software Version               : 23.0.rc3
        Firmware Version               : 7.0.0.5.242
        Board ID                       : 0x45
        PCB ID                         : B
        BOM ID                         : 1
        Chip Count                     : 1
        Faulty Chip Count              : 0

查询所有芯片常用信息

npu-smi info -t common -i <npu_id>
root@davinci-mini:~# npu-smi info -t common -i 0
        NPU ID                         : 0
        Chip Count                     : 1

        Chip ID                        : 0
        Memory Usage Rate(%)           : 87
        Aicore Usage Rate(%)           : 0
        Temperature(C)                 : 68
        Rated Power Dissipation(W)     : 8.2

查询产品类型

npu-smi info -t product -i <npu_id>
root@davinci-mini:~# npu-smi info -t product -i 0
        NPU ID                         : 0
        Chip Count                     : 1

        Chip ID                        : 0
        Product Type                   : Atlas 200I A2

查询所有芯片的功率

npu-smi info -t power -i <npu_id>
root@davinci-mini:~# npu-smi info -t power -i 0
        NPU ID                         : 0
        Chip Count                     : 1

        Chip ID                        : 0
        NPU Real-time Power(W)         : 8.2

查询指定芯片的算力档位

npu-smi info -t nve-level -i <npu_id> -c <chip_id>
root@davinci-mini:~# npu-smi info -t nve-level -i 0 -c 0
        nve level                      : 8T_1.0GHz

1.0GHz和1.6GHz表示TaiShan核CPU主频,Atlas 200I DK A2 开发者套件和8T的Atlas 200I A2 加速模块默认算力档位为8T_1.0GHz。

查询AI CPU数量

npu-smi info -t cpu-num-cfg -i <npu_id> -c <chip_id>
root@davinci-mini:~# npu-smi info -t cpu-num-cfg -i 0 -c 0
        Current AI CPU number          : 1
        Current control CPU number     : 3
        Current data CPU number        : 0

配置功能(set)

设置指定芯片的算力档位

npu-smi set -t nve-level -i <npu_id> -c <chip_id> -d <value>
字段描述说明
value8T的Atlas 200I A2 加速模块分为两档:
0:8T_1.0GHz
1:4T_1.0GHz

设置指定芯片的AI CPU数量

npu-smi set -t aicpu-config -i <npu_id> -c <chip_id> -d <ai_cpu_num:ctrl_cpu_num:data_cpu_num>
字段描述说明
ai_cpu_num:ctrl_cpu_num:data_cpu_num芯片的AI CPU数量: control CPU数量:data CPU数量
CPU总核数为4(芯片默认配置为1:3:0)
data CPU固定配置为 0
AI CPU数量取值为:[0,3]
control CPU数量取值为:[1,4]
root@davinci-mini:~# npu-smi set -t cpu-num-cfg -i 0 -c 0 -v 0:4:0
        Status                         : OK
        Message                        : The cpu-num-cfg of the chip is set successfully. Reset system for the configuration to take effect.

使用说明

  • 若当前环境模型中无AICPU算子,且运行业务时通过查询芯片统计信息查询当前AICPU占用率持续为0,则可以配置为0。
  • 设置CPU数量后,需要复位(重启)系统生效。

CPU压力测试

# 4个CPU压力测试,实际仅使用3个CPU
# AI CPU number: 1
# control CPU number: 3

stress --cpu 4

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

花花少年

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值