Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 @@ -37,6 +37,7 @@
- [[PR 1351]](https://github.com/parthenon-hpc-lab/parthenon/pull/1351) Bump Kokkos 5 & C++20

### Fixed (not changing behavior/API/variables/...)
- [[PR 1448]](https://github.com/parthenon-hpc-lab/parthenon/pull/1448) Fix bugs: CellMemAligned and Independent buffer overrun, var_view bad access
- [[PR 1435]](https://github.com/parthenon-hpc-lab/parthenon/pull/1435) Fix loop abstraction scratch sizing for multi-axis (corner) halos
- [[PR 1434]](https://github.com/parthenon-hpc-lab/parthenon/pull/1434) Repair nodal field output in XDMF.
- [[PR 1430]](https://github.com/parthenon-hpc-lab/parthenon/pull/1430) Fix BiCGSTAB returning NaN when a solve converges in its first half step
Expand Down
7 changes: 6 additions & 1 deletion src/bvals/comms/bnd_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ CalcIndices(const NeighborBlock &nb, MeshBlock *pmb,
exterior_offset /= 2;
}

const bool missing_last_face =
(!v->IsSet(Metadata::Cell)) && v->IsSet(Metadata::CellMemAligned);
std::array<int, 3> s, e;
for (int dir = 0; dir < 3; ++dir) {
if (block_offset[dir] == 0) {
Expand Down Expand Up @@ -227,9 +229,12 @@ CalcIndices(const NeighborBlock &nb, MeshBlock *pmb,
}
// Prolongate into ghosts of interior receiver since we have the data available,
// having this is important for AMR MG
// For cell mem-aligned fields, we cannot safely prolongate in the ghosts on the
// upper sides so we only prolongate into the interior. MG does not support
// non-cell fields currently, so there is no mismatch.
if (prores && not_symmetry[dir] && IndexRangeType::InteriorRecv == ir_type) {
s[dir] -= Globals::nghost / 2;
e[dir] += Globals::nghost / 2;
if (!missing_last_face) e[dir] += Globals::nghost / 2;
}
} else if (block_offset[dir] > 0) {
// Fluxes are only communicated on shared elements
Expand Down
25 changes: 20 additions & 5 deletions src/loop_abstraction/pack_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,26 @@ make_var_view(const InnerIndexRange<IndexSpaceType> &idx_range, const PackType &
out.memory_indexer = &memory_indexer;
out.shift_ = memory_indexer.GetFlatIdx(idx_range.ks, idx_range.js, idx_range.is);
out.data_ = pack_in(idx_range.block, te, vidx).data() + out.shift_;
const int vidx_next = ((pack_in.GetSize() > vidx + 1) &&
(pack_in(idx_range.block, vidx).tensor_components > 1))
? vidx + 1
: vidx;
out.stride_ = pack_in(idx_range.block, te, vidx_next).data() + out.shift_ - out.data_;
// This stride should only make sense for a single field where the memory is allocated
// contiguously, any time that multiple fields are packed into a single variable type
// the stride will not be sensible since the the pointer arithmetic will involve two
// chunks of memory that were allocated at separate times. To keep things light, we
// only provide a partial check **user beware**
if constexpr (std::is_integral_v<IndexType>) {
const int vidx_next = ((pack_in.GetUpperBound(idx_range.block) >= vidx + 1) &&
(pack_in(idx_range.block, te, vidx).tensor_components > 1))
? vidx + 1
: vidx;
out.stride_ =
pack_in(idx_range.block, te, vidx_next).data() + out.shift_ - out.data_;
} else {
const int vidx_next = ((pack_in.GetUpperBound(idx_range.block, var) >= vidx + 1) &&
(pack_in(idx_range.block, te, vidx).tensor_components > 1))
? vidx + 1
: vidx;
out.stride_ =
pack_in(idx_range.block, te, vidx_next).data() + out.shift_ - out.data_;
}
return out;
}
}
Expand Down
Loading