This page looks best with JavaScript enabled

Basic Usage of npu-smi

 ·  ☕ 8 min read

1. What Is npu-smi

npu-smi is a command-line tool provided by Huawei, purpose-built for managing and monitoring the status and performance of Huawei Ascend series Neural Processing Units (NPUs), similar to NVIDIA’s nvidia-smi.

2. Meaning of npu-smi Fields

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
npu-smi info

+------------------------------------------------------------------------------------------------+
| npu-smi 23.0.2.1                 Version: 23.0.2.1                                             |
+---------------------------+---------------+----------------------------------------------------+
| NPU   Name                | Health        | Power(W)    Temp(C)           Hugepages-Usage(page)|
| Chip                      | Bus-Id        | AICore(%)   Memory-Usage(MB)  HBM-Usage(MB)        |
+===========================+===============+====================================================+
| 0     910B2C              | OK            | 88.6        51                0    / 0             |
| 0                         | 0000:5A:00.0  | 0           0    / 0          20701/ 65536         |
+===========================+===============+====================================================+
| 1     910B2C              | OK            | 99.6        50                0    / 0             |
| 0                         | 0000:19:00.0  | 0           0    / 0          20687/ 65536         |
+===========================+===============+====================================================+
...
+===========================+===============+====================================================+
| 15    910B2C              | OK            | 110.4       51                0    / 0             |
| 0                         | 0000:C9:00.0  | 0           0    / 0          11684/ 65536         |
+===========================+===============+====================================================+
+---------------------------+---------------+----------------------------------------------------+
| NPU     Chip              | Process id    | Process name             | Process memory(MB)      |
+===========================+===============+====================================================+
| 0       0                 | 124528        | python3.8                | 17400                   |
FieldDescription
npu-smlVersion of the npu-sml tool
VersionDriver version
NPUDevice id
NameChip name
HealthHealth state of the chip, with five possible states: OK, Warning, Alarm, Critical, and UNKNOWN
Power(W)Chip power (unit: W)
Temp(C)Chip temperature (unit: ℃)
Hugepages-Usage(page)Huge page usage ratio (unit: page); each page is 2048KB in size.
ChipChip id
DeviceChip number
Bus-IdBUS ID
AICore(%)AICore utilization
Memory-Usage(MB)Memory usage ratio

3. Using npu-smi info

3.1 Parameter Format

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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

Specify the query type with -t and the device ID with -i. The available query types are (the types supported vary by device):

Query TypeMeaning
boardBoard information
flashFlash information
memoryMemory information
usagesResource usage
sensorsSensor information
tempTemperature information
powerPower information
voltVoltage information
mac-addrMAC address information
commonCommon information
healthHealth state
productProduct information
eccError Correction Code (ECC) information
ipIP address information
sys-timeSystem time information
i2c_checkI2C check information
work-modeWork mode
ecc-enableError Correction Code (ECC) enable state
p2p-enablePoint-to-Point (P2P) communication enable state
ssh-enableSSH enable state
licenseLicense information
customized-infoCustomized information
device-shareDevice share information
nve-levelNVE level information
aicpu-configAI CPU configuration information
pcie-errPCIe error information
mcu-monitorMCU monitoring information
err-countError count information
boot-areaBoot area information
vnpu-modevNPU mode information
info-vnpuvNPU information
vnpu-svmvNPU virtualization information
cpu-num-cfgCPU core configuration information
first-power-on-dateFirst power-on date information
proc-memProcess memory information
phyid-remapPhysical ID remap information
vnpu-cfg-recovervNPU configuration recovery information
key-manageKey management information
template-infoTemplate information
pkcs-enablePKCS enable state
p2p-mem-cfgP2P memory configuration information
pwm-modePWM mode information
pwm-duty-ratioPWM duty cycle information
boot-selectBoot select information
topoTopology information

3.2 Common info Commands

  • Query board details of a device
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
npu-smi info -t board -i 0

	NPU ID                         : 0
	Product Name                   : IT21HMDB01-B2
	Model                          : NA
	Manufacturer                   : Huawei
	Serial Number                  : 1023A6017006
	Software Version               : 23.0.2.1
	Firmware Version               : 7.1.0.4.220
	Compatibility                  : OK
	Board ID                       : 0x65
	PCB ID                         : A
	BOM ID                         : 1
	PCIe Bus Info                  : 0000:5A:00.0
	Slot ID                        : 0
	Class ID                       : NA
	PCI Vendor ID                  : 0x19E5
	PCI Device ID                  : 0xD802
	Subsystem Vendor ID            : 0x19E5
	Subsystem Device ID            : 0x3400
	Chip Count                     : 1
  • Query chip details of a device
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
npu-smi info -t board -i 0 -c 0

	NPU ID                         : 0
	Chip ID                        : 0
	Chip Type                      : Ascend
	Chip Name                      : 910B2C
	Chip Version                   : V1
	Board ID                       : 0x51
	PCB ID                         : NA
	BOM ID                         : 1
	VDie ID                        : DE36A664 01202745 59C48932 98500485 100301E3
	NDie ID                        : 00000000 00000000 00000000 00000000 00000000
	Chip Position ID               : 0
	PCIe Bus Info                  : 0000:5A:00.0
	Firmware Version               : 7.1.0.4.220
  • View the connection topology
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
npu-smi info -t topo

           NPU0       NPU1       NPU2       NPU3       NPU4       NPU5       NPU6       NPU7       NPU8       NPU9       NPU10      NPU11      NPU12      NPU13      NPU14      NPU15      CPU Affinity
NPU0       X          HCCS       HCCS       HCCS       HCCS       HCCS       HCCS       HCCS       PIX        PHB        PHB        PHB        SYS        SYS        SYS        SYS        0-43,88-131
NPU1       HCCS       X          HCCS       HCCS       HCCS       HCCS       HCCS       HCCS       PHB        PIX        PHB        PHB        SYS        SYS        SYS        SYS        0-43,88-131
...
NPU15      SYS        SYS        SYS        SYS        PHB        PHB        PHB        PIX        HCCS       HCCS       HCCS       HCCS       HCCS       HCCS       HCCS       X          44-87,132-175

Legend:

  X    = Self
  SYS  = Path traversing PCIe and NUMA nodes. Nodes are connected through SMP, such as QPI, UPI.
  PHB  = Path traversing PCIe and the PCIe host bridge of a CPU.
  PIX  = Path traversing a single PCIe switch
  PXB  = Path traversing multipul PCIe switches
  HCCS = Connection traversing HCCS.
  NA   = Unknown relationship.
  • Query chip monitoring data
1
2
3
4
5
6
npu-smi info watch

0           0           313.3       64          17          2           1           86          31
1           0           283.4       65          46          2           4           85          32
...
15          0           319.0       65          3           2           1           85          29
  • Query common information of a device
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
npu-smi info -t common -i 0

	NPU ID                         : 0
	Chip Count                     : 1

	Chip ID                        : 0
	Memory Usage Rate(%)           : 0
	HBM Usage Rate(%)              : 86
	Aicore Usage Rate(%)           : 66
	Aicore Freq(MHZ)               : 1800
	Aicore curFreq(MHZ)            : 1800
	Aicore Count                   : 24
	Temperature(C)                 : 67
	NPU Real-time Power(W)         : 296.5

	Chip Name                      : mcu
	Temperature(C)                 : 56

4. Using npu-smi set

4.1 Parameter Format

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
npu-smi set --help
Usage: npu-smi set <-h|-t type> [Options...]

Commands:
       -h, --help     Show this help text and exit
       -t type        The set type for device
                      type: ecc-enable, collect-log, reset, device-share, nve-level, clear-ecc-info,
                            license, ssh-enable, customized-info, clear-pcie-err, revocate, mac-addr,
                            mcu-monitor, boot-area, aicpu-config, disk-power, ip, errcount-clear,
                            vnpu-mode, create-vnpu, destroy-vnpu, vnpu-svm, cpu-num-cfg, vnpu-cfg-recover,
                            key-manage, pkcs-enable, p2p-mem-cfg, pwm-mode, pwm-duty-ratio, power-state,
                            boot-select, reset-vnpu.

Options:
       -i %d          Card ID
       -c %d          Chip ID
       -d %d          Config value
       -s             String format configuration
       -f             License (1-255) or path of SoC certificate files
       -m             By in-band reset, only can input 1

Specify the configuration type with -t and the device ID with -i. Unlike npu-smi info, here you use -d to specify the configuration value. The available configuration types are (the types supported vary by device):

TypeMeaning
ecc-enableEnable ECC error correction
collect-logCollect logs
resetReset the device
device-shareDevice sharing
nve-levelNVE level setting
clear-ecc-infoClear ECC information
licenseLicense management
ssh-enableEnable SSH
customized-infoCustomized information setting
clear-pcie-errClear PCIe errors
revocateRevoke operation
mac-addrMAC address setting
mcu-monitorMCU monitoring setting
boot-areaBoot area setting
aicpu-configAI CPU configuration
disk-powerDisk power setting
ipIP address setting
errcount-clearClear error counts
vnpu-modevNPU mode setting
create-vnpuCreate vNPU
destroy-vnpuDestroy vNPU
vnpu-svmvNPU virtualization setting
cpu-num-cfgCPU core count configuration
vnpu-cfg-recovervNPU configuration recovery
key-manageKey management
pkcs-enableEnable PKCS
p2p-mem-cfgP2P memory configuration
pwm-modePWM mode setting
pwm-duty-ratioPWM duty cycle setting
power-statePower state setting
boot-selectBoot select setting
reset-vnpuReset vNPU

4.2 Common set Commands

  • Collect logs
1
npu-smi set -t collect-log -i 0

After collection finishes, the log files can be found in the /run/mcu_log directory. The system does not clean up these logs automatically, so you need to clean them up yourself.

  • Configure the ECC enable state

Enable

1
npu-smi set -t ecc-enable -i id -d 1

Disable

1
npu-smi set -t ecc-enable -i id -d 0
  • Set the compute power level of a specified chip
1
npu-smi set -t nve-level -i id -d 1

The compute power level is divided into four grades:

0 - Low
1 - Middle
2 - High
3 - Full

5. Using npu-smi clear

5.1 Parameter Format

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
npu-smi clear --help

Usage: npu-smi clear <-h|-t type> [Options...]

Commands:
       -h, --help     Show this help text and exit
       -t type        The clear type for device
                      type: ecc-info.

Options:
       -i %d          Card ID
       -c %d          Chip ID

Specify the clear type with -t, the device ID with -i, and the chip ID with -c.

5.2 Common clear Commands

  • Clear the ECC error counts of all chips on device 0
1
npu-smi clear -t ecc-info -i 1
  • Clear the ECC error counts of all devices
1
for i in {0..7}; do npu-smi clear -t ecc-info -i $i; done

View the ECC error counts

1
for i in {0..7}; do npu-smi info -t ecc -i $i; done

微信公众号
WRITTEN BY
微信公众号