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

Make HorovodPlugin.all_gather return a tensor #9696

Merged
merged 3 commits into from
Sep 27, 2021

Conversation

ananthsub
Copy link
Contributor

@ananthsub ananthsub commented Sep 25, 2021

What does this PR do?

Fixes #9695

The Horovod Plugin is the only plugin whose all_gather returns a List[torch.Tensor] instead of a regular tensor. this is despite the support or allgather here: https://horovod.readthedocs.io/en/stable/_modules/horovod/torch/mpi_ops.html#allgather

This PR updates the implementation of all gather here such that:

  • It's consistent with the typehint provided (returning a Tensor, not a list)
  • It's consistent with the training type plugin API

I'm unclear why it was implemented like this before

This is part of #7534
and came up during review of #9414 and #9677

Note: TrainingTypePlugin.all_gather is not called anywhere in the trainer. this is purely to power the LightningModule's all_gather's implementation. So this would be a breaking change iff someone was training with horovod and they depended on LightningModule.all_gather

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

Yes, this makes an in-place change to HorovodPlugin.all_gather to return a new return type

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 🙃

@ananthsub ananthsub added the breaking change Includes a breaking change label Sep 25, 2021
@ananthsub ananthsub changed the title Make HorovodPlugin.all_gather consistent with other plugins Make HorovodPlugin.all_gather return a tensor Sep 25, 2021
@ananthsub ananthsub added the bug Something isn't working label Sep 25, 2021
Copy link
Contributor

@carmocca carmocca left a comment

Choose a reason for hiding this comment

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

cc @tgaddair as the original author in #3775

@mergify mergify bot added ready PRs ready to be merged and removed has conflicts labels Sep 25, 2021
@ananthsub ananthsub force-pushed the fix/horovod-allgather-plugin branch from 4c04a30 to 0aa986e Compare September 25, 2021 15:28
@codecov
Copy link

codecov bot commented Sep 25, 2021

Codecov Report

Merging #9696 (4c04a30) into master (a3def9d) will decrease coverage by 4%.
The diff coverage is 0%.

❗ Current head 4c04a30 differs from pull request most recent head 0aa986e. Consider uploading reports for the commit 0aa986e to get more accurate results

@@           Coverage Diff           @@
##           master   #9696    +/-   ##
=======================================
- Coverage      93%     89%    -4%     
=======================================
  Files         179     179            
  Lines       15314   15312     -2     
=======================================
- Hits        14208   13592   -616     
- Misses       1106    1720   +614     

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 !

@tchaton tchaton merged commit faee9df into Lightning-AI:master Sep 27, 2021
@awaelchli awaelchli added this to the v1.5 milestone Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Includes a breaking change bug Something isn't working ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Horovod all_gather function refactor
4 participants