Fix unmatched wait for correct request-based rma

For example on Correct-rmarequest-rget_bufwrite-001.c on current main:

  if (rank == 0) {

    int *buf = (int *)calloc(10, sizeof(int));

    MPI_Rget(buf, 10, MPI_INT, 1, 0, 10, MPI_INT, mpi_win_0, &mpi_request_0);
    MPI_Wait(&mpi_request_0, MPI_STATUS_IGNORE);
    buf[0] = 42;
  }
  MPI_Win_unlock_all(mpi_win_0);
  if (rank == 0) {
    MPI_Wait(&mpi_request_0, MPI_STATUS_IGNORE);
  }

mpi_request_0 is waited on twice, once in the branch and once outside. This is because the finalization clause does not check whether the RMA request is already done. For other RMA sync mechanisms this is irrelevant, as having (for example) another fence is not an error, but an unmatched wait is.

Merge request reports

Loading