Skip to content

Support multihost SPMD execution - #4573

Merged
jonb377 merged 1 commit into
masterfrom
jonbolin-multihost-spmd
Feb 11, 2023
Merged

jonb377 merged 1 commit into
masterfrom
jonbolin-multihost-spmd

Conversation

@jonb377

@jonb377 jonb377 commented Feb 6, 2023

Copy link
Copy Markdown
Collaborator

The only main change to support multihost execution is to restrict the generated shards in ShardTensor to those which belong to addressable devices.

@jonb377
jonb377 requested a review from yeounoh February 6, 2023 18:16
@jonb377
jonb377 force-pushed the jonbolin-multihost-spmd branch 2 times, most recently from b86aaec to 9e5fb70 Compare February 7, 2023 19:36
—------------------------------
mesh_shape = (4, 2)
num_devices = len(xm.get_xla_supported_devices())
num_devices = pjrt.global_device_count()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great :)

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();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

@yeounoh yeounoh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, a minor comment.

@jonb377
jonb377 force-pushed the jonbolin-multihost-spmd branch from 9e5fb70 to fe74d84 Compare February 8, 2023 17:34
@jonb377 jonb377 added the distributed SPMD and other distributed things. label Feb 9, 2023
@jonb377
jonb377 force-pushed the jonbolin-multihost-spmd branch 3 times, most recently from ba5ed74 to e999a95 Compare February 10, 2023 19:12
// 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 =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does GetLocalDevices() return local devices with global ordinals? If so, let's leave a comment.

@yeounoh yeounoh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, have 2 comments --nit.

@jonb377
jonb377 force-pushed the jonbolin-multihost-spmd branch from e999a95 to d1fc7b1 Compare February 10, 2023 23:36
@jonb377
jonb377 force-pushed the jonbolin-multihost-spmd branch from d1fc7b1 to bc538a8 Compare February 11, 2023 00:17
@jonb377
jonb377 merged commit ced6456 into master Feb 11, 2023
@jonb377
jonb377 deleted the jonbolin-multihost-spmd branch February 11, 2023 22:19
mateuszlewko pushed a commit that referenced this pull request Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

distributed SPMD and other distributed things.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants