Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 44 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# SimuMax: a static analytical model for LLM distributed training

* [Latest News](#latest-news)
* [Introduction](#introduction)
* [Getting Started](#Installation)
* [Unitest](#Unitest)
* [TODO](#todo)
* [Acknowledgements](#acknowledgements)
* [Community](#Community)
## Latest News
- 📣 NEW! [App](./develop/app/README.md) - Add a user application to the SimuMax.
- 📣 NEW! [Strategy Search](./examples/search/llm_search.py) - Support strategy search.
- 📣 NEW! [System Config Pipeline](./simu_tools/efficency_test/README.md) - Add a Pipeline to generate system file include computing and communication efficiency.


## Introduction
SimuMax is a distributed training simulator designed for large-scale language model (LLM) workloads. It leverages a static analytical model to simulate and analyze both performance and memory usage, providing detailed insights into training efficiency without running the actual training process. Based on these analyses, SimuMax helps users explore potential ways to maximize computational efficiency.
Expand Down Expand Up @@ -35,15 +40,17 @@ It's appropriate to address various use-cases:
- [x] Megatron Compatibility: Simplified model migration pipeline
- [x] Finer-grained selective recompute
- [x] Efficiency measurement across shapes/layouts
- [x] Efficiency measurement pipeline for both computing and commucation
- [x] Strategy Search


### Benchmarks
Performance of some models on a single node. Llama3-70B was trimmed to 12 layers and DeepSeek-236B was trimmed to 4 layers.
Details can be found in [FULL_RESULTS](docs/FULL_RESULTS.md)



#### A100-Pcie
Please refer to [./simu_tools/megatron_scripts/README.md](./simu_tools/megatron_scripts/README.md) for the benchmark script.
![alt text](assets/A100-Pcie.png)


Expand All @@ -66,29 +73,53 @@ pip install -v -e .


## Example
We recommend using our app program to get started with SimuMax with zero cost. Please refer to the [README](./app/README.md) for more details.

Please refer to the [tutorial](./docs/tutorial.md) for more details.

```bash
cd ./examples
python perf_llama3_8b_tp1_pp2.py
# The results are stored in the llama3_8b_a100_pcie_bf16 directory
```
The output is as follows:
The output is as follows, the output details are saved in the ./llama3_8b_a100_pcie_bf16 directory:
```
-------------SIMUMAX SUMMARY TP=1,EP=1,PP=2 -------------
- parallelism = seq4096.mbs1.mbc8.gbs32 tp1.ep1.pp2.dp4.etp1.edp4, world_size:8
-------------SIMUMAX SUMMARY llama3_8b(8.03B) TP=1,EP=1,PP=2 -------------
- parallelism = layer32.dense0.seq4096.mbs1.mbc8.gbs32 tp1.ep1.pp2.dp4.etp1.edp4, world_size:8
- recompute = No Recompute
- dtype = bf16, grad_reduce = fp32
- system = a100_pcie_bf16
- model = dense
- mfu = 0.49
- TFLOPS = 151.59 (tflops=843.3426 T, duration=5.5632 s)
- TGS_per_gpu = 2945.052828675417
- peak_alloc_mem = {'first_stage': '50.7760 GB', 'last_stage': '45.1637 GB'}
- model_type = dense
· mfu = 0.48
· TFLOPS = 151.01T (tflops=843.3426 T, duration=5.5848 s)
· TFLOPS_PER_TOKEN = 0.01T, duration=5.5848 s
· peak_alloc_mem = {'first_stage': '50.8854 GB', 'last_stage': '45.1637 GB'}
- peak_alloc_mem_with_reserved = {'first_stage': '54.1334 GB', 'last_stage': '48.0465 GB'}
- TGS_per_gpu = 2933.6554333899194
- net = pp_net=intra_node_pcie_8x, tp_net=intra_node_pcie_2x, dp_net=intra_node_pcie_4x, ep_net=intra_node_pcie_2x, etp_net=intra_node_pcie_2x
------------------------------------------
```

# Unitest
after clone the repo, plz use "git config core.hooksPath git_hooks" to set commit hook, which will check the perf result in some config is still the same before commit automatically.
## Strategy search example
We provide a set of strategy search scripts that run on the [llm_search.py](./examples/search/llm_search.py) model, which can be used to search for the optimal strategy for your model.
```
cd examples/llm_search
python llm_search.py
```

The example strategy search output results are saved in the directory ./search_deepseek_v3_a100_pcie_bf16 and search_deepseek_v2_a100_pcie_bf16.


## Generate system file

If you want to use SimuMax on new equipment, please refer to [./simu_tools/efficency_test/README.md](./simu_tools/efficency_test/README.md) to generate system files.

## Benchmark
We provide a set of benchmark testing scripts that run on NVIDIA GPUs, which can be used for SimuMax simulation calibration. These scripts enable actual measurements for llama and deepseek models. The benchmark results will be stored in a designated directory. For detailed benchmark procedures and interpretation of results, please refer to [./simu_tools/megatron_scripts/README.md](./simu_tools/megatron_scripts/README.md).

## Notes
- Currently, all Linear models are forced to perform gradient accumulation fusion.


# TODO
SimuMax is in active development, may contain bugs or incomplete features. Contributions are welcome!
Expand All @@ -97,7 +128,6 @@ There are features to be added. Several significants are:
- More pipeline scheduler
- Overlap between computation and communication
- Offloading
- Strategy search
- More accurate memory-bound operator simulation


Expand All @@ -120,9 +150,4 @@ If you're passionate about:
Large-scale models for MoE, Reinforcement Learning, Multi-Modal
GPU/GPU-Cluster Training/Inference performance optimization

Feel free to reach out to xuerong.huang@mthreads.com.

## Star History
## Star History

[![Star History Chart](https://api.star-history.com/svg?repos=MooreThreads/SimuMax&type=date&legend=top-left)](https://www.star-history.com/#MooreThreads/SimuMax&type=date&legend=top-left)
Feel free to reach out to 1354789084@qq.com.
7 changes: 7 additions & 0 deletions app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Get started
you can run the app with the following command:
```shell
cd app
bash install.sh
streamlit run streamlit_app.py
```
7 changes: 7 additions & 0 deletions app/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# pip install PyQt5 -i https://pypi.tuna.tsinghua.edu.cn/simple
# sudo apt-get update
# sudo apt-get install libxcb-xinerama0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-sync1 libxcb-xfixes0 libxcb-xkb1 libxkbcommon-x11-0


# pip install flask -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install streamlit -i https://pypi.tuna.tsinghua.edu.cn/simple
Loading