Skip to content

Commit

Permalink
remove MPI_Cancel in reductions, substitute with MPI_Wait
Browse files Browse the repository at this point in the history
  • Loading branch information
KariRummukainen committed Dec 11, 2024
1 parent fa0afa1 commit 8220485
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
7 changes: 2 additions & 5 deletions libraries/plumbing/reduction.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ class Reduction {

/// Destructor cleans up communications if they are in progress
~Reduction() {
if (comm_is_on) {
MPI_Cancel(&request);
}
wait();
}

/// allreduce(bool) turns allreduce on or off. By default on.
Expand Down Expand Up @@ -169,8 +167,7 @@ class Reduction {
/// Assignment is used only outside site loops - drop comms if on, no need to wait
template <typename S, std::enable_if_t<hila::is_assignable<T &, S>::value, int> = 0>
T operator=(const S &rhs) {
if (comm_is_on)
MPI_Cancel(&request);
wait();

comm_is_on = false;
T ret = rhs;
Expand Down
4 changes: 1 addition & 3 deletions libraries/plumbing/reductionvector.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ class ReductionVector {

/// Destructor cleans up communications if they are in progress
~ReductionVector() {
if (comm_is_on) {
MPI_Cancel(&request);
}
wait();
}

/// And access operators - these do in practice everything already!
Expand Down

0 comments on commit 8220485

Please sign in to comment.