Skip to content

Support torchrun-style InfiniTrain multi-process launch - #184

Open
chen2021673 wants to merge 8 commits into
masterfrom
8_proc
Open

Support torchrun-style InfiniTrain multi-process launch#184
chen2021673 wants to merge 8 commits into
masterfrom
8_proc

Conversation

@chen2021673

@chen2021673 chen2021673 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

概述

本 PR 为 InfiniTrain 增加 torchrun 风格的多进程启动能力,使每个本地进程可以绑定独立 GPU,同时保留现有的单进程多线程运行方式。

主要修改

  • infini_run 支持通过 nproc_per_node 启动多个子进程,并传递 torchrun 兼容的 rank 环境变量。
  • 同时支持使用或不使用 -- 分隔启动器参数与训练命令。
  • 完善进程拓扑、rank 范围和启动参数校验,并正确传递子进程退出状态。
  • 根据本地进程 rank 和线程 rank 计算设备编号。
  • 为通信 unique ID 文件增加运行级隔离、原子发布和清理机制。
  • 保持现有单进程多线程测例及其启动方式不变。
  • 新增独立的 8_proc 测例组,以 8 进程、每进程 1 线程运行 GPT-2 和 Llama3 的 DP、TP、TP+SP、PP 及 TP2+PP2+VPP2 配置。

兼容性

原有直接启动方式保持支持:

./llama3 ... --nthread_per_process 8

多进程启动支持以下两种写法:

./infini_run --nproc_per_node=8 ./llama3 ... --nthread_per_process 1
./infini_run --nproc_per_node=8 -- ./llama3 ... --nthread_per_process 1

测试

image image

@chen2021673
chen2021673 force-pushed the 8_proc branch 2 times, most recently from 5314e45 to 63aefdc Compare July 16, 2026 07:53
Comment thread example/gpt2/main.cc
Comment thread infini_train/include/core/ccl/ccl.h Outdated
Comment thread tools/infini_run/infini_run.cc Outdated
Comment thread tools/infini_run/infini_run.cc
Comment thread tools/infini_run/infini_run.cc Outdated
@chen2021673
chen2021673 force-pushed the 8_proc branch 2 times, most recently from 350a2fd to c88f116 Compare July 30, 2026 06:54
Comment thread README.md
Comment thread infini_train/src/nn/parallel/global.cc Outdated
Comment thread infini_train/src/nn/parallel/data_parallel.cc Outdated
Comment thread infini_train/include/nn/parallel/global.h Outdated
Comment thread infini_train/src/device.cc Outdated
Comment thread infini_train/src/dataloader.cc
Comment thread infini_train/src/core/ccl/ccl_utils.cc Outdated
Comment thread scripts/run_models_and_profile.bash
Comment thread tools/infini_run/infini_run.cc Outdated
Comment thread tools/infini_run/infini_run.cc
@chen2021673
chen2021673 force-pushed the 8_proc branch 2 times, most recently from 50c8039 to 307253e Compare August 11, 2026 02:26
@chen2021673
chen2021673 changed the base branch from master to fix/dataloader-global-batches August 11, 2026 02:27
@chen2021673

Copy link
Copy Markdown
Contributor Author

重新测试:
image

image

Add a dedicated 8_proc test group containing the 8-process variants of
the original basic multi-GPU cases.
Track DataLoader progress by global batches so distributed ranks slice data
consistently and can resume/cycle from saved consumption counts.

Also scope CCL unique ID files per run, generate NCCL IDs only on the main
rank, clean up run-local rendezvous files, and add DataLoader coverage.
- derive parallel state from the global world size
- clarify global rank and per-node process semantics
- add multi-node rank regression coverage
- restore the NCCL-compatible GetUniqueId interface
- add torchrun-style --rdzv_id support
- use the shared ID to isolate CCL unique-ID files
- preserve automatic run ID generation for single-node runs
- document rdzv_id in the multi-node example
- support infini_run with or without the optional -- separator
- validate node rank bounds
- use infini_run only for the new 8_proc test group
- standardize torchrun environment variables and device index mapping
- clarify NCCL unique ID filename helpers
- add an _8_proc suffix to multi-process test case IDs
- print manual comparison commands when no baseline log directory is set
@chen2021673
chen2021673 changed the base branch from fix/dataloader-global-batches to master August 11, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants