# mx-qual 用户手册 `mx-qual`(MOFFETT Qualification)是基于 SOLA Runtime API 构建的设备质量测试工具,用于检测墨芯 SPU 设备的可用性、稳定性及性能等多项关键指标。 **命令格式:mx-qual [选项] 子命令** `-h,--help` : 显示帮助信息。 `-v,--version` : 显示 `mx-qual` 的版本。 ## 子命令 list 列出指定的设备信息。 **mx-qual list [选项]** `-h,--help` : 显示帮助信息。 `-i, --index` : 指定设备索引,取值范围:0-31。如果未指定,则列出所有的设备信息;如果指定多个值: - 空格分隔,例如:`-i 0 1 2`。 - 花括号中逗号分隔,例如:`-i {0,1,2}`。 ```Bash mx-qual list -i 0 ``` ``` Device 0: "S40-02-A02" Serial number: 2515040220003 PCI Bus ID: 0000:38:00.0 Runtime version: 3.12.0 Driver version: 3.12.0 Firmware version: 1.0.17 ``` ```{table} :class: bold-first-col | 输出字段 | Serial number | PCI Bus ID | Runtime version | Driver version | Firmware version | | ---------| ------------- | ------------- |------------------ |------------------|------------------ | | 说明 | 设备序列号 | PCI 总线 ID | 运行时版本 | 驱动版本 | 固件版本 | ``` ## 子命令 hardware_link 运行硬件链路测试,测试驱动和所有设备的通信链路是否正常。 **mx-qual hardware_link [选项]** `-h,--help` : 显示帮助信息。 ```Bash mx-qual hardware_link ``` ``` Test driver link... ok Test device count... ok Test device link... ok Test Result = PASS ``` ## 子命令 pcie_bandwidth 运行 PCIe 带宽测试。 **mx-qual pcie_bandwidth [选项]** `-h,--help` : 显示帮助信息。 `-i, --index` : 指定设备索引。取值范围:0-31。如果未指定,则测试所有设备;如果指定多个值: - 空格分隔,例如:`-i 0 1 2`。 - 花括号中逗号分隔,例如:`-i {0,1,2}`。 `-s,--sn` : 指定板卡的序列号。通过 `mx-smi` 命令可查看板卡序列号,具体请参见 [mx-smi 用户手册](./smi-userguide.md)。 ```{admonition} 须知 :class: note `-s` 的优先级比 `-i` 高。如果同时指定了 `-i` 和 `-s`,则只测试 `-s` 指定的设备。 ``` `-d,--data_size` : 指定测试的数据大小。取值范围:32-100 MB,默认值:100 MB。 `-l,--loop` : 指定测试的循环次数。取值范围:1-100 次,默认值:1 次。 `-f,--full_duplex` : 启用全双工测试。如果未指定该选项,则默认运行半双工测试。 以下示例测试指定设备的 PCIe 带宽(以 S30/S4 卡为例): ```Bash mx-qual pcie_bandwidth -i 0 ``` ``` PCIe Bandwidth Test (half duplex mode) Device id: [0] Host to Device Bandwidth Transfer Size: 100.000 MB, Bandwidth: 12.298 GB/s Device to Host Bandwidth Transfer Size: 100.000 MB, Bandwidth: 12.358 GB/s Test Result = PASS ``` 以下示例启用全双工测试,并测试 10 次(以 S40 卡为例): ```Bash mx-qual pcie_bandwidth -f -l 10 -d 60 ``` ``` PCIe Bandwidth Test (full duplex mode) Device id: [0, 1, 2, 3, 4, 5, 6, 7] Host to Device Bandwidth Transfer Size: 4800.000 MB, Bandwidth: 28.411 GB/s Device to Host Bandwidth Transfer Size: 4800.000 MB, Bandwidth: 28.421 GB/s ``` | **输出字段** | **说明** | | ------------------ | -----------------| | Transfer Size | 传输数据大小(MB)| | Bandwidth | 带宽 | ```{admonition} 须知 :class: note 如果指定了多个设备进行多次测试,则 Transfer Size 显示的为所有指定设备在多次测试中累积的数据大小,其他命令同理。 ``` ## 子命令 memory_bandwidth 运行设备内存带宽测试。 **mx-qual memory_bandwidth [选项]** `-h,--help` : 显示帮助信息。 `-i, --index` : 指定设备索引。取值范围:0-31。如果未指定,则测试所有设备;如果指定多个值: - 空格分隔,例如:`-i 0 1 2`。 - 花括号中逗号分隔,例如:`-i {0,1,2}`。 `-s,--sn` : 指定板卡的序列号。通过 `mx-smi` 命令可查看板卡序列号,具体请参见 [mx-smi 用户手册](./smi-userguide.md)。 ```{admonition} 须知 :class: note `-s` 的优先级比`-i`高。如果同时指定了 `-i` 和 `-s`,则只测试 `-s` 指定的设备。 ``` `-d,--data_size` : 指定测试的数据大小。取值范围:32-100 MB,默认值:100 MB。 `-l,--loop` : 指定测试的循环次数。取值范围:1-100 次,默认值:1 次。 以下示例测试指定设备的内存带宽(以 S30/S4 卡为例): ```Bash mx-qual memory_bandwidth -i 0 ``` ```Bash Memory Bandwidth Test Device id: [0] Memory Read Bandwidth Transfer Size: 100.000 MB, Bandwidth: 60.872 GB/s Memory Write Bandwidth Transfer Size: 100.000 MB, Bandwidth: 61.158 GB/s Test Result = PASS ``` 以下示例测试对指定设备测试 10 次,并指定传输数据的大小为 32 MB(以两张 S40 卡为例): ```Bash mx-qual memory_bandwidth -i 0 -d 32 -l 10 ``` ```Bash Memory Bandwidth Test Device id: [0] Memory Read Bandwidth Transfer Size: 320.000 MB, Bandwidth: 49.944 GB/s Memory Write Bandwidth Transfer Size: 320.000 MB, Bandwidth: 50.440 GB/s Test Result = PASS ``` | **输出字段** | **说明** | | ------------------ | -----------------| | Transfer Size | 传输数据大小(MB)| | Bandwidth | 带宽 | ## 子命令 p2p 运行 P2P(Peer to Peer)带宽测试。 **mx-qual p2p [选项]** `-h,--help` : 显示帮助信息。 `-d,--device` : 指定设备索引。取值范围:0-31,至少指定两个设备才能运行 P2P 测试。如果指定多个值: - 空格分隔,例如:`-i 0 1 2`。 - 花括号中逗号分隔,例如:`-i {0,1,2}`。 `-c,--card` : 指定板卡索引。取值范围:0-31,至少指定两张板卡才能运行 P2P 测试。如果指定多个值: - 空格分隔,例如:`-c 0 1 2`。 - 花括号中逗号分隔,例如:`-c {0,1,2}`。 ```{admonition} 须知 :class: note `-c` 的优先级比 `-d` 高。如果同时指定了 `-c` 和 `-d`,则只测试 `-c` 指定的板卡;如果未指定 `-c` 和 `-d` ,则测试所有设备。 ``` 以下示例测试指定设备的 P2P 带宽(以 S30 卡为例): ```Bash mx-qual p2p -d 0 1 2 ``` ```Bash P2P Connectivity Matrix D/D 0 1 2 0 0 1 1 1 1 0 1 2 1 1 0 Unidirectional P2P Bandwidth Matrix (GB/s) D/D 0 1 2 0 0.00 10.78 10.99 1 10.83 0.00 11.03 2 10.98 10.97 0.00 Bidirectional P2P Bandwidth Matrix (GB/s) D/D 0 1 2 0 0.00 21.96 21.67 1 21.96 0.00 21.71 2 21.67 21.71 0.00 P2P Latency Matrix (ms) SPU 0 1 2 0 0.00 3.11 3.05 1 3.10 0.00 3.04 2 3.06 3.06 0.00 CPU 0 1 2 0 0.00 8.79 8.81 1 8.73 0.00 8.66 2 8.74 8.91 0.00 Test Result = PASS ``` 以下示例测试指定板卡的 P2P 带宽(以 S30 卡为例): ```Bash mx-qual p2p -c 0 1 ``` ```Bash P2P Connectivity Matrix C/C 0 1 0 0 1 1 1 0 Unidirectional P2P Bandwidth Matrix (GB/s) C/C 0 1 0 0.00 27.55 1 27.60 0.00 Bidirectional P2P Bandwidth Matrix (GB/s) C/C 0 1 0 0.00 55.15 1 55.15 0.00 P2P Latency Matrix (ms) SPU 0 1 0 0.00 3.65 1 3.65 0.00 CPU 0 1 0 0.00 11.11 1 11.10 0.00 Test Result = PASS ``` | **输出字段** | **说明** | | -------------------------------------------- | -------------------------------------------------------| | P2P Connectivity Matrix | 设备或板卡间是否存在点对点连接。0 - 无连接,1 - 存在连接 | | Unidirectional P2P Bandwidth Matrix (GB/s) | 设备或板卡间单向数据传输速率(单位:GB/s) | | Bidirectional P2P Bandwidth Matrix (GB/s) | 设备或板卡间双向数据传输速率(单位:GB/s) | | P2P Latency Matrix (ms) | SPU 和 CPU 点对点通信延迟(单位:ms) | 回显信息中的 D/D 表示 Device/Device;C/C 表示 Card/Card。 ## 子命令 stress 运行压力测试,测试设备的内存和计算单元。 系统启动后将预热一分钟,期间不进行设备状态监控。预热结束后,系统每秒采集温度、功率和利用率,并实时更新。测试过程中,系统会在命令运行的当前目录生成 `mx-qual-stress.log` 文件,记录详细数据。测试结束后,输出汇总信息。 **mx-qual stress [选项]** `-h,--help` : 显示帮助信息。 `-i, --index` : 指定设备索引。取值范围:0-31。如果未指定,则测试所有设备;如果指定多个值: - 空格分隔,例如:`-i 0 1 2`。 - 花括号中逗号分隔,例如:`-i {0,1,2}`。 `-t,--time` : 指定循环测试一次的时间。取值范围:2-100000 分钟,默认值:2 分钟。 `-l,--load` : 指定压力测试的负载。取值范围:0-100%,默认值:100%。 ```Bash mx-qual stress -i 0 1 2 ``` ```Bash device temp.cur temp.avg power.cur power.avg util.cur util.avg 0 68 68 65 66 99 99 1 67 66 65 65 99 100 2 69 68 67 66 99 99 =================================================================================================== Summary =================================================================================================== device temp.min temp.max temp.avg power.min power.max power.avg util.min util.max util.avg 0 66 68 68 65 68 66 99 99 99 1 65 67 66 63 67 65 99 100 100 2 67 69 68 65 68 66 99 99 99 Test Result = PASS ``` 实时信息: ```{table} :class: bold-first-col | 输出字段 | temp.cur | temp.avg | power.cur | power.avg | util.cur | util.avg | | ----------| ------------- | ------- |----------- | ----------- |----------- |----------- | | 说明 | 当前温度 | 当前平均温度 | 当前功率 | 当前平均功率 | 当前利用率 | 当前平均利用率 | ``` 总览信息: ```{table} :class: bold-first-col | 输出字段 | temp.min | temp.max | temp.avg | power.min | power.max |power.avg | util.min | util.max | util.avg | | ----------| -------------- | --------- |-----------| ----------|----------|----------|----------|----------|----------| | 说明 | 最小温度 | 最大温度 | 平均温度 |最小功率 | 最大功率 | 平均功率 | 最小利用率 | 最大利用率 |平均利用率 | ``` ## 子命令 compute 运行算力测试。 **mx-qual compute [选项]** `-h,--help` : 显示帮助信息。 `-i, --index` : 指定设备索引。取值范围:0-31。如果未指定,则测试所有设备;如果指定多个值: - 空格分隔,例如:`-i 0 1 2`。 - 花括号中逗号分隔,例如:`-i {0,1,2}`。 测试结果以板卡为单位展示,包含在不同稀疏倍率下的性能数据。 ```Bash mx-qual compute ``` ```Bash INT8 1x sparsity: SN: 2023243080074, actual: 87.64 TOPS, target: 88.47 TOPS, Utilization: 99.06% SN: 2023243080096, actual: 87.64 TOPS, target: 88.47 TOPS, Utilization: 99.06% 2x sparsity: SN: 2023243080074, actual: 173.77 TOPS, target: 176.95 TOPS, Utilization: 98.21% SN: 2023243080096, actual: 173.62 TOPS, target: 176.95 TOPS, Utilization: 98.12% 4x sparsity: SN: 2023243080074, actual: 347.35 TOPS, target: 353.89 TOPS, Utilization: 98.15% SN: 2023243080096, actual: 347.55 TOPS, target: 353.89 TOPS, Utilization: 98.21% 8x sparsity: SN: 2023243080074, actual: 695.91 TOPS, target: 707.79 TOPS, Utilization: 98.32% SN: 2023243080096, actual: 695.91 TOPS, target: 707.79 TOPS, Utilization: 98.32% 16x sparsity: SN: 2023243080074, actual: 1377.36 TOPS, target: 1415.58 TOPS, Utilization: 97.30% SN: 2023243080096, actual: 1374.20 TOPS, target: 1415.58 TOPS, Utilization: 97.08% 32x sparsity: SN: 2023243080074, actual: 2662.64 TOPS, target: 2831.16 TOPS, Utilization: 94.05% SN: 2023243080096, actual: 2662.64 TOPS, target: 2831.16 TOPS, Utilization: 94.05% BF16 1x sparsity: SN: 2023243080074, actual: 43.82 TOPS, target: 44.24 TOPS, Utilization: 99.05% SN: 2023243080096, actual: 43.82 TOPS, target: 44.24 TOPS, Utilization: 99.05% 2x sparsity: SN: 2023243080074, actual: 86.77 TOPS, target: 88.47 TOPS, Utilization: 98.08% SN: 2023243080096, actual: 86.80 TOPS, target: 88.47 TOPS, Utilization: 98.11% 4x sparsity: SN: 2023243080074, actual: 174.13 TOPS, target: 176.95 TOPS, Utilization: 98.41% SN: 2023243080096, actual: 174.23 TOPS, target: 176.95 TOPS, Utilization: 98.46% 8x sparsity: SN: 2023243080074, actual: 348.76 TOPS, target: 353.89 TOPS, Utilization: 98.55% SN: 2023243080096, actual: 348.76 TOPS, target: 353.89 TOPS, Utilization: 98.55% 16x sparsity: SN: 2023243080074, actual: 698.35 TOPS, target: 707.79 TOPS, Utilization: 98.67% SN: 2023243080096, actual: 698.35 TOPS, target: 707.79 TOPS, Utilization: 98.67% 32x sparsity: SN: 2023243080074, actual: 1371.04 TOPS, target: 1415.58 TOPS, Utilization: 96.85% SN: 2023243080096, actual: 1374.20 TOPS, target: 1415.58 TOPS, Utilization: 97.08% Test Result = PASS ``` ## 子命令 memtest 运行内存测试。 **mx-qual memtest [选项]** `-h,--help` : 显示帮助信息。 `-i, --index` : 指定设备索引。取值范围:0-31。如果未指定,则测试所有设备;如果指定多个值: - 空格分隔,例如:`-i 0 1 2`。 - 花括号中逗号分隔,例如:`-i {0,1,2}`。 `-l,--loop` : 指定测试的循环次数。取值范围:1-100 次,默认值:1 次。 `-t,--type` : 指定测试的类型。取值:0-10,默认值:7。详细含义请参见 MemTest86 技术信息。 :::nest-table | **测试类型值** | **说明** | | ------------- | -------------------------------------| | type 0 | Walking 1 bit | | type 1 | Own address test | | type 2 | Moving inversions, ones&zeros | | type 3 | Moving inversions, 8 bit pat | | type 4 | Moving inversions, random pattern | | type 5 | Block move, 64 moves | | type 6 | Moving inversions, 32 bit pat | | type 7 | Random number sequence | | type 8 | Modulo 20, random pattern | | type 9 | Bit fade test | | type 10 | Memory stress test | ::: ```Bash mx-qual memtest -i 0 -t 0 ``` ``` Device[0] running test 4 / 4 ... passed Test Result = PASS ``` ## 子命令 eyegraph 查看 PCIe 通道的眼图。 ```{admonition} 须知 :class: note 仅支持 S30 计算卡。 ``` **sudo mx-qual eyegraph [选项]** `-h,--help` : 显示帮助信息。 `-s,--bdf` : 指定 PCIe 交换机(switch)的 BDF(bus:device:function)标识。 `-l,--lane` : 指定 PCIe 交换机通道(lane)ID。取值范围:0-15,默认值:0。 1. 查询 PCIe switch 信息。 ```Bash lspci -D | grep PMC | grep Memory | grep 4068 ``` ```Bash 0000:81:00.1 Memory controller: PMC-Sierra Inc. Device 4068 ``` 2. 查看指定 PCIe 通道的眼图。 ```Bash sudo mx-qual eyegraph -s 0000:81:00.1 -l 0 ```