Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hpc setup #1004

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Hpc setup #1004

wants to merge 2 commits into from

Conversation

githubsgi
Copy link
Contributor

HPC type setup ( e.g. mpirun , mpiexec) currently requires code change in train.py ( or elsewhere) . Adding couple of optional additional args ( e.g. rank and local rank) to toml file along with a simple function in train.py removes the need to make those changes.

Optional adds to the toml files for running in environments that uses non-torchrun launchers.
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 22, 2025
@JungHoyoun
Copy link
Contributor

Aren’t those environment variables set automatically when using torchrun command?

@githubsgi
Copy link
Contributor Author

As I mentioned above, this is for non-torchrun launchers like mpirun/mpiexec etc. Torchrun is very specific to torch, HPC environments run many other applications which can not use torchrun. HPC environments are optimized for whatever launcher they were designed for. In those environments, torchrun usually does not work or has sub-optimal performance.

Copy link
Contributor

@tianyu-l tianyu-l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I'm not familiar with the HPC setup you mentioned. I wonder over there could you set the environment variables outside train.py like what we do in run_train.sh?

Even if you have to do it within the python job, with the flexible job config support (we recently added), you can customize it without changing torchtitan, e.g. by using torchtitan Trainer as a submodule.
https://github.com/pytorch/torchtitan/blob/main/docs/extension.md#extending-jobconfig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants