Skip to content

Commit 867af0a

Browse files
committed
skip non-communicated variables
1 parent 975ce4a commit 867af0a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/bvals/comms/coalesced_buffers.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ ParArray1D<BndId> &CoalescedBuffer::GetBndIdsOnDevice(const std::set<Uid_t> &var
5555
int nbnd_id{0};
5656
int comb_size{0};
5757
for (auto uid : var_set) {
58+
// Skip this variable if it is not communicated in this BoundaryType
59+
if (coalesced_info_buf.count(uid) == 0) continue;
5860
nbnd_id += coalesced_info_buf.at(uid).size();
5961
for (auto &[bnd_id, pvbbuf] : coalesced_info_buf.at(uid)) {
6062
auto buf_state = pvbbuf->GetState();
@@ -81,6 +83,8 @@ ParArray1D<BndId> &CoalescedBuffer::GetBndIdsOnDevice(const std::set<Uid_t> &var
8183
int idx{0};
8284
int c_buf_idx{0}; // Index at which v-b buffer starts in combined buffer
8385
for (auto uid : var_set) {
86+
// Skip this variable if it is not communicated in this BoundaryType
87+
if (coalesced_info_buf.count(uid) == 0) continue;
8488
for (auto &[bnd_id, pvbbuf] : coalesced_info_buf.at(uid)) {
8589
auto &bid_h = bnd_ids_host[idx];
8690
auto buf_state = pvbbuf->GetState();
@@ -143,6 +147,8 @@ void CoalescedBuffer::PackAndSend(const std::set<Uid_t> &vars) {
143147
auto &stat = sparse_status_buffer.buffer();
144148
int idx{0};
145149
for (auto uid : var_set) {
150+
// Skip this variable if it is not communicated in this BoundaryType
151+
if (coalesced_info_buf.count(uid) == 0) continue;
146152
for (auto &[bnd_id, pvbbuf] : coalesced_info_buf.at(uid)) {
147153
const auto state = pvbbuf->GetState();
148154
PARTHENON_REQUIRE(state == BufferState::sending ||
@@ -157,6 +163,8 @@ void CoalescedBuffer::PackAndSend(const std::set<Uid_t> &vars) {
157163

158164
// Information in these send buffers is no longer required
159165
for (auto uid : var_set) {
166+
// Skip this variable if it is not communicated in this BoundaryType
167+
if (coalesced_info_buf.count(uid) == 0) continue;
160168
for (auto &[bnd_id, pvbbuf] : coalesced_info_buf.at(uid)) {
161169
pvbbuf->Stale();
162170
}
@@ -173,6 +181,8 @@ bool CoalescedBuffer::TryReceiveAndUnpack(const std::set<Uid_t> &vars) {
173181
// Make sure the var-boundary buffers are available to write to
174182
int nbuf{0};
175183
for (auto uid : var_set) {
184+
// Skip this variable if it is not communicated in this BoundaryType
185+
if (coalesced_info_buf.count(uid) == 0) continue;
176186
for (auto &[bnd_id, pvbbuf] : coalesced_info_buf.at(uid)) {
177187
if (pvbbuf->GetState() != BufferState::stale) return false;
178188
nbuf++;
@@ -190,6 +200,8 @@ bool CoalescedBuffer::TryReceiveAndUnpack(const std::set<Uid_t> &vars) {
190200
int idx{0};
191201
auto &stat = sparse_status_buffer.buffer();
192202
for (auto uid : var_set) {
203+
// Skip this variable if it is not communicated in this BoundaryType
204+
if (coalesced_info_buf.count(uid) == 0) continue;
193205
for (auto &[bnd_id, pvbbuf] : coalesced_info_buf.at(uid)) {
194206
if (stat[idx] == 1) {
195207
pvbbuf->SetReceived();

0 commit comments

Comments
 (0)