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 precommfillderived #889

Merged
merged 5 commits into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Current develop

### Added (new features/APIs/variables/...)
- [[PR 889]](https://github.com/parthenon-hpc-lab/parthenon/pull/889) Add PreCommFillDerived
- [[PR 872]](https://github.com/parthenon-hpc-lab/parthenon/pull/872) Boundary communication for non-cell centered fields
- [[PR 877]](https://github.com/parthenon-hpc-lab/parthenon/pull/877) Add flat sparse packs
- [[PR 868]](https://github.com/parthenon-hpc-lab/parthenon/pull/868) Add block-local face, edge, and nodal fields and allow for packing
Expand Down
8 changes: 8 additions & 0 deletions src/interface/state_descriptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,12 @@ class StateDescriptor {

bool FlagsPresent(std::vector<MetadataFlag> const &flags, bool matchAny = false);

void PreCommFillDerived(MeshBlockData<Real> *rc) const {
if (PreCommFillDerivedBlock != nullptr) PreCommFillDerivedBlock(rc);
}
void PreCommFillDerived(MeshData<Real> *rc) const {
if (PreCommFillDerivedMesh != nullptr) PreCommFillDerivedMesh(rc);
}
void PreFillDerived(MeshBlockData<Real> *rc) const {
if (PreFillDerivedBlock != nullptr) PreFillDerivedBlock(rc);
}
Expand Down Expand Up @@ -375,6 +381,8 @@ class StateDescriptor {

std::vector<std::shared_ptr<AMRCriteria>> amr_criteria;

std::function<void(MeshBlockData<Real> *rc)> PreCommFillDerivedBlock = nullptr;
std::function<void(MeshData<Real> *rc)> PreCommFillDerivedMesh = nullptr;
std::function<void(MeshBlockData<Real> *rc)> PreFillDerivedBlock = nullptr;
std::function<void(MeshData<Real> *rc)> PreFillDerivedMesh = nullptr;
std::function<void(MeshBlockData<Real> *rc)> PostFillDerivedBlock = nullptr;
Expand Down
11 changes: 11 additions & 0 deletions src/interface/update.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,17 @@ TaskStatus EstimateTimestep(T *rc) {
return TaskStatus::complete;
}

template <typename T>
TaskStatus PreCommFillDerived(T *rc) {
Kokkos::Profiling::pushRegion("Task_PreCommFillDerived");
auto pm = rc->GetParentPointer();
for (const auto &pkg : pm->packages.AllPackages()) {
pkg.second->PreCommFillDerived(rc);
}
Kokkos::Profiling::popRegion();
return TaskStatus::complete;
}

template <typename T>
TaskStatus FillDerived(T *rc) {
Kokkos::Profiling::pushRegion("Task_FillDerived");
Expand Down
10 changes: 10 additions & 0 deletions src/mesh/mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,16 @@ void Mesh::Initialize(bool init_problem, ParameterInput *pin, ApplicationInput *
[](auto &sp_block) { sp_block->SetAllVariablesToInitialized(); });
}

// Pre comm fill derrived
Yurlungur marked this conversation as resolved.
Show resolved Hide resolved
for (int i = 0; i < nmb; ++i) {
auto &mbd = block_list[i]->meshblock_data.Get();
Update::PreCommFillDerived(mbd.get());
}
for (int i = 0; num_partitions; ++i) {
auto &md = mesh_data.GetOrAdd("base", i);
Update::PreCommFillDerived(md.get());
}

// Build densely populated communication tags
tag_map.clear();
for (int i = 0; i < num_partitions; i++) {
Expand Down