集群场景的大模型并行方式优化推荐

专家系统通过对集群场景大模型并行方式分析,找到当前模型运行耗时最短的并行方式。包括对data_parallel_num, model_parallel_num, pipeline_stage_num, micro_batch_num的修改设置建议以及理论上使用建议的并行方式后的模型运行时间。

图1 集群场景的大模型并行方式优化推荐分析结果
表1 优化建议

输出建议

中文含义

Modify the following parameters in the TransformerOpParallelConfig interface

修改训练脚本中TransformerOpParallelConfig接口的如下参数值。

Set data_parallel_num to *

数据并行,在数据维度进行切分,分成data_parallel_num份,分配到不同的节点上。

Set model_parallel_num to *

模型并行,将模型的每一层的参数进行切分,并分配分配在model_parallel_num个节点上。

Set pipeline_stage_num to *

pipeline 并行,将模型的不同层分配到pipeline_stage_num个节点上。

Set micro_batch_num to *

pipeline并行会产生bubble,设备总会出现等待,为了提高设备利用率,对数据进一步切分成micro_batch_num份。

表2 输出字段说明

字段

说明

Theoretically, the time consumption and memory usage after parallel config are optimized

理论上使用建议的并行方式后的模型运行时间。

overall_time(ms): *

整体运行时间。

compute_time(ms): *

计算时间。

communication_time(ms): *

通信时间。

memory_for_npu(G): *

单卡占用显存。