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

Add sparse communication buffers #663

Merged
merged 239 commits into from
Aug 5, 2022
Merged

Conversation

lroberts36
Copy link
Collaborator

@lroberts36 lroberts36 commented Apr 19, 2022

PR Summary

This PR includes a new set of in-one boundary communication routines that are built to work with sparse variables and avoid the CellCenteredBoundaryVariable machinery. The boundary buffers, which inherit from BufArray1D, are reference counted and associated with a shared memory pool from which they are pulled and to which they are released when they are destroyed to minimize the number of allocations on device (see utils/memory_pool.hpp). Buffers are only allocated on sending blocks where sparse variables are allocated. The CommBuffer class wraps the memory pool buffers and provides a mechanism for signaling whether or not non-zero data is being sent from the sending block (both for same and differing rank communications).

PR Checklist

  • Passes sparse_advection regression test
  • MPI implementation tested within Parthenon
  • Employs new MPI communicators in (see Fix MPI tag creation #661)
  • Code passes cpplint
  • New features are documented.
  • Code is formatted
  • Changes are summarized in CHANGELOG.md
  • CI has been triggered on Darwin for performance regression tests.
  • (@lanl.gov employees) Update copyright on changed files

Copy link
Collaborator

@Yurlungur Yurlungur left a comment

Choose a reason for hiding this comment

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

Nice! Overall I like this design. A plethora of comments below. Take them with a grain of salt, I didn't read too carefully.

One thing for consideration: Do we want to just have the sparse bvals be the bvals implementation? Rather than having duplicate code for sparse/non-sparse?

src/bvals/cc/calc_indices.cpp Outdated Show resolved Hide resolved
src/bvals/cc/calc_indices.cpp Show resolved Hide resolved
src/utils/memory_pool.hpp Outdated Show resolved Hide resolved
src/utils/memory_pool.hpp Outdated Show resolved Hide resolved
src/utils/memory_pool.hpp Outdated Show resolved Hide resolved
src/utils/communication_buffer.hpp Outdated Show resolved Hide resolved
src/mesh/mesh.hpp Outdated Show resolved Hide resolved
src/interface/mesh_data.hpp Outdated Show resolved Hide resolved
src/bvals/cc/sparse_bvals_cc_in_one.cpp Outdated Show resolved Hide resolved
src/bvals/cc/sparse_bvals_cc_in_one.cpp Outdated Show resolved Hide resolved
@lroberts36
Copy link
Collaborator Author

@Yurlungur: I think the idea would be to eventually have something like this be the bvals implementation (and it seems like it would be fairly straightforward to include face centered, etc. variables in the framework). That being said, my plan was to do this in parallel for now and remove CellCenteredBoundaryVariable related stuff in a later pull request.

@lroberts36 lroberts36 linked an issue Aug 3, 2022 that may be closed by this pull request
@lroberts36
Copy link
Collaborator Author

We are going to wait to merge this until #682 is merged in to develop, since there will be some conflicts between this PR and #682.

@pgrete pgrete mentioned this pull request Aug 4, 2022
@pgrete
Copy link
Collaborator

pgrete commented Aug 4, 2022

Thanks for the quick update. My code parsing brain fully approves the reflux -> flxcor change 😄

Copy link
Collaborator

@Yurlungur Yurlungur left a comment

Choose a reason for hiding this comment

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

LGTM. I think you merged in the changes to the prolongation stuff correctly. Pleasantly easy thanks to your changes to the code. 😁

A few comments below. I might pick your brain down the line about the best way to make changes to the comms stuff going forward.

With the non-sparse versions of bvals_cc_in_one and flux_correction_in_one now deleted, should we not just remove the word sparse from the names of the new files? Or does that pollute the diff too much? We could always clean things up later.

src/bvals/bvals.hpp Show resolved Hide resolved
src/bvals/cc/bvals_cc_in_one.hpp Show resolved Hide resolved
src/bvals/cc/bvals_cc_in_one.hpp Show resolved Hide resolved
src/bvals/cc/bvals_utils.hpp Show resolved Hide resolved
src/bvals/cc/bvals_utils.hpp Show resolved Hide resolved
src/bvals/cc/calc_indices.cpp Show resolved Hide resolved
src/bvals/cc/calc_indices.cpp Show resolved Hide resolved
src/bvals/cc/sparse_bvals_cc_in_one.cpp Show resolved Hide resolved
src/interface/meshblock_data.cpp Show resolved Hide resolved
src/utils/hash.hpp Show resolved Hide resolved
@lroberts36
Copy link
Collaborator Author

@Yurlungur: I agree the files should be renamed since they are not unique to sparse, but let's leave that for #704.

@lroberts36 lroberts36 merged commit 97c8826 into develop Aug 5, 2022
@Yurlungur Yurlungur deleted the lroberts36/new-sparse-bvals branch August 5, 2022 19:37
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.

AMR performance 4/N: Reorder buffer routine by "distance"
5 participants