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

BroadcastView map Not Implemented #861

Closed
dalbabur opened this issue Jan 29, 2024 · 3 comments · Fixed by #874
Closed

BroadcastView map Not Implemented #861

dalbabur opened this issue Jan 29, 2024 · 3 comments · Fixed by #874

Comments

@dalbabur
Copy link

The documentation made it seem like BroadcastView.map had been implemented. Is this feature coming?

@minrk
Copy link
Member

minrk commented Feb 2, 2024

I don't think anyone is working on it at the moment, but it should be possible.

@dalbabur
Copy link
Author

dalbabur commented Feb 3, 2024

What would it take to implement it? I could attempt to with some directions.

@minrk
Copy link
Member

minrk commented Feb 5, 2024

map needs to partition inputs, so that each engine gets its chunk of the input sequence(s), which is done here. In DirectView, this is implemented by partitioning the input in the client and then sending a different message to each endpoint.

In BroadcastView, the client sends just one message (that's kind of its whole deal), so the partitioning would need to be handled in the BroadcastScheduler, instead. Reconstruction could either happen in the scheduler, or only aggregated in the scheduler and reconstructed finally in the client.

Perhaps the simplest implementation would be to still compute the partition in the client, but then send all partitions to the scheduler. Then, as each scheduler relays its messages, it selects the subset of chunks it needs to send along each path, and returns the results in a similar shape for the client to reconstruct.

All that said, you can use BroadcastView to run maps today, as long as you do the partitioning separately, as either SPMD-style partitioning on engines (works best for BroadcastView), or via e.g. DirectView.scatter.

here's a notebook that implements map by combining BroadcastView and DirectView. We could actually ship a simplest-possible BroadcastView.map that is exactly the broadcast_map in that notebook (with some more unique temp variable names to avoid collisions). It's not as efficient as a 'true' Broadcast Map, but it does work, and can always be optimized later.

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 a pull request may close this issue.

2 participants