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

Align ddp and ddp-spawn strategies in setting up the environment #11073

Merged
merged 32 commits into from
Sep 29, 2022

Conversation

awaelchli
Copy link
Contributor

@awaelchli awaelchli commented Dec 15, 2021

What does this PR do?

Aligns the regular ddp strategy and the ddp spawn strategy in setting up the environment (through the method setup_environement which is called in the Trainer._run).

Before:

DDP: Setup environment in setup_environment method/hook.
DDPSpawn: At spawn time, in worker_setup function (slightly earlier than setup_environment method/hook

Now:

Both DDP and DDPSpawn set the same variables in setup_environment method.

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

PR review

Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

Did you have fun?

I made sure I had fun coding 🙃

cc @Borda @justusschock @awaelchli @rohitgr7 @kaushikb11 @akihironitta

@ananthsub
Copy link
Contributor

I believe this will be a prerequisite for further consolidation efforts like #11021 and #11020 by moving up the setup_environment of DDP and TPU spawn

@stale
Copy link

stale bot commented Jan 3, 2022

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you need further help see our docs: https://pytorch-lightning.readthedocs.io/en/latest/generated/CONTRIBUTING.html#pull-request or ask the assistance of a core contributor here or on Slack. Thank you for your contributions.

@stale stale bot added the won't fix This will not be worked on label Jan 3, 2022
@stale stale bot removed the won't fix This will not be worked on label Jan 4, 2022
@tchaton
Copy link
Contributor

tchaton commented Jan 4, 2022

Hey @awaelchli. What is the status on this PR ?

@awaelchli
Copy link
Contributor Author

The status is that I'm currently working on this and once #11163 is merged this will pretty much be ready.

@stale
Copy link

stale bot commented Jan 21, 2022

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you need further help see our docs: https://pytorch-lightning.readthedocs.io/en/latest/generated/CONTRIBUTING.html#pull-request or ask the assistance of a core contributor here or on Slack. Thank you for your contributions.

@stale stale bot added the won't fix This will not be worked on label Jan 21, 2022
@awaelchli awaelchli added this to the 1.6 milestone Jan 23, 2022
@stale
Copy link

stale bot commented Jan 30, 2022

This pull request is going to be closed. Please feel free to reopen it create a new from the actual master.

@stale stale bot closed this Jan 30, 2022
@awaelchli awaelchli reopened this Jan 30, 2022
@stale stale bot removed the won't fix This will not be worked on label Jan 30, 2022
@carmocca carmocca removed this from the 1.6 milestone Mar 28, 2022
@stale
Copy link

stale bot commented Apr 16, 2022

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you need further help see our docs: https://pytorch-lightning.readthedocs.io/en/latest/generated/CONTRIBUTING.html#pull-request or ask the assistance of a core contributor here or on Slack. Thank you for your contributions.

@stale stale bot added the won't fix This will not be worked on label Apr 16, 2022
@stale
Copy link

stale bot commented Apr 24, 2022

This pull request is going to be closed. Please feel free to reopen it create a new from the actual master.

@awaelchli awaelchli force-pushed the refactor/spawn/setup-environment branch from 3779488 to 048339d Compare September 19, 2022 14:24
@mergify mergify bot removed the has conflicts label Sep 19, 2022
Co-authored-by: Kushashwa Ravi Shrimali <[email protected]>
@Borda
Copy link
Member

Borda commented Sep 22, 2022

@awaelchli mind checking the conflicts... 🦦

@mergify mergify bot removed the has conflicts label Sep 29, 2022
@mergify mergify bot removed the has conflicts label Sep 29, 2022
@mergify mergify bot added the ready PRs ready to be merged label Sep 29, 2022
@carmocca carmocca merged commit 822a7f5 into master Sep 29, 2022
@carmocca carmocca deleted the refactor/spawn/setup-environment branch September 29, 2022 17:30
@carmocca
Copy link
Contributor

🎉

@awaelchli
Copy link
Contributor Author

🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pl Generic label for PyTorch Lightning package ready PRs ready to be merged refactor strategy: ddp DistributedDataParallel
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

7 participants