Support multihost SPMD execution - #4573
Merged
Merged
Conversation
jonb377
force-pushed
the
jonbolin-multihost-spmd
branch
2 times, most recently
from
February 7, 2023 19:36
b86aaec to
9e5fb70
Compare
yeounoh
reviewed
Feb 8, 2023
| —------------------------------ | ||
| mesh_shape = (4, 2) | ||
| num_devices = len(xm.get_xla_supported_devices()) | ||
| num_devices = pjrt.global_device_count() |
yeounoh
reviewed
Feb 8, 2023
| const std::vector<std::string>& devices) { | ||
| std::unordered_map<int, int> device_index; | ||
| for (int i = 0; i < devices.size(); ++i) { | ||
| int global_ordinal = ParseDeviceString(devices[i]).ordinal(); |
Contributor
There was a problem hiding this comment.
The first global device gets the local index 0, so the order of the input devices list is important. Is this a correct understanding? Can we add some comments on this?
Collaborator
Author
There was a problem hiding this comment.
The first device in the list gets local index 0, but the order of the global ordinals within devices doesn't matter. I'll add some more documentation around this.
jonb377
force-pushed
the
jonbolin-multihost-spmd
branch
from
February 8, 2023 17:34
9e5fb70 to
fe74d84
Compare
jonb377
force-pushed
the
jonbolin-multihost-spmd
branch
3 times, most recently
from
February 10, 2023 19:12
ba5ed74 to
e999a95
Compare
yeounoh
reviewed
Feb 10, 2023
| // TODO(yeounoh) PJRT runs a process per host for SPMD and without cross | ||
| // host communications. This means that we may need to manually shard | ||
| // across global devices for multi-host training. | ||
| std::vector<std::string> local_devices = |
Contributor
There was a problem hiding this comment.
Does GetLocalDevices() return local devices with global ordinals? If so, let's leave a comment.
yeounoh
approved these changes
Feb 10, 2023
yeounoh
left a comment
Contributor
There was a problem hiding this comment.
LGTM, have 2 comments --nit.
jonb377
force-pushed
the
jonbolin-multihost-spmd
branch
from
February 10, 2023 23:36
e999a95 to
d1fc7b1
Compare
jonb377
force-pushed
the
jonbolin-multihost-spmd
branch
from
February 11, 2023 00:17
d1fc7b1 to
bc538a8
Compare
chandrasekhard2
pushed a commit
that referenced
this pull request
Feb 22, 2023
chandrasekhard2
pushed a commit
that referenced
this pull request
Feb 22, 2023
mateuszlewko
pushed a commit
that referenced
this pull request
Mar 15, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The only main change to support multihost execution is to restrict the generated shards in ShardTensor to those which belong to addressable devices.