2. 工具介绍
2.1. 支持的并行维度
维度 |
说明 |
|---|---|
TP |
Tensor Parallel,张量并行 |
CP |
Context Parallel,上下文并行 |
PP |
Pipeline Parallel,流水并行 |
DP |
Data Parallel,数据并行 |
EP |
Expert Parallel,专家并行 |
2.2. 命令行参数
mx-cmi是通信库巡检工具,本功能(device_order)作为巡检工具中一个子功能,集成在mx-cmi中。
在使用本工具前,需要安装 MXMACA SDK,SDK的安装目录可以自定义,默认安装在 /opt/maca。 如SDK安装在默认路径,则mx-cmi工具的具体路径为: /opt/maca/tools/communication/inspector/mx-cmi。
device_order 工具的具体使用参数如下:
usage: /opt/maca/tools/communication/inspector/mx-cmi device_order [-h] [--tp TP] [--dp DP] [--ep EP] [--pp PP] [--cp CP] [--visible-devices VISIBLE_DEVICES] [--show-groups]
Generate MACA_VISIBLE_DEVICES ordering for METAX devices.
optional arguments:
-h, --help show this help message and exit
--tp TP tensor parallel rank num (default: 1)
--dp DP data parallel rank num (default: 1)
--ep EP expert parallel rank num (default: 1)
--pp PP pipeline parallel rank num (default: 1)
--cp CP context parallel rank num (default: 1)
--visible-devices VISIBLE_DEVICES, --visible VISIBLE_DEVICES
a list of visible devices, for example --visible 0,1,2,3,4,5,6,7
--show-groups Print the per-dimension split summary.
也可以根据如下命令参数查看帮助信息:
/opt/maca/tools/communication/inspector/mx-cmi device_order -h
2.3. 使用示例
# TP8 + DP2
/opt/maca/tools/communication/inspector/mx-cmi device_order --tp 8 --dp 2
# TP4 + DP4
/opt/maca/tools/communication/inspector/mx-cmi device_order --tp 4 --dp 4
# MoE:TP2 + EP8
/opt/maca/tools/communication/inspector/mx-cmi device_order --tp 2 --ep 8
2.4. 输出说明
标准输出为可直接使用的MACA卡序环境变量配置,可以导入到当前运行环境:
MACA_DEVICE_ORDER=PCI_BUS_ID
MACA_VISIBLE_DEVICES=…
示例如下:
# TP4 + DP4
$ /opt/maca/tools/communication/inspector/mx-cmi device_order --tp 4 --dp 4
MACA_DEVICE_ORDER=PCI_BUS_ID
MACA_VISIBLE_DEVICES="0,1,2,3,6,5,4,7,10,11,8,9,14,13,12,15"
# TP8 + DP2
$ /opt/maca/tools/communication/inspector/mx-cmi device_order --tp 8 --dp 2
MACA_DEVICE_ORDER=PCI_BUS_ID
MACA_VISIBLE_DEVICES="0,1,2,3,6,5,4,7,10,9,8,11,14,15,12,13"