Skip to content

Commit

Permalink
Simplify a few points in wait_gather; remove incorrect comment
Browse files Browse the repository at this point in the history
  • Loading branch information
KariRummukainen committed Dec 11, 2024
1 parent 7888ac8 commit 9afec10
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions libraries/plumbing/field_comm.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,6 @@ dir_mask_t Field<T>::start_gather(Direction d, Parity p) const {
/// @internal
/// wait_gather(): Wait for communication at parity par from
/// Direction d completes the communication in the function.
/// If the communication has not started yet, also calls
/// start_gather()
///
/// NOTE: This will be called even if the field is marked const.
/// Therefore this function is const, even though it does change
Expand Down Expand Up @@ -426,9 +424,7 @@ void Field<T>::wait_gather(Direction d, Parity p) const {
// care

// check here consistency, this should never happen
if (p != ALL && is_gather_started(d, p) && is_gather_started(d, ALL)) {
exit(1);
}
assert(!(p != ALL && is_gather_started(d, p) && is_gather_started(d, ALL)));

Parity par;
int n_wait = 1;
Expand All @@ -449,15 +445,12 @@ void Field<T>::wait_gather(Direction d, Parity p) const {
par = EVEN;
else if (is_gather_started(d, EVEN) && is_gather_started(d, ODD)) {
n_wait = 2; // need to wait for both!
par = ALL;
par = EVEN; // will be flipped
} else {
exit(1);
}
}

if (n_wait == 2)
par = EVEN; // we'll flip both

for (int wait_i = 0; wait_i < n_wait; ++wait_i) {

int par_i = (int)par - 1;
Expand Down

0 comments on commit 9afec10

Please sign in to comment.