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

Choose a more efficient algorithm. #16357

Merged
merged 1 commit into from Dec 16, 2023
Merged

Conversation

bangerth
Copy link
Member

Follow-up to #16352. We can avoid an MPI_Reduce in favor of an MPI_Broadcast.

Comment on lines 172 to 173
// a factor of 2 if we broadcast it from the last process, which
// can compute it from its own prefix sum plus its own value.
Copy link
Member

Choose a reason for hiding this comment

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

It is usually not as bad as a factor of 2 at least for small sizes, because Allreduce typically only costs one single communication step more than the log(n) communications of Reduce or Bcast when seen from the most expensive rank. The algorithm is called recursive doubling and it makes all processes participate during the reduction, i.e., it does not try to minimize the number of communications over the whole machine, but the length of the dependency chain.

The change is still correct, but I would simply write that "it is cheaper if we broadcast from the last process".

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair enough. I've just removed the "by about a factor of 2" :-)

@masterleinad masterleinad merged commit 83805c5 into dealii:master Dec 16, 2023
15 checks passed
@bangerth bangerth deleted the mpi-2 branch December 16, 2023 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants