From e95f691a3e74df931650f48081a7c22e5db001ce Mon Sep 17 00:00:00 2001 From: Luke Roberts Date: Tue, 26 Nov 2024 16:35:43 -0700 Subject: [PATCH] do view of views correctly for Kokkos 4.5.1 --- src/bvals/comms/coalesced_buffers.cpp | 6 +++--- src/bvals/comms/coalesced_buffers.hpp | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/bvals/comms/coalesced_buffers.cpp b/src/bvals/comms/coalesced_buffers.cpp index 4db4b17e115f..0c00b4fcdcd3 100644 --- a/src/bvals/comms/coalesced_buffers.cpp +++ b/src/bvals/comms/coalesced_buffers.cpp @@ -46,7 +46,7 @@ void CoalescedBuffer::AllocateCoalescedBuffer() { } //---------------------------------------------------------------------------------------- -ParArray1D &CoalescedBuffer::GetBndIdsOnDevice(const std::set &vars, +ParArray1DRaw &CoalescedBuffer::GetBndIdsOnDevice(const std::set &vars, int *pcomb_size) { const auto &var_set = vars.size() == 0 ? all_vars : vars; auto &bnd_ids_device = bnd_ids_device_map[var_set]; @@ -75,8 +75,8 @@ ParArray1D &CoalescedBuffer::GetBndIdsOnDevice(const std::set &var } if (nbnd_id != bnd_ids_device.size()) { - bnd_ids_device = ParArray1D("bnd_id", nbnd_id); - bnd_ids_host = Kokkos::create_mirror_view(bnd_ids_device); + bnd_ids_device = ParArray1DRaw(parthenon::ViewOfViewAlloc("bnd_id"), nbnd_id); + bnd_ids_host = create_view_of_view_mirror(bnd_ids_device); updated = true; } diff --git a/src/bvals/comms/coalesced_buffers.hpp b/src/bvals/comms/coalesced_buffers.hpp index 8f7939a31703..62953c31ef29 100644 --- a/src/bvals/comms/coalesced_buffers.hpp +++ b/src/bvals/comms/coalesced_buffers.hpp @@ -61,8 +61,8 @@ struct CoalescedBuffer { using var_buf_t = CommBuffer::owner_t>; std::map>> coalesced_info_buf; std::set all_vars; - std::unordered_map, ParArray1D, uid_set_hash> bnd_ids_device_map; - std::unordered_map, ParArray1D::host_mirror_type, uid_set_hash> + std::unordered_map, ParArray1DRaw, uid_set_hash> bnd_ids_device_map; + std::unordered_map, ParArray1DRaw::host_mirror_type, uid_set_hash> bnd_ids_host_map; CommBuffer coalesced_comm_buffer; CommBuffer> sparse_status_buffer; @@ -92,7 +92,7 @@ struct CoalescedBuffer { coalesced_comm_buffer.IsAvailableForWrite(); } - ParArray1D &GetBndIdsOnDevice(const std::set &vars, + ParArray1DRaw &GetBndIdsOnDevice(const std::set &vars, int *pcomb_size = nullptr); void PackAndSend(const std::set &vars); @@ -176,6 +176,7 @@ struct CoalescedComms { do { can_delete = true; for (auto &[p, cbr] : coalesced_send_buffers) { + can_delete = cbr.message.IsAvailableForWrite() && can_delete; for (auto &[r, cbrp] : cbr.coalesced_bufs) { can_delete = cbrp.IsAvailableForWrite() && can_delete; }