pytorch-lightning icon indicating copy to clipboard operation
pytorch-lightning copied to clipboard

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

Open awaelchli opened this issue 4 years ago • 11 comments

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

  • [x] Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • [x] Did you read the contributor guideline, Pull Request section?
  • [x] Did you make sure your PR does only one thing, instead of bundling different changes together?
  • [x] Did you make sure to update the documentation with your changes? (if necessary)
  • [x] Did you write any new necessary tests? (not for typos and docs)
  • [x] Did you verify new and existing tests pass locally with your changes?
  • [x] 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:

  • [x] Is this pull request ready for review? (if not, please submit in draft mode)
  • [x] Check that all items from Before submitting are resolved
  • [x] Make sure the title is self-explanatory and the description concisely explains the PR
  • [x] 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 @justusschock @awaelchli @rohitgr7 @kaushikb11 @akihironitta

awaelchli avatar Dec 15 '21 06:12 awaelchli

I believe this will be a prerequisite for further consolidation efforts like https://github.com/PyTorchLightning/pytorch-lightning/pull/11021 and https://github.com/PyTorchLightning/pytorch-lightning/pull/11020 by moving up the setup_environment of DDP and TPU spawn

ananthsub avatar Dec 18 '21 01:12 ananthsub

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[bot] avatar Jan 03 '22 20:01 stale[bot]

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

tchaton avatar Jan 04 '22 10:01 tchaton

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

awaelchli avatar Jan 04 '22 11:01 awaelchli

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[bot] avatar Jan 21 '22 04:01 stale[bot]

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

stale[bot] avatar Jan 30 '22 15:01 stale[bot]

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[bot] avatar Apr 16 '22 06:04 stale[bot]

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

stale[bot] avatar Apr 24 '22 04:04 stale[bot]

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[bot] avatar Jul 22 '22 07:07 stale[bot]

@awaelchli is this important for Lite? Do you want to apply these changes to the Lite versions already in #14670 and #14675?

carmocca avatar Sep 14 '22 22:09 carmocca

@carmocca I would say quite important for #14707. Yes, I can integrate this into the two PRs. The PR was ready long before starting with Lite, I should have pushed harder to get this merged 😅

awaelchli avatar Sep 14 '22 23:09 awaelchli

@awaelchli mind checking the conflicts... :otter:

Borda avatar Sep 22 '22 10:09 Borda

:tada:

carmocca avatar Sep 29 '22 17:09 carmocca

🥳

awaelchli avatar Sep 29 '22 17:09 awaelchli