Skip to content

Conversation

@Lunderberg
Copy link
Contributor

Prior to this commit, use of the disco.Session API to broadcast or scatter an array required several steps from the caller.

  1. Allocate memory on worker0
  2. Transfer data from the controller to worker0
  3. Allocate memory on each worker
  4. Broadcast/scatter data from worker0 to all workers

While exposing these steps is necessary for performance, especially when used repeatedly, it can be tedious/error-prone to use for initialization that is only performed once.

This commit adds utility methods Session.broadcast and Session.scatter, which are implemented in terms of the existing lower-level methods Session.broadcast_from_worker0 and Session.scatter_from_worker0. These methods perform the transfer from the controller to worker0, and from worker0 to all other workers.

@Lunderberg
Copy link
Contributor Author

This PR is identical to the now-closed PR #17011, as a CI restart prevented the CI from running on the original PR.

Prior to this commit, use of the `disco.Session` API to broadcast or
scatter an array required several steps from the caller.

1. Allocate memory on worker0
2. Transfer data from the controller to worker0
3. Allocate memory on each worker
4. Broadcast/scatter data from worker0 to all workers

While exposing these steps is necessary for performance, especially
when used repeatedly, it can be tedious/error-prone to use for
initialization that is only performed once.

This commit adds utility methods `Session.broadcast` and
`Session.scatter`, which are implemented in terms of the existing
lower-level methods `Session.broadcast_from_worker0` and
`Session.scatter_from_worker0`.  These methods perform the transfer
from the controller to worker0, and from worker0 to all other
workers.
@Lunderberg Lunderberg force-pushed the disco_broadcast_scatter_utility_methods branch from e2cb9e7 to f7a9fc7 Compare May 29, 2024 14:16
@tqchen tqchen merged commit 7c2c0d9 into apache:main May 30, 2024
@Lunderberg Lunderberg deleted the disco_broadcast_scatter_utility_methods branch May 30, 2024 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants