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

Implement automatically serializing scatter #758

Merged
merged 2 commits into from
Jul 30, 2023

Conversation

lukas-weber
Copy link
Collaborator

@lukas-weber lukas-weber commented Jul 29, 2023

Thanks for merging the gather pull request! I went ahead and implemented scatter as well!

The current version does a tiny amount of unnecessary work by serializing objs[root + 1], which is never sent. I figured saving this might not be worth the additional complexity. Happy to implement it that way though.

counts = length.(datasegments)

count = Scatter(counts, Int64, comm; root = root)
sendbuf = VBuffer(vcat(datasegments...), counts)
Copy link
Member

Choose a reason for hiding this comment

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

Splatting vectors is generally a bad idea.

The optimal approach would be to incrementally serialize to a single buffer, but at the minimum we should call reduce:

Suggested change
sendbuf = VBuffer(vcat(datasegments...), counts)
sendbuf = VBuffer(reduce(vcat, datasegments), counts)

@lukas-weber
Copy link
Collaborator Author

Whoopsie, I was always wondering about the preferred way to do that. But here is a version that uses a single buffer. Don’t know if there is a better way to calculate the counts.

@simonbyrne simonbyrne merged commit bfaa7ca into JuliaParallel:master Jul 30, 2023
42 of 47 checks passed
@simonbyrne
Copy link
Member

thank you!

@simonbyrne
Copy link
Member

I've sent an invite to give you commit access.

@lukas-weber
Copy link
Collaborator Author

Thanks!

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.

None yet

2 participants