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

1/n Call training_type_plugin collective functions directly instead of going through the Accelerator #9677

Merged
merged 14 commits into from Sep 27, 2021

Conversation

four4fish
Copy link
Contributor

@four4fish four4fish commented Sep 24, 2021

What does this PR do?

1/n for Directly call TrainingTypePlugin APIs instead of going through the Accelerator

Take incremental step for collective consolidation
Call training type plugin collective function directly instead of go through accelerator

2/n Consolidate collective functions - collective base and subclasses (#9414) will take time to polish the API, so have this implementation to unblock precision plugin refactor

Part of #7534
Part of #9426

Does your PR introduce any breaking changes? If yes, please list them.

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 list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

PR review

Anyone in the community is welcome to review the PR.
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?

Make sure you had fun coding 🙃

Copy link
Contributor

@ananthsub ananthsub left a comment

Choose a reason for hiding this comment

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

training type plugin is already a top-level property on the trainer: https://github.com/PyTorchLightning/pytorch-lightning/blob/41e3be197f5a2fd0f65b37b743ebfd157a55595d/pytorch_lightning/trainer/trainer.py#L1445-L1447

as this is part of #9426 , we should directly update callsites to call collectives via the training type plugin.

do you want to mark the collectives defined on the accelerator as deprecated in another PR? same question for LightningDistributed

pytorch_lightning/callbacks/timer.py Outdated Show resolved Hide resolved
pytorch_lightning/core/lightning.py Outdated Show resolved Hide resolved
pytorch_lightning/plugins/training_type/ddp.py Outdated Show resolved Hide resolved
pytorch_lightning/plugins/training_type/ddp.py Outdated Show resolved Hide resolved
pytorch_lightning/plugins/training_type/ddp.py Outdated Show resolved Hide resolved
tests/plugins/test_ddp_plugin.py Outdated Show resolved Hide resolved
tests/plugins/test_deepspeed_plugin.py Outdated Show resolved Hide resolved
tests/plugins/test_deepspeed_plugin.py Outdated Show resolved Hide resolved
tests/utilities/test_deepspeed_collate_checkpoint.py Outdated Show resolved Hide resolved
tests/utilities/test_deepspeed_collate_checkpoint.py Outdated Show resolved Hide resolved
@ananthsub ananthsub added this to the v1.5 milestone Sep 24, 2021
@four4fish four4fish marked this pull request as ready for review September 24, 2021 19:17
@four4fish four4fish changed the title Refactor collective functions, call training_type_plugin directly Call training_type_plugin collective functions directly instead of going through the Accelerator Sep 24, 2021
@four4fish four4fish added this to In progress in Sprint Q3-6: 6 Sep - 17 Sep via automation Sep 24, 2021
@codecov
Copy link

codecov bot commented Sep 24, 2021

Codecov Report

Merging #9677 (abf0833) into master (a3def9d) will decrease coverage by 4%.
The diff coverage is 92%.

❗ Current head abf0833 differs from pull request most recent head 616617b. Consider uploading reports for the commit 616617b to get more accurate results

@@           Coverage Diff           @@
##           master   #9677    +/-   ##
=======================================
- Coverage      93%     89%    -4%     
=======================================
  Files         179     179            
  Lines       15314   15311     -3     
=======================================
- Hits        14208   13591   -617     
- Misses       1106    1720   +614     

four4fish and others added 2 commits September 24, 2021 14:05
Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
pytorch_lightning/accelerators/accelerator.py Outdated Show resolved Hide resolved
pytorch_lightning/accelerators/accelerator.py Outdated Show resolved Hide resolved
pytorch_lightning/accelerators/accelerator.py Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@ananthsub ananthsub added the deprecation Includes a deprecation label Sep 24, 2021
Co-authored-by: ananthsub <ananth.subramaniam@gmail.com>
@mergify mergify bot added the ready PRs ready to be merged label Sep 24, 2021
@four4fish four4fish removed this from In progress in Sprint Q3-6: 6 Sep - 17 Sep Sep 24, 2021
@four4fish four4fish added this to In progress in Sprint Q3-7: 20 Sep - 1 Oct via automation Sep 24, 2021
tests/deprecated_api/test_remove_1-6.py Outdated Show resolved Hide resolved
pytorch_lightning/accelerators/accelerator.py Outdated Show resolved Hide resolved
pytorch_lightning/accelerators/accelerator.py Outdated Show resolved Hide resolved
pytorch_lightning/accelerators/accelerator.py Outdated Show resolved Hide resolved
pytorch_lightning/accelerators/accelerator.py Outdated Show resolved Hide resolved
@mergify mergify bot removed the has conflicts label Sep 27, 2021
@awaelchli awaelchli self-assigned this Sep 27, 2021
pytorch_lightning/accelerators/accelerator.py Outdated Show resolved Hide resolved
pytorch_lightning/accelerators/accelerator.py Outdated Show resolved Hide resolved
pytorch_lightning/accelerators/accelerator.py Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

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

LGTM !

@carmocca carmocca merged commit 15cd6ad into Lightning-AI:master Sep 27, 2021
Sprint Q3-7: 20 Sep - 1 Oct automation moved this from In progress to Done Sep 27, 2021
@akihironitta akihironitta changed the title Call training_type_plugin collective functions directly instead of going through the Accelerator 1/n Call training_type_plugin collective functions directly instead of going through the Accelerator Nov 12, 2021
@Borda Borda changed the title 1/n Call training_type_plugin collective functions directly instead of going through the Accelerator 1/n Call training_type_plugin collective functions directly instead of going through the Accelerator Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation Includes a deprecation ready PRs ready to be merged refactor
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

6 participants