Support torchrun-style InfiniTrain multi-process launch#184
Open
chen2021673 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds torchrun-style multi-process launch support for InfiniTrain while preserving the existing single-process multi-thread workflow.
Background
InfiniTrain previously relied mainly on
--nthread_per_processfor multi-GPU runs, which creates multiple C++ threads inside one process. PyTorchtorchrun --nproc_per_node=Ninstead launches N processes and injects rank-related environment variables such asRANK,LOCAL_RANK,WORLD_SIZE, andLOCAL_WORLD_SIZE.Profiling scripts need the InfiniTrain path to match the PyTorch process model.
Changes
Update
infini_runto:--as the launcher/training-args separatornproc_per_nodechild processesUpdate parallel runtime to:
Update GPT-2/Llama3 examples and parallel helpers to use local-device mapping.
Update
scripts/run_models_and_profile.bashto:infini_runnproc_per_nodeas launcher-only confignthread_per_processas the per-process thread countUpdate
scripts/test_config.jsonto use multi-process configs:nproc_per_node=8, nthread_per_process=1nproc_per_node=4, nthread_per_process=1Add documentation describing behavior, compatibility, and example usage.
Compatibility
Existing direct runs remain supported:
The launcher can also preserve the old single-process multi-thread behavior:
The recommended single-node 8-GPU multi-process usage is:
Test