可评估 AllGather、ReduceScatter 等集合通信算子在不同集群规模和数据量下的耗时与算法带宽,支持多种执行策略与算法模板,输出结果可展示在控制台或 Excel。【此简介由AI生成】
Access rate limit exceeded. Please log in to continue.
performanceEstimate
集合通信算子理论性能评估工具,用于评估 AllGather、ReduceScatter、AllReduce、AllToAll 算子在不同集群规模和数据量下的耗时与算法带宽。
项目结构
performanceEstimate/
├── main.py # 入口,CLI 参数解析
├── config.py # 全局常量(物理带宽、延迟、HBM 带宽)
├── operators/ # 算子定义(AllGather, ReduceScatter, AllReduce, AllToAll)
├── executors/ # 执行策略(sole, seq, parallel)
├── templates/ # 算法模板(nhr_allgather, mesh_allgather, nhr_reducescatter, mesh_reducescatter, alltoall)
├── utils/ # 工具函数(带宽利用率查询、数据量解析、日志)
├── output/ # 输出方式(控制台、Excel)
├── tests/ # 单元测试
└── run.sh # 示例脚本
使用方法
python main.py --opType <算子类型> -n <卡数> [-p <server数>] [--dataSize <数据量>] [--executorType <算法类型>] [--output <输出方式>]
参数说明
| 参数 | 说明 | 必填 | 默认值 |
|---|---|---|---|
--opType |
算子类型:AllGather / ReduceScatter / AllReduce / AllToAll / ALL | 是 | - |
-n |
单 server 卡数 | 是 | - |
-p |
server 数 | 否 | 1 |
-s |
超节点数 | 否 | 1 |
--closPortNum |
Clos 端口数量 | 否 | 8 |
--dataSize |
数据量,支持单个值(1GB)或范围(1k-8k) | 否 | 1GB |
--executorType |
算法类型:sole / sequence / parallel / concurrent | 否 | parallel |
--executor_args |
执行器参数,parallel 需要 ratio=0.5,sequence 需要 closPortNum | 否 | ratio=0.5 |
--output |
输出方式:console / excel | 否 | console |
--outputFile |
Excel 输出文件名 | 否 | result.xlsx |
--verbose |
输出详细计算过程 | 否 | False |
示例
# 评估所有算子,8卡×16机,数据量 1GB
python main.py --opType ALL -n 8 -p 16 --closPortNum 8 --dataSize 1G --verbose
# 评估 AllGather,8卡,输出到 Excel
python main.py --opType AllGather -n 8 --output excel --outputFile result.xlsx
# 评估 ReduceScatter,不同数据量范围
python main.py --opType ReduceScatter -n 8 -p 4 --dataSize 1m-128m
# 使用 SeqExecutor 评估,指定 Clos 端口数
python main.py --opType ALL -n 8 -p 8 --executorType sequence --closPortNum 4 --dataSize 1G
执行策略说明
| 执行策略 | 说明 |
|---|---|
parallel |
两维度并发,按 ratio 切分数据,先 mesh+nhr 并发,再反向并发,耗时取 max |
sequence |
SeqExecutor,第一步单维度模板,第二步按带宽比例 (n-1):closPortNum 切分后 mesh+nhr 并发 |
concurrent |
单 server 内 mesh+clos 链路并发,按带宽比例 (n-1):closPortNum 自动切分,耗时取 max,仅使用 n |
sole |
单模板执行,仅使用 mesh 链路 |
运行测试
pytest tests/