From 867af0a4ad91396e0d70af89578c468bef6a09a9 Mon Sep 17 00:00:00 2001 From: Luke Roberts Date: Thu, 21 Nov 2024 13:44:10 -0700 Subject: [PATCH] skip non-communicated variables --- src/bvals/comms/coalesced_buffers.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/bvals/comms/coalesced_buffers.cpp b/src/bvals/comms/coalesced_buffers.cpp index 813b0e637438..4db4b17e115f 100644 --- a/src/bvals/comms/coalesced_buffers.cpp +++ b/src/bvals/comms/coalesced_buffers.cpp @@ -55,6 +55,8 @@ ParArray1D &CoalescedBuffer::GetBndIdsOnDevice(const std::set &var int nbnd_id{0}; int comb_size{0}; for (auto uid : var_set) { + // Skip this variable if it is not communicated in this BoundaryType + if (coalesced_info_buf.count(uid) == 0) continue; nbnd_id += coalesced_info_buf.at(uid).size(); for (auto &[bnd_id, pvbbuf] : coalesced_info_buf.at(uid)) { auto buf_state = pvbbuf->GetState(); @@ -81,6 +83,8 @@ ParArray1D &CoalescedBuffer::GetBndIdsOnDevice(const std::set &var int idx{0}; int c_buf_idx{0}; // Index at which v-b buffer starts in combined buffer for (auto uid : var_set) { + // Skip this variable if it is not communicated in this BoundaryType + if (coalesced_info_buf.count(uid) == 0) continue; for (auto &[bnd_id, pvbbuf] : coalesced_info_buf.at(uid)) { auto &bid_h = bnd_ids_host[idx]; auto buf_state = pvbbuf->GetState(); @@ -143,6 +147,8 @@ void CoalescedBuffer::PackAndSend(const std::set &vars) { auto &stat = sparse_status_buffer.buffer(); int idx{0}; for (auto uid : var_set) { + // Skip this variable if it is not communicated in this BoundaryType + if (coalesced_info_buf.count(uid) == 0) continue; for (auto &[bnd_id, pvbbuf] : coalesced_info_buf.at(uid)) { const auto state = pvbbuf->GetState(); PARTHENON_REQUIRE(state == BufferState::sending || @@ -157,6 +163,8 @@ void CoalescedBuffer::PackAndSend(const std::set &vars) { // Information in these send buffers is no longer required for (auto uid : var_set) { + // Skip this variable if it is not communicated in this BoundaryType + if (coalesced_info_buf.count(uid) == 0) continue; for (auto &[bnd_id, pvbbuf] : coalesced_info_buf.at(uid)) { pvbbuf->Stale(); } @@ -173,6 +181,8 @@ bool CoalescedBuffer::TryReceiveAndUnpack(const std::set &vars) { // Make sure the var-boundary buffers are available to write to int nbuf{0}; for (auto uid : var_set) { + // Skip this variable if it is not communicated in this BoundaryType + if (coalesced_info_buf.count(uid) == 0) continue; for (auto &[bnd_id, pvbbuf] : coalesced_info_buf.at(uid)) { if (pvbbuf->GetState() != BufferState::stale) return false; nbuf++; @@ -190,6 +200,8 @@ bool CoalescedBuffer::TryReceiveAndUnpack(const std::set &vars) { int idx{0}; auto &stat = sparse_status_buffer.buffer(); for (auto uid : var_set) { + // Skip this variable if it is not communicated in this BoundaryType + if (coalesced_info_buf.count(uid) == 0) continue; for (auto &[bnd_id, pvbbuf] : coalesced_info_buf.at(uid)) { if (stat[idx] == 1) { pvbbuf->SetReceived();