Skip to content

Commit

Permalink
Merge pull request #1131 from parthenon-hpc-lab/lroberts36/add-fine-f…
Browse files Browse the repository at this point in the history
…ield-deallocation

Add deallocation check for fine, sparse fields
  • Loading branch information
lroberts36 authored Jun 26, 2024
2 parents f7a1908 + 3a258d9 commit f891c02
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
- [[PR 1004]](https://github.com/parthenon-hpc-lab/parthenon/pull/1004) Allow parameter modification from an input file for restarts

### Fixed (not changing behavior/API/variables/...)
- [[PR 1131]](https://github.com/parthenon-hpc-lab/parthenon/pull/1131) Make deallocation of fine and sparse fields work
- [[PR 1127]](https://github.com/parthenon-hpc-lab/parthenon/pull/1127) Add WithFluxes to IsRefined check
- [[PR 1111]](https://github.com/parthenon-hpc-lab/parthenon/pull/1111) Fix undefined behavior due to bitshift of negative number in LogicalLocation
- [[PR 1092]](https://github.com/parthenon-hpc-lab/parthenon/pull/1092) Updates to DataCollection and MeshData to remove requirement of predefining MeshBlockData
Expand Down
9 changes: 0 additions & 9 deletions src/interface/metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,6 @@ bool Metadata::IsValid(bool throw_on_fail) const {
}
}

// Limitations on fine fields
if (CountSet({Fine, Sparse}) > 1) {
valid = false;
if (throw_on_fail) {
PARTHENON_THROW(
"Sparse deallocation routine is not written to handle fine fields.");
}
}

return valid;
}

Expand Down
8 changes: 3 additions & 5 deletions src/interface/update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,11 @@ TaskStatus SparseDealloc(MeshData<Real> *md) {
const auto &var = pack(b, v);
const Real threshold = var.deallocation_threshold;
bool all_zero = true;
const auto &var_raw = var.data();
Kokkos::parallel_reduce(
Kokkos::TeamThreadRange<>(team_member, NkNjNi),
Kokkos::TeamThreadRange<>(team_member, var.size()),
[&](const int idx, bool &lall_zero) {
const int k = kb.s + idx / NjNi;
const int j = jb.s + (idx % NjNi) / Ni;
const int i = ib.s + idx % Ni;
if (std::abs(var(k, j, i)) > threshold) {
if (std::abs(var_raw[idx]) > threshold) {
lall_zero = false;
return;
}
Expand Down

0 comments on commit f891c02

Please sign in to comment.