适用范围 :本文档基于沐曦官方
mxvs测试工具套件手册(v3.8.0.x)编写,适用于 MetaX C500 系列通用 GPU 及配套 mxvs 工具链。
1. 工具准备与部署
1.1 前提条件
| 项目 | 要求 |
|---|---|
| 操作系统 | Linux(本文环境:UOS Server 25) |
| 驱动 | MetaX MOCA 驱动已加载(metax 内核模块) |
| 工具路径 | /opt/maca/bin/mxvs |
| 管理工具 | mx-smi(版本 2.3.1) |
| GPU卡 | 沐曦C500 x 1 |
1.2 确认工具可用性
bash
# 确认 mxvs 已部署
ls /opt/maca/bin/mxvs
# 确认驱动已加载
lsmod | grep metax
实测输出:
bash
metax 1847296 0
ttm 98304 3 drm_vram_helper,metax,drm_ttm_helper
drm 712704 9 drm_kms_helper,hibmc_drm,drm_vram_helper,drm_display_helper,metax,drm_ttm_helper,ttm
2. 设备信息查询
2.1 PCIe 设备扫描
bash
lspci | grep 9999
实测输出:
02:00.0 Display controller: Device 9999:4001 (rev 01)
2.2 mxvs 设备信息
bash
/opt/maca/bin/mxvs devices
实测输出(Kunpeng-920 双路服务器):
[root@localhost bin]# /opt/maca/bin/mxvs devices
CPU Devices
CORES IN
Model Count Arch CORES IN NUMA0 CORES IN NUMA1 CORES IN NUMA2 NUMA3
──────────────────────────────────────────────────────────────────────────────────────────────────
Kunpeng-920 2 aarch64 0-23 24-47 48-71 72-95
GPU Devices
#BOARD #GPU Model BDF VBIOS KMD NUMA NODE
──────────────────────────────────────────────────────────────────────────────────────────────────
0 0 MetaX C500 0000:02:00.0 1.33.4.0 3.8.23 0
本环境为单卡 C500。
2.3 mx-smi 完整信息
bash
mx-smi
实测输出:
[root@localhost data]# mx-smi
mx-smi version: 2.3.1
=================== MetaX System Management Interface Log ===================
Timestamp : Thu Sep 10 17:17:23 2026
Attached GPUs : 1
+---------------------------------------------------------------------------------+
| MX-SMI 2.3.1 Kernel Mode Driver Version: 3.8.23 |
| MACA Version: 3.7.0.38 BIOS Version: 1.33.4.0 |
|------------------+-----------------+---------------------+----------------------|
| Board Name | GPU Persist-M | Bus-id | GPU-Util sGPU-M |
| Pwr:Usage/Cap | Temp Perf | Memory-Usage | GPU-State |
|==================+=================+=====================+======================|
| 0 MetaX C500 | 0 Off | 0000:02:00.0 | 0% Disabled |
| 43W / 350W | 64C P0 | 858/65536 MiB | Available |
+------------------+-----------------+---------------------+----------------------+
+---------------------------------------------------------------------------------+
| Process: |
| GPU PID Process Name GPU Memory |
| Usage(MiB) |
|=================================================================================|
| no process found |
+---------------------------------------------------------------------------------+
2.4 显卡工作状态 Dashboard
bash
/opt/maca/bin/mxvs dashboard
Dashboard 实时展示各 GPU 的功耗、温度、频率、显存占用等核心指标,建议压测前先确认各指标正常。
3. PCIe 验收测试
重要背景 :PCIe 链路速率是 GPU 与主机之间数据传输的瓶颈。本服务器实测C500 卡的 PCIe 协商为 2.5GT/s(PCIe 1.1)×8 宽度 ,远低于 B200 理论支持的 32GT/s(PCIe 5.0)×16,主要原因在于服务器根端口(
00:04.0)为 Gen4 x8 且链路训练被降级。
3.1 PCIe 实时速率查询
bash
/opt/maca/bin/mxvs pcie bandwidth --devices <DEVICE_ID>
可选参数:
| 参数 | 必填 | 说明 |
|---|---|---|
-d, --devices |
否 | GPU 设备 ID,默认所有设备 |
-c, --continuous |
否 | 持续监控模式 |
实测输出:
[root@localhost data]# /opt/maca/bin/mxvs pcie bandwidth --devices 0
MXVS PCIE BANDWIDTH
PCIE PCIE
#ID BDF SPEED WIDTH RX TX
──────────────────────────────────────────────────────────────────────────────
0 0000:02:00.0 2.5 GT/s 8 0 MBytes/s 0 MBytes/s
[root@localhost data]# /opt/maca/bin/mxvs pcie bandwidth --devices all
MXVS PCIE BANDWIDTH
PCIE PCIE
#ID BDF SPEED WIDTH RX TX
──────────────────────────────────────────────────────────────────────────────
0 0000:02:00.0 2.5 GT/s 8 0 MBytes/s 0 MBytes/s
当前 RX/TX 为 0 MBytes/s,说明没有负载正在跑。带
--continuous可持续监控。
典型用法示例:
bash
# 查询设备 0 的 PCIe 实时速率
/opt/maca/bin/mxvs pcie bandwidth --devices 0
# 查询所有设备的 PCIe 实时速率
/opt/maca/bin/mxvs pcie bandwidth --devices all
# 持续监控所有设备 PCIe 速率(每秒刷新)
/opt/maca/bin/mxvs pcie bandwidth --devices all --continuous
3.2 PCIe 单向带宽测试
bash
/opt/maca/bin/mxvs pcie benchmark unidirection \
--src-devices <SRC> \
--dst-devices <DST>
关键参数:
| 参数 | 必填 | 说明 |
|---|---|---|
--src-devices |
是 | 源设备 ID,all 表示全部 |
--dst-devices |
是 | 目的设备 ID,all 表示全部 |
-s, --data-sizes |
否 | 测试数据量,默认 7GB,支持 KB/MB/GB |
--cpu-affinity |
否 | 绑定 CPU 核心,避免跨 NUMA 影响 |
--bref |
否 | 简洁输出(不显示设备基本信息) |
--json |
否 | JSON 格式输出,如 --json result.json |
--pre-malloc |
否 | 预分配显存后再测 |
--parallel |
否 | 并行执行,需配合 --pre-malloc |
--monitor-log |
否 | 实时打印内核错误 |
--no-check |
否 | 关闭数据校验(可提升测试速度) |
--detail |
否 | 显示每个 GPU 的详细结果 |
跨 NUMA 注意:若不同 NUMA 节点设备带宽结果差异大,尝试:
bashecho 3 > /proc/sys/vm/drop_caches再重新测试。
实测输出:
bash
[root@localhost data]# /opt/maca/bin/mxvs pcie benchmark unidirection \
> --src-devices 0 --dst-devices 0
MetaX GPU Information
──────────────────────────────────────────────────────────────────────────────────────────────────
MACA 3.7.0.38
TIMESTAMP Thu Sep 10 17:44:04 2026
──────────────────────────────────────────────────────────────────────────────────────────────────
GPU ID 0
MODEL MetaX C500
BDF 0000:02:00.0
KMD 3.8.23
VBIOS 1.33.4.0
NUMA NODE 0
CURRENT PCIE speed: 2.5 GT/s width: x8
MAXIMUM PCIE speed: 16.0 GT/s width: x8
METAXLINK PORTS
──────────────────────────────────────────────────────────────────────────────────────────────────
PCIE UNIDIRECTIONAL BENCHMARK
SRC DST EFFECTIVE RAW TRANSMISSION DATA
DEVICE DEVICE SIZE(B) BANDWIDTH BANDWIDTH DELAY (us) VALIDATION
──────────────────────────────────────────────────────────────────────────────────────────────────
CPU << BOARD#0 4294967296 13.47 GB/s 15.06 GB/s 318901.64 PASS
CPU >> BOARD#0 4294967296 11.87 GB/s 13.48 GB/s 361742.38 PASS
典型用法示例:
bash
# 单卡自发自收,测试本地 PCIe 带宽
/opt/maca/bin/mxvs pcie benchmark unidirection \
--src-devices 0 --dst-devices 0
# 多卡测试:GPU0 向 GPU1 发起单向带宽测试,指定 CPU 亲和性
/opt/maca/bin/mxvs pcie benchmark unidirection \
--src-devices 0 --dst-devices 1 \
--cpu-affinity 0-23
# 所有卡两两测试,输出详细结果,关闭数据校验提升速度
/opt/maca/bin/mxvs pcie benchmark unidirection \
--src-devices all --dst-devices all \
--bref --detail --no-check
# 指定数据块大小进行测试,输出 JSON 便于后续分析
/opt/maca/bin/mxvs pcie benchmark unidirection \
--src-devices 0 --dst-devices 0 \
--data-sizes 1KB,1MB,1GB \
--json result.json --detail
3.3 PCIe 双向带宽测试
⚠️ 需要 ≥2 张 GPU 卡,单卡环境无法执行。
bash
/opt/maca/bin/mxvs pcie benchmark bidirection \
--devices <DEVICE_1>,<DEVICE_2>
关键参数:
| 参数 | 必填 | 说明 |
|---|---|---|
-d, --devices |
是 | 两个以上设备 ID,all 表示全部 |
-s, --data-sizes |
否 | 测试数据量,默认 7GB |
--cpu-affinity |
否 | CPU 核心绑定 |
--bref |
否 | 简洁输出 |
--json |
否 | JSON 输出 |
--monitor-log |
否 | 打印内核错误 |
--no-check |
否 | 关闭数据校验 |
--detail |
否 | 显示详细 GPU 结果 |
典型用法示例:
bash
# 两卡双向带宽测试(需要 ≥2 张卡)
/opt/maca/bin/mxvs pcie benchmark bidirection --devices 0,1
# 四卡全部双向测试
/opt/maca/bin/mxvs pcie benchmark bidirection --devices all
# 指定数据量,指定 CPU 亲和性,输出详细结果
/opt/maca/bin/mxvs pcie benchmark bidirection \
--devices 0,1 \
--data-sizes 1GB \
--cpu-affinity 0-23 \
--detail --bref
3.4 PCIe 眼图特性测试
⚠️ 测试后需重启服务器,测试过程中不要中断。
bash
/opt/maca/bin/mxvs eye --devices <DEVICE_ID> \
--phys <PHY_ID> \
--lanes <LANE_ID>
关键参数:
| 参数 | 必填 | 说明 |
|---|---|---|
-d, --devices |
否 | 设备 ID,默认所有 |
-p, --phys |
否 | 物理层编号 0-3,默认所有 |
-l, --lanes |
否 | 差分信号组合 0-3,默认所有 |
--bref |
否 | 简洁输出 |
注意事项:
-
测试前确认无其他进程占用 GPU:
bashmx-smi --show-all-process -
测试中不要按 Ctrl+C,以免异常
-
测试后必须重启服务器
实测输出:
bash
[root@localhost bin]# /opt/maca/bin/mxvs eye --devices 0
MetaX GPU Information
──────────────────────────────────────────────────────────────────────────────
MACA 3.7.0.38
TIMESTAMP Thu Sep 10 10:18:58 2026
──────────────────────────────────────────────────────────────────────────────
GPU ID 0
MODEL MetaX C500
BDF 0000:02:00.0
KMD 3.8.23
VBIOS 1.33.4.0
NUMA NODE 0
CURRENT PCIE speed: 2.5 GT/s width: x8
MAXIMUM PCIE speed: 16.0 GT/s width: x8
METAXLINK PORTS
──────────────────────────────────────────────────────────────────────────────
MXVS PCIE EYE GRAPH REPORT
DEV# BDF PHY LANE HEIGHT WIDTH
──────────────────────────────────────────────────────────────────────────────
0 0000:02:00.0 0 0 951.86 mV 32.00 UI
0 0000:02:00.0 0 1 951.86 mV 32.00 UI
0 0000:02:00.0 0 2 951.86 mV 32.00 UI
0 0000:02:00.0 0 3 951.86 mV 32.00 UI
0 0000:02:00.0 1 0 951.86 mV 32.00 UI
0 0000:02:00.0 1 1 951.86 mV 32.00 UI
0 0000:02:00.0 1 2 951.86 mV 32.00 UI
0 0000:02:00.0 1 3 951.86 mV 32.00 UI
0 0000:02:00.0 2 0 161.74 mV 0.66 UI
0 0000:02:00.0 2 1 171.04 mV 0.60 UI
0 0000:02:00.0 2 2 178.47 mV 0.66 UI
0 0000:02:00.0 2 3 180.33 mV 0.63 UI
0 0000:02:00.0 3 0 146.87 mV 0.57 UI
0 0000:02:00.0 3 1 167.32 mV 0.57 UI
0 0000:02:00.0 3 2 152.45 mV 0.63 UI
0 0000:02:00.0 3 3 187.77 mV 0.57 UI
典型用法示例:
bash
# 对设备 0 执行完整眼图测试(所有物理层、所有通道)
/opt/maca/bin/mxvs eye --devices 0 --bref
# 只测物理层 0 的眼图
/opt/maca/bin/mxvs eye --devices 0 --phys 0 --bref
# 对所有设备执行眼图测试
/opt/maca/bin/mxvs eye --devices all --bref
4. Memory 验收测试
4.1 Memory 实时带宽查询
bash
/opt/maca/bin/mxvs memory bandwidth --devices <DEVICE_ID>
可选参数:
| 参数 | 必填 | 说明 |
|---|---|---|
-d, --devices |
否 | 设备 ID,默认所有 |
-c, --continuous |
否 | 持续监控 |
实测输出:
bash
[root@localhost data]# /opt/maca/bin/mxvs memory bandwidth --devices 0
─ HBM BANDWIDTH ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ #ID #DIE BDF REQUEST RESPONSE │
│ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │
│ 0 0 0000:02:00.0 1.00 MB/s 1.00 MB/s │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
典型用法示例:
bash
# 查询设备 0 的 Memory 实时带宽
/opt/maca/bin/mxvs memory bandwidth --devices 0
# 查询所有设备的 Memory 实时带宽
/opt/maca/bin/mxvs memory bandwidth --devices all
# 持续监控所有设备 Memory 带宽(每秒刷新)
/opt/maca/bin/mxvs memory bandwidth --devices all --continuous
4.2 Memory 带宽测试
bash
/opt/maca/bin/mxvs memory benchmark --devices <DEVICE_ID>
关键参数:
| 参数 | 必填 | 说明 |
|---|---|---|
-d, --devices |
否 | 设备 ID,默认所有 |
--kernel-copy |
否 | 读写模式(默认只读) |
--monitor-log |
否 | 打印内核错误 |
--bref |
否 | 简洁输出 |
--json |
否 | JSON 输出 |
--detail |
否 | 显示详细结果 |
-s, --data-sizes |
否 | 测试数据量,默认 10GB |
实测输出:
[root@localhost data]# /opt/maca/bin/mxvs memory benchmark --devices 0
MetaX GPU Information
──────────────────────────────────────────────────────────────────────────────
MACA 3.7.0.38
TIMESTAMP Thu Sep 10 17:47:02 2026
──────────────────────────────────────────────────────────────────────────────
GPU ID 0
MODEL MetaX C500
BDF 0000:02:00.0
KMD 3.8.23
VBIOS 1.33.4.0
NUMA NODE 0
CURRENT PCIE speed: 2.5 GT/s width: x8
MAXIMUM PCIE speed: 16.0 GT/s width: x8
METAXLINK PORTS
──────────────────────────────────────────────────────────────────────────────
HBM BANDWIDTH BENCHMARK TEST
BOARD BDF SIZE(B) BANDWIDTH
──────────────────────────────────────────────────────────────────────────────
0 0000:02:00.0 10737418240 1679.17 GB/s
典型用法示例:
bash
# 基础 Memory 带宽测试
/opt/maca/bin/mxvs memory benchmark --devices 0
# 所有设备 Memory 带宽测试,输出详细结果
/opt/maca/bin/mxvs memory benchmark --devices all --detail
# 指定测试数据量(1GB),启用读写模式(kernel-copy),输出 JSON
/opt/maca/bin/mxvs memory benchmark \
--devices 0 \
--data-sizes 1GB \
--kernel-copy \
--bref \
--json memory_bw.json
# 指定 10GB 数据量,实时打印内核错误
/opt/maca/bin/mxvs memory benchmark --devices 0 --data-sizes 10GB --monitor-log
5. MetaXLink 验收测试
MetaXLink 是沐曦自研的卡间互联技术,提供高带宽低延迟的 GPU-to-GPU 直连通信。
⚠️ 需要设备间有 MetaXLink 连接(多卡服务器)。单卡 B200 环境无 MetaXLink 拓扑。
5.1 MetaXLink 实时带宽查询
bash
/opt/maca/bin/mxvs metaxlink bandwidth --devices <DEVICE_ID>
| 参数 | 必填 | 说明 |
|---|---|---|
-d, --devices |
否 | 设备 ID,默认所有 |
-c, --continuous |
否 | 持续监控 |
典型用法示例:
bash
# 查询设备 0 的 MetaXLink 实时带宽
/opt/maca/bin/mxvs metaxlink bandwidth --devices 0
# 持续监控所有设备的 MetaXLink 带宽
/opt/maca/bin/mxvs metaxlink bandwidth --devices all --continuous
5.2 MetaXLink 带宽测试
bash
/opt/maca/bin/mxvs metaxlink benchmark --devices <SRC_DEVICE>
关键参数:
| 参数 | 必填 | 说明 |
|---|---|---|
--devices |
否 | 设备 ID,默认所有,all |
--mode |
否 | 数据拷贝方向:ingress(源从目的拷)或 egress(源向目的拷),默认 egress |
-s, --data-sizes |
否 | 测试数据量,默认 7GB |
--bref |
否 | 简洁输出 |
--json |
否 | JSON 输出 |
--monitor-log |
否 | 打印内核错误 |
--detail |
否 | 显示详细 GPU 结果 |
典型用法示例:
bash
# 基础 MetaXLink 带宽测试(默认 egress 模式,7GB 数据量)
/opt/maca/bin/mxvs metaxlink benchmark --devices all
# 设备 0 egress(源向目的)带宽测试,指定 1GB 数据量
/opt/maca/bin/mxvs metaxlink benchmark --devices 0 \
--mode egress --data-sizes 1GB --bref
# 设备 0 ingress(源从目的)带宽测试,输出详细结果
/opt/maca/bin/mxvs metaxlink benchmark --devices 0 \
--mode ingress --detail
# 所有设备带宽测试,输出 JSON 便于后续分析
/opt/maca/bin/mxvs metaxlink benchmark --devices all \
--bref --json mxlk_bw.json
5.3 MetaXLink 眼图特性测试
⚠️ 测试后建议重启。
bash
/opt/maca/bin/mxvs eye --metaxlink \
--metaxlink-ports <PORT_ID> \
--devices <DEVICE_ID> \
--lanes <LANE_ID> \
--phys <PHY_ID>
关键参数:
| 参数 | 必填 | 说明 |
|---|---|---|
--metaxlink |
是 | 开启 MetaXLink 眼图测试 |
--metaxlink-ports |
否 | 端口 ID(1-7,已连接端口),默认全部 |
-d, --devices |
否 | 设备 ID,默认所有 |
-l, --lanes |
否 | 差分信号 0-3,默认所有 |
-p, --phys |
否 | 物理层 0-3,默认所有 |
查看已连接端口:
bashmx-smi mxlk --show
典型用法示例:
bash
# 设备 0 全端口眼图测试
/opt/maca/bin/mxvs eye --metaxlink --devices 0 --bref
# 设备 0 的端口 1、2 眼图测试
/opt/maca/bin/mxvs eye --metaxlink --devices 0 --metaxlink-ports 1,2 --bref
# 指定物理层和 lane
/opt/maca/bin/mxvs eye --metaxlink --devices 0 --phys 0 --lanes 0 --bref
6. P2P 验收测试
P2P(Peer-to-Peer)测试 GPU 之间跨 PCIe 或 MetaXLink 的直接内存访问带宽。
⚠️ 需要 ≥2 张 GPU 卡。单卡环境仅可测试 Memory 带宽。
6.1 P2P 带宽测试
bash
/opt/maca/bin/mxvs p2p \
--src-devices <SRC_ID1>,<SRC_ID2> \
--dst-devices <DST_ID1>,<DST_ID2>
关键参数:
| 参数 | 必填 | 说明 |
|---|---|---|
--src-devices |
是 | 源设备 ID,all |
--dst-devices |
是 | 目的设备 ID,all |
-s, --data-sizes |
否 | 测试数据量,默认 7GB |
--mode |
否 | ingress(源从目的拷)或 egress(源向目的拷),默认双向 |
--unidirection |
否 | 开启单向测试 |
--parallel |
否 | 并行单向测试(需配合 --unidirection) |
--filter-topo-type |
否 | 链路类型过滤:pcie、metaxlink、eth、all |
--json |
否 | JSON 输出 |
--monitor-log |
否 | 打印内核错误 |
--pre-malloc |
否 | 预分配显存 |
--sdma |
否 | 使用 SDMA 引擎(默认 XCORE) |
典型用法示例:
bash
# GPU0 同时向 GPU1、2、3 拷数据
mxvs p2p --src-devices 0 --dst-devices 1,2,3 --unidirection --parallel
# GPU0↔GPU2、GPU1↔GPU3 双向同时测试
mxvs p2p --src-devices 0,2,1,3 --dst-devices 2,0,3,1 --unidirection --parallel
7. 算力测试
7.1 基础算力测试
bash
/opt/maca/bin/mxvs ops --devices <DEVICE_ID> --models <MODEL_NAME>
关键参数:
| 参数 | 必填 | 说明 |
|---|---|---|
-m, --models |
否 | 精度类型:int8、bf16、fp16_matrix/vector、fp32_matrix/vector、tf32;默认测试所有 |
-d, --devices |
否 | 设备 ID,all,默认所有 |
--mode |
否 | 测试模式:0=全0矩阵(默认),1=随机sin/cos,2=随机 |
--bref |
否 | 简洁输出 |
--json |
否 | JSON 输出 |
--monitor-log |
否 | 打印内核错误 |
--detail |
否 | 显示每块 GPU 详细结果 |
--blas |
否 | 使用 gemm 执行算力测试 |
-i, --iteration |
否 | 遍历次数,默认 10000(--blas 时默认 100) |
实测输出:
[root@localhost data]# /opt/maca/bin/mxvs ops --devices all
MetaX GPU Information
──────────────────────────────────────────────────────────────────────────────
MACA 3.7.0.38
TIMESTAMP Thu Sep 10 17:48:58 2026
──────────────────────────────────────────────────────────────────────────────
GPU ID 0
MODEL MetaX C500
BDF 0000:02:00.0
KMD 3.8.23
VBIOS 1.33.4.0
NUMA NODE 0
CURRENT PCIE speed: 16.0 GT/s width: x8
MAXIMUM PCIE speed: 16.0 GT/s width: x8
METAXLINK PORTS
──────────────────────────────────────────────────────────────────────────────
MXVS PERFORMANCE BENCHMARK TEST
BOARD BDF MODEL TOPS/TFLOPS
──────────────────────────────────────────────────────────────────────────────
0 0000:02:00.0 int8 478.38
0 0000:02:00.0 bf16 239.52
0 0000:02:00.0 fp16_matrix 239.52
0 0000:02:00.0 fp32_vector 14.96
0 0000:02:00.0 fp32_matrix 29.95
0 0000:02:00.0 tf32 119.76
典型用法示例:
bash
# 测试所有设备的所有精度算力(默认 10000 次迭代)
/opt/maca/bin/mxvs ops --devices all
# 只测设备 0 的 fp16_matrix 精度
/opt/maca/bin/mxvs ops --devices 0 --models fp16_matrix --bref
# 测试 int8 和 bf16 精度,输出详细结果
/opt/maca/bin/mxvs ops --devices 0 --models int8,bf16 --detail
# 使用 gemm 模式测试(默认 100 次迭代),便于快速验证
/opt/maca/bin/mxvs ops --devices all --blas --bref
# 指定随机值模式(mode=2),迭代 5000 次,输出 JSON
/opt/maca/bin/mxvs ops --devices 0 \
--models fp32_vector \
--mode 2 --iteration 5000 \
--json ops_fp32.json --detail
7.2 软切分(sGPU)算力测试
C588 不支持软切分。
bash
# 1. 对设备 0-1 使能软切分
mx-smi sgpu --enable -i 0-1
# 2. 为设备 0 创建 5 个默认子设备(每个 4GB 显存,5% 算力)
mx-smi sgpu -i 0 --create -n 5
# 3. 为设备 1 创建 1 个子设备(30% 显存,50% 算力)
mx-smi sgpu -i 1 --create --vram 30% --compute 50
# 4. 对子设备执行算力测试
/opt/maca/bin/mxvs ops -d 0-s2,1-s0 --detail
子设备显存需大于 1GB。父设备一旦使能切分,父设备本身不可用。
典型用法示例:
bash
# 完整流程:使能切分 → 创建子设备 → 执行算力测试
mx-smi sgpu --enable -i 0-1 # 对设备 0、1 使能软切分
mx-smi sgpu -i 0 --create -n 5 # 设备 0 创建 5 个默认子设备
mx-smi sgpu -i 1 --create --vram 30% --compute 50 # 设备 1 创建 1 个子设备
# 对指定子设备执行算力测试
/opt/maca/bin/mxvs ops -d 0-s2,1-s0 --detail
# 创建单个子设备后快速验证算力
mx-smi sgpu --enable -i 0
mx-smi sgpu -i 0 --create -n 1
/opt/maca/bin/mxvs ops -d 0-s0 --models fp16_matrix --bref
8. 压力测试
压力测试用于验证 GPU 在高负载下的稳定性,持续监控功耗、温度、带宽等指标。
8.1 XCORE 压力测试
bash
/opt/maca/bin/mxvs stress --xcore --xcore-devices <DEVICE_ID>
关键参数:
| 参数 | 必填 | 说明 |
|---|---|---|
--xcore |
是 | 开启 XCORE 压力测试 |
--xcore-devices |
否 | 设备 ID,all,默认所有 |
--xcore-datatype |
否 | 数据类型:half(默认,MXC600系列默认int8)float double int8 |
--gpu-memory |
否 | 显存使用比例,如 --gpu-memory 80 表示 80% |
--duration |
否 | 持续时间,格式 HH:MM,默认 00:30(30分钟) |
--pulse |
否 | 脉冲测试开关 |
--panels |
否 | 面板显示项:0=BOARD POWER,2=USAGE |
--monitor-log |
否 | 打印内核错误 |
长时间压力测试(后台运行):
bash
nohup /opt/maca/bin/mxvs stress --xcore --duration 12:00 &
8.2 MetaXLink 压力测试
⚠️ 需要 ≥2 张 GPU 卡。
bash
/opt/maca/bin/mxvs stress --metaxlink
关键参数:
| 参数 | 必填 | 说明 |
|---|---|---|
--metaxlink |
是 | 开启 MetaXLink 压力测试 |
--metaxlink-mode |
否 | 打流模式:0=XCORE,1=自动(x16用XCORE,x8用SDMA,默认),2=SDMA |
--duration |
否 | 持续时间,默认 00:30 |
--pulse |
否 | 波动测试开关 |
--panels |
否 | 面板显示项:0=BOARD POWER,2=USAGE,3=METAXLINK BANDWIDTH |
--monitor-log |
否 | 打印内核错误 |
典型用法示例:
bash
# 基础 MetaXLink 压力测试,默认 30 分钟,模式 1(自动选择 XCORE/SDMA)
/opt/maca/bin/mxvs stress --metaxlink
# 指定模式 0(纯 XCORE 打流),60 分钟,启用波动测试
/opt/maca/bin/mxvs stress --metaxlink --metaxlink-mode 0 --duration 01:00 --pulse
# 12 小时长时间后台压力测试
nohup /opt/maca/bin/mxvs stress --metaxlink --duration 12:00 &
# 指定面板显示功耗、使用率、MetaXLink 带宽,实时监控内核错误
/opt/maca/bin/mxvs stress --metaxlink \
--duration 00:30 \
--panels 0,2,3 \
--monitor-log
8.3 ETH 压力测试
ETH 是沐曦的自研网络接口,用于多机互联。
⚠️ 需要 ≥2 个网络端点。
bash
/opt/maca/bin/mxvs stress --eth
关键参数:
| 参数 | 必填 | 说明 |
|---|---|---|
--eth |
是 | 开启 ETH 压力测试 |
--duration |
否 | 持续时间,默认 00:30 |
--pulse |
否 | 波动测试开关 |
--panels |
否 | 面板显示项:0=BOARD POWER,2=USAGE,4=ETH BANDWIDTH |
--monitor-log |
否 | 打印内核错误 |
典型用法示例:
bash
# 基础 ETH 压力测试,默认 30 分钟
/opt/maca/bin/mxvs stress --eth
# 60 分钟 ETH 压力测试,启用波动
/opt/maca/bin/mxvs stress --eth --duration 01:00 --pulse
# 12 小时长时间后台运行
nohup /opt/maca/bin/mxvs stress --eth --duration 12:00 &
# 指定面板显示功耗、使用率、ETH 带宽,实时监控内核错误
/opt/maca/bin/mxvs stress --eth \
--duration 00:30 \
--panels 0,2,4 \
--monitor-log
9. 实战推荐测试顺序
针对单卡服务器(如本文实测的 沐曦C500),推荐按以下顺序执行:
bash
# ========== 第一阶段:环境核查 ==========
# 1. 确认设备可见
lspci | grep 9999
# 2. 查看 GPU 工作状态
mx-smi
/opt/maca/bin/mxvs dashboard
# ========== 第二阶段:基础性能测试 ==========
# 3. PCIe 实时速率
/opt/maca/bin/mxvs pcie bandwidth --devices 0
# 4. Memory 实时带宽
/opt/maca/bin/mxvs memory bandwidth --devices 0 --continuous
# 5. 算力基线测试
/opt/maca/bin/mxvs ops --devices all --bref --detail
# ========== 第三阶段:满载压力测试 ==========
# 6. XCORE 压力测试(30分钟基线)
/opt/maca/bin/mxvs stress --xcore --xcore-devices 0 \
--xcore-datatype half \
--gpu-memory 80 \
--duration 00:30 \
--monitor-log
# 7. Memory 带宽压测
/opt/maca/bin/mxvs memory benchmark --devices 0 --detail
# 8. 跨 NUMA 跨链路的 PCIe 单向带宽(带 CPU 亲和性绑定)
/opt/maca/bin/mxvs pcie benchmark unidirection \
--src-devices 0 \
--dst-devices 0 \
--cpu-affinity 0-23 \
--monitor-log \
--detail
注意 :PCIe 眼图测试(
mxvs eye)和 ETH 眼图测试会修改硬件配置,每次执行后务必重启服务器,避免残留状态影响后续测试结果。
附录:PCIe 链路降级原因分析
本文实测服务器(华为泰山,Kunpeng-920 × 2)上的 PCIe 链路状态:
设备 02:00.0 B200:
LnkCap: Speed 32GT/s (PCIe 5.0), Width x16
LnkSta: Speed 2.5GT/s ⚠️ (downgraded), Width x8 ⚠️
根端口 00:04.0:
LnkCap: Speed 16GT/s (PCIe 4.0), Width x8
LnkSta: Speed 2.5GT/s, Width x8
LnkCtl2: Target Link Speed → 2.5GT/s(被锁死)
降级根因:
- 根端口物理通道数不足:上游根端口仅支持 Gen4 x8,即使 沐曦C500 卡支持 Gen5 x16,也被物理通道数限制
- Target Link Speed 被限制为 2.5GT/s:链路训练协商失败,无法升速至更高 Gen
- 实际带宽仅 ~2GB/s:对比理论 32GT/s × 16 ≈ 64GB/s,差距约 32 倍