-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Disco][QoL] Implement broadcast/scatter methods for Session (#17035)
* [Disco][QoL] Implement broadcast/scatter methods for Session 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. * lint fix
- Loading branch information
1 parent
f6aab98
commit 7c2c0d9
Showing
2 changed files
with
158 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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