一、参考资料
npu-smi工具
二、npu-smi工具的常用操作
信息查询(info)
npu-smi info -t <type> -i <npu_id>
查询所有芯片的AI CPU、control CPU和data CPU数量
| 参数 | 描述 | 
|---|---|
| -t | type: board, flash, memory, usages, sensors, temp, power, volt, common, health, product, ecc, ip, sys-time, i2c_check, ecc-enable, p2p-enable, ssh-enable, license, customized-info, device-share, nve-level, aicpu-config, pcie-err, mcu-monitor, err-count, boot-area, info-vnpu, key-manage, first-power-on-date, tls-csr-get, tls-cert, tls-cert-period, proc-mem. | 
| -i | NPU设备id。通过 npu-smi info -l命令查出的NPU ID即为设备id。 | 
查询基本信息
# 每秒刷新一次
watch -n 1 npu-smi info
Every 1.0s: npu-smi info                                                                     davinci-mini: Sun Apr  7 06:37:32 2024+--------------------------------------------------------------------------------------------+
| npu-smi 21.0.4                       Version: 21.0.4                                       |
+-------------------+-----------------+------------------------------------------------------+
| NPU     Name      | Health          | Power(W)     Temp(C)           Hugepages-Usage(page) |
| Chip    Device    | Bus-Id          | AICore(%)    Memory-Usage(MB)                        |
+===================+=================+======================================================+
| 0       310       | OK              | 12.8         46                0    / 970            |
| 0       0         | NA              | 0            1154 / 7767                             |
+===================+=================+======================================================+
| 字段 | 描述说明 | 
|---|---|
| npu-smi | npu-smi 工具版本 | 
| Version | 驱动版本 | 
| NPU | NPU 设备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-Id | BUS id | 
| AICore(%) | AICore占用率 | 
| Memory-Usage(MB) | 内存占比 | 
查询所有芯片监测数据
# 查询所有设备上所有芯片的监测数据
npu-smi info watch  # 查询指定设备上所有芯片的监测数据
npu-smi info watch -i <npu_id> 
HwHiAiUser@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           12.8        46          0           0           0           14          0
0           0           12.8        46          0           0           3           14          0
0           0           12.8        46          0           0           0           14          0
0           0           12.8        45          0           0           0           14          0
0           0           12.8        46          0           0           0           14          0
0           0           12.8        46          0           0           0           14          0
0           0           12.8        46          0           0           0           14          0
0           0           12.8        46          0           0           0           14          0
参数解释
| 字段 | 描述说明 | 
|---|---|
| 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
HwHiAiUser@davinci-mini:~$ npu-smi info -lCard Count                     : 1NPU ID                         : 0Product Name                   : NASerial Number                  : 032WLS10K4000136Chip Count                     : 1
| 字段 | 说明描述 | 
|---|---|
| Card Count | NPU卡个数 | 
| NPU ID | NPU设备id | 
| Product Name | 产品名称 | 
| Serial Number | 产品序列号 | 
| Chip Count | 芯片个数 | 
查询所有芯片统计信息
npu-smi info -t usages -i <npu_id>
HwHiAiUser@davinci-mini:~$ npu-smi info -t usages -i 0NPU ID                         : 0Chip Count                     : 1Chip ID                        : 0Memory Capacity(MB)            : 7767Memory Usage Rate(%)           : 14Hugepages Total(page)          : 970Hugepages Usage Rate(%)        : 0Aicore Usage Rate(%)           : 0Aicpu Usage Rate(%)            : 0Ctrlcpu Usage Rate(%)          : 1Memory Bandwidth Usage Rate(%) : 0
| 字段 | 描述说明 | 
|---|---|
| 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>
HwHiAiUser@davinci-mini:~$ npu-smi info -t  board -i 0 -c 0NPU ID                         : 0Chip ID                        : 0Chip Type                      : AscendChip Name                      : 310Chip Version                   : V100Board ID                       : 0x3ecPCB ID                         : NABOM ID                         : 1Die ID                         : V100, 81CF2194 00A1431C B9B95C93 0100A8C0 FB10005F
参数解释
| 字段 | 解释说明 | 
|---|---|
| NPU ID | NPU 设备id | 
| Chip ID | 芯片id | 
| Chip Type | 芯片类型 | 
| Chip Name | 芯片名称,目前支持310B1和310B4两种芯片名称。 310B1:表示芯片算力规格为20T。 310B4:表示芯片算力规格为8T。 | 
| Chip Version | 芯片版本 | 
| Board ID | 整机类型 | 
| PCB ID | PCB版本编号 | 
| BOM ID | BOM版本编号 | 
| Die ID | 芯片Die编号 | 
查询详细信息
npu-smi info -t board -i <npu_id>
HwHiAiUser@davinci-mini:~$ npu-smi info -t board -i 0NPU ID                         : 0Product Name                   : NAModel                          : NAManufacturer                   : NASerial Number                  : 032WLS10K4000136Software Version               : 21.0.4Firmware Version               :Board ID                       : 0x3ecPCB ID                         : BBOM ID                         : 1Chip Count                     : 1Faulty Chip Count              : 0
查询所有芯片常用信息
npu-smi info -t common -i <npu_id>
HwHiAiUser@davinci-mini:~$ npu-smi info -t common -i 0NPU ID                         : 0Chip Count                     : 1Chip ID                        : 0Memory Usage Rate(%)           : 14Aicore Usage Rate(%)           : 0Temperature(C)                 : 46Rated Power Dissipation(W)     : 12.8
查询产品类型
npu-smi info -t product -i <npu_id>
HwHiAiUser@davinci-mini:~$ npu-smi info -t product -i 0Product Type                   : Atlas 200 Model 3000
查询所有芯片的功率
npu-smi info -t power -i <npu_id>
HwHiAiUser@davinci-mini:~$ npu-smi info -t power -i 0NPU ID                         : 0Chip Count                     : 1Chip ID                        : 0Rated Power Dissipation(W)     : 12.8
查询指定芯片的算力档位
npu-smi info -t nve-level -i <npu_id> -c <chip_id>
root@davinci-mini:~# npu-smi info -t nve-level -i 0 -c 0nve level                      : Full
查询AI CPU数量
HwHiAiUser@davinci-mini:~$ npu-smi info -t aicpu-config -i 0 -c 0Current AI CPU number          : 4Current control CPU number     : 4Number of AI CPUs set          : 4Number of control CPUs set     : 4
配置功能(set)
设置AI CPU数量
npu-smi set -t aicpu-config -i <npu_id> -c <chip_id> -d <value>
| 字段 | 描述说明 | 
|---|---|
| value | 芯片的AI CPU数量。可设置为2、4、6。 | 
root@davinci-mini:~# npu-smi set -t aicpu-config -i 0 -c 0 -d 2Status                         : OKMessage                        : The aicpu-config of the chip is set successfully. Please reboot system.
使用说明:
- 若当前环境模型中无AICPU算子,且运行业务时通过查询芯片统计信息查询当前AICPU占用率持续为0,则可以配置为0。
- 设置CPU数量后,需要复位(重启)系统生效。
CPU压力测试
# 8个CPU压力测试,实际仅使用6个CPU
# AI CPU number: 2
# control CPU number: 6stress --cpu 8
