aliyun / aliyun/SimAI

单机单卡仿真结果跟真实运行结果相差一个数量级

Open
#166 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.2k
Forks
184
Avg merge
13h 4m
Merged PRs (30d)
1

Description

在包含1个英伟达V100S GPU的训练megatron-lm 126m的模型,实测的迭代时间为680ms-740ms之间,但运行SimAI模拟出来的迭代时间却是6042ms。

模型训练命令如下:
torchrun --nproc_per_node=1 pretrain_gpt.py --tensor-model-parallel-size 1 --pipeline-model-parallel-size 1 --num-layers 12 --hidden-size 768 --num-attention-heads 8 --seq-length 2048 --max-position-embeddings 2048 --micro-batch-size 8 --train-iters 5000000 --lr 6e-4 --data-path ../wiki_processed/my-126m_text_document --vocab-file gpt2-vocab.json --merge-file gpt2-merges.txt --split 950,40,10 --distributed-backend nccl --fp16 --recompute-activations --log-interval 10 --save-interval 2000 --save checkpoints

SIMAI模拟器运行过程如下:

1) 修改megatron_workload_with_aiob.sh,152行增加126m模型的配置,生成workload文件:
model_name=gpt_126M
num_layers=12
hidden_size=768
num_attention_heads=16
tensor_model_parallel_size=1
;;
2) 按照文档直接生成定制化workload
python -m workload_generator.AIOB_simAI_workload_generator --world_size=1 --global_batch=8 --micro_batch=1 --num_layers=12 --num_attention_heads=16 --hidden_size=768 --tensor_model_parallel_size=1 --seq_length=2048 --swiglu --ffn_hidden_size=3072 --aiob_enable
https://github.com/aliyun/aicb/tree/d9b4f5cd7d9d34a80cfbb0389831a16c7fe3ed7b

3)之后基于步骤1或步骤2生成的workload文件运行模拟器,结果跟预期相差一个数量级。
./bin/SimAI_analytical -w aicb/results/workload/None-None-world_size1-tp1-pp1-ep1-gbs8-mbs1-seq2048-MOE-False-GEMM-False-flash_attn-False.txt -g 1 -g_p_s 1 -r test126m_acib- -busbw example/busbw.yaml

Image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with megatron_workload_with_aiob.sh around line 152, then inspect the workload produced by AIOB_simAI_workload_generator and the SimAI_analytical invocation. Compare the reported 8 versus 16 attention heads and other model options with the Megatron command, reproduce the 6042 ms result, and identify why it differs from the measured 680–740 ms iteration time.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.