-
Notifications
You must be signed in to change notification settings - Fork 37
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
Buffer-pack-in-one #359
Buffer-pack-in-one #359
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our local resources are down for maintenance at the moment. But when we're back up, we'll try this with riot.
14423bf
to
dcb2f4f
Compare
dcb2f4f
to
9e5f3d0
Compare
@pgrete I'm in the middle of reviewing this. will publish soon. |
ScratchPad2D<Real> &ql, ScratchPad2D<Real> &qr) { | ||
template <typename T> | ||
KOKKOS_FORCEINLINE_FUNCTION void | ||
DonorCellX1(parthenon::team_mbr_t const &member, const int k, const int j, const int il, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear to me why this was made a template. If it's for an external code, that's fine, but I don't see any motivation in this PR myself. I think the only place this is called is in advection_package.cpp
, and it doesn't look like the types used there changed at all.
If it's for an external code, just put a comment in the PR explaining why this was changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was actually pulled in from #365 (this branch here has been active for so long I fixed a couple of things along the go to make things work downstream).
Would you prefer that I update #365 to just include those reconstruction changes, get that merged in, and then update this branch
or
add another line in the changelog saying this happenend here, merge this branch and close #365 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I now updated the changelog here to also reflect this change (as well as the "un-/pack" -> "pack and unpack" change you requested).
@AndrewGaspar If you're happy feel free to merge (or schedule for merge once the pipeline passes).
ScratchPad2D<Real> &dqm) { | ||
template <typename T> | ||
KOKKOS_INLINE_FUNCTION void | ||
PiecewiseLinearX1(parthenon::team_mbr_t const &member, const int k, const int j, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as on DonorCell
CHANGELOG.md
Outdated
- [[PR 400]](https://github.com/lanl/parthenon/pull/400) Extend `StateDescriptor` for customizable output via user-customizable function pointers `PreStepDiagnosticsMesh` and `PostStepDiagnosticsMesh` | ||
- [[PR 391]](https://github.com/lanl/parthenon/pull/391) Add `VariablePack<T>::GetSparseId` and `VariablePack<T>::GetSparseIndex` to return global sparse ids and pack-local sparse index, repsectively. | ||
- [[PR 381]](https://github.com/lanl/parthenon/pull/381) Overload `DataCollection::Add` to build `MeshData` and `MeshBlockData` objects with a subset of variables. | ||
- [[PR 378]](https://github.com/lanl/parthenon/pull/378) Add Kokkos profiling regions throughout the code to allow the collection characteristic application profiles | ||
- [[PR 359]](https://github.com/lanl/parthenon/pull/359) MeshBlockPack support for buffer un-/pack of CellCentered Variables |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"un-/pack" - took me a second to understand what this was trying to say... probably better as
- [[PR 359]](https://github.com/lanl/parthenon/pull/359) MeshBlockPack support for buffer un-/pack of CellCentered Variables | |
- [[PR 359]](https://github.com/lanl/parthenon/pull/359) MeshBlockPack support for buffer pack and unpack of CellCentered Variables |
With respect to getting this PR merged, would you @AndrewGaspar @Yurlungur like to keep the option to switch between MeshBlock and MeshBlockPack in the advection example or should I remove it? Also, @Yurlungur did you get the chance to test this downstream for more than one Variable in riot or shall we merge in good faith for now and fix if there's an issue later? I verified that it works in principle by just adding another independent variable, so MPI signaling seems to work, but I didn't test for correctness (but I fairly optimistic that it is) . |
Agreed, let's keep the switch for now and remove it once @jlippuner has the proxy app working.
Apologies, @pgrete I was sick last week, so didn't get a chance to do this yet. Let's go ahead and merge and I will push on the riot version and engage with you if things don't work. |
ek -= pmb->block_size.nx3 / 2 - pmb->cnghost; | ||
} | ||
} | ||
cell_centered_bvars::CalcIndicesLoadToFiner(si, ei, sj, ej, sk, ek, nb, pmb.get()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
auto CalcIndices = [](int ox, int &s, int &e, const IndexRange &bounds) { | ||
if (ox == 0) { | ||
s = bounds.s; | ||
e = bounds.e; | ||
} else if (ox > 0) { | ||
s = bounds.e + 1; | ||
e = bounds.e + NGHOST; | ||
} else { | ||
s = bounds.s - NGHOST; | ||
e = bounds.s - 1; | ||
} | ||
}; | ||
|
||
IndexDomain interior = IndexDomain::interior; | ||
CalcIndices(nb.ni.ox1, si, ei, cellbounds.GetBoundsI(interior)); | ||
CalcIndices(nb.ni.ox2, sj, ej, cellbounds.GetBoundsJ(interior)); | ||
CalcIndices(nb.ni.ox3, sk, ek, cellbounds.GetBoundsK(interior)); | ||
cell_centered_bvars::CalcIndicesSetSame(nb.ni.ox1, si, ei, | ||
cellbounds.GetBoundsI(interior)); | ||
cell_centered_bvars::CalcIndicesSetSame(nb.ni.ox2, sj, ej, | ||
cellbounds.GetBoundsJ(interior)); | ||
cell_centered_bvars::CalcIndicesSetSame(nb.ni.ox3, sk, ek, | ||
cellbounds.GetBoundsK(interior)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
for (auto &v : rc->GetCellVariableVector()) { | ||
if (v->IsSet(parthenon::Metadata::FillGhost)) { | ||
for (int n = 0; n < pmb->pbval->nneighbor; n++) { | ||
parthenon::NeighborBlock &nb = pmb->pbval->neighbor[n]; | ||
auto *pbd_var_ = v->vbvar->GetPBdVar(); | ||
|
||
auto &si = boundary_info_h(b).si; | ||
auto &ei = boundary_info_h(b).ei; | ||
auto &sj = boundary_info_h(b).sj; | ||
auto &ej = boundary_info_h(b).ej; | ||
auto &sk = boundary_info_h(b).sk; | ||
auto &ek = boundary_info_h(b).ek; | ||
auto &Nv = boundary_info_h(b).Nv; | ||
Nv = v->GetDim(4); | ||
|
||
if (nb.snb.level == mylevel) { | ||
const parthenon::IndexShape &cellbounds = pmb->cellbounds; | ||
CalcIndicesSetSame(nb.ni.ox1, si, ei, cellbounds.GetBoundsI(interior)); | ||
CalcIndicesSetSame(nb.ni.ox2, sj, ej, cellbounds.GetBoundsJ(interior)); | ||
CalcIndicesSetSame(nb.ni.ox3, sk, ek, cellbounds.GetBoundsK(interior)); | ||
boundary_info_h(b).var = v->data.Get<4>(); | ||
} else if (nb.snb.level < mylevel) { | ||
const IndexShape &c_cellbounds = pmb->c_cellbounds; | ||
const auto &cng = pmb->cnghost; | ||
CalcIndicesSetFromCoarser(nb.ni.ox1, si, ei, | ||
c_cellbounds.GetBoundsI(interior), pmb->loc.lx1, | ||
cng, true); | ||
CalcIndicesSetFromCoarser(nb.ni.ox2, sj, ej, | ||
c_cellbounds.GetBoundsJ(interior), pmb->loc.lx2, | ||
cng, pmb->block_size.nx2 > 1); | ||
CalcIndicesSetFromCoarser(nb.ni.ox3, sk, ek, | ||
c_cellbounds.GetBoundsK(interior), pmb->loc.lx3, | ||
cng, pmb->block_size.nx3 > 1); | ||
|
||
boundary_info_h(b).var = v->vbvar->coarse_buf.Get<4>(); | ||
} else { | ||
CalcIndicesSetFromFiner(si, ei, sj, ej, sk, ek, nb, pmb.get()); | ||
boundary_info_h(b).var = v->data.Get<4>(); | ||
} | ||
boundary_info_h(b).buf = pbd_var_->recv[nb.bufid]; | ||
// safe to set completed here as the kernel updating all buffers is | ||
// called immediately afterwards | ||
pbd_var_->flag[nb.bufid] = parthenon::BoundaryStatus::completed; | ||
b++; | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fairly confident this should work for multiple variables.
PR Summary
WIP to have a central place to keep track of performance numbers.
PR Checklist
Open questions
vbvar->var_cc
extensively or can than functionality go as it it effectively absorbed byVariablePack
s`?