diff --git a/swiftmpiproxies.c b/swiftmpiproxies.c index cda7f736901f3926d23c73057e9795a0e7e01a30..fa24f3756893d29c504395768681466e543afec7 100644 --- a/swiftmpiproxies.c +++ b/swiftmpiproxies.c @@ -260,9 +260,8 @@ int main(int argc, char *argv[]) { /* Start Isend counts of pcells. Really just the size of the buffer * we're about to send, SWIFT sends the count. */ - int size = log->size; - res = MPI_Isend(&size, 1, MPI_INT, log->otherrank, + res = MPI_Isend(&log->size, 1, MPI_INT, log->otherrank, basetag + proxy_tag_count, MPI_COMM_WORLD, &req_send_counts[k]); if (res != MPI_SUCCESS) error("Counts MPI_Isend failed."); @@ -284,7 +283,8 @@ int main(int argc, char *argv[]) { &req_recv_counts[k]); if (res != MPI_SUCCESS) error("Counts MPI_Irecv failed."); } - message("All counts requests and pcell sends are launched"); + if (verbose) + message("All counts requests and pcell sends are launched"); /* Now wait for any of the counts irecvs to complete and then create the * irecv for the pcells. */ @@ -312,13 +312,15 @@ int main(int argc, char *argv[]) { &req_pcells_in[pid]); if (res != MPI_SUCCESS) error("Pcell MPI_Irecv failed."); } - message("All proxy cell counts have arrived, pcells irecvs are launched"); + if (verbose) + message("All proxy cell counts have arrived, pcells irecvs are launched"); /* Waitall for all Isend counts to complete. */ res = MPI_Waitall(nr_send_pcells, req_send_counts, MPI_STATUSES_IGNORE); if (res != MPI_SUCCESS) error("Waitall for counts Isend failed."); - message("All sends of counts have completed"); + if (verbose) + message("All sends of counts have completed"); /* Now wait for the pcell irecvs to complete, so we receive the pcells, * which would be unpacked in SWIFT. */ @@ -343,13 +345,23 @@ int main(int argc, char *argv[]) { status.MPI_SOURCE, status.MPI_TAG, expected_tag, status.MPI_ERROR); + /* Shouldn't happen, but has been seen. */ + if (status.MPI_ERROR != MPI_SUCCESS) + mpi_error_string(status.MPI_ERROR, "unexpected MPI status"); + + /* Make a report on what the buffer contains. */ datacheck_fulltest(pcells_size[pid], pcells_in[pid]); - fflush(stdout); + /* This call will succeed, if the receive buffer has not been + * updated. */ if (datacheck_test(myrank, pcells_size[pid], pcells_in[pid])) { - error("Received data is not modified on receive"); + message("Received data is not modified"); + fflush(stdout); + error("Failed"); } else { - error("Received data is corrupt"); + message("Received data is corrupt"); + fflush(stdout); + error("Failed"); } } else { if (verbose) message("Received data is correct"); @@ -357,12 +369,14 @@ int main(int argc, char *argv[]) { free(pcells_in[pid]); pcells_in[pid] = NULL; } - message("All proxy cells have arrived"); + if (verbose) + message("All proxy cells have arrived"); /* Waitall for Isend of pcells to complete. */ res = MPI_Waitall(nr_send_pcells, req_pcells_out, MPI_STATUSES_IGNORE); if (res != MPI_SUCCESS) error("Waitall for pcells Isend failed."); - message("All sends of pcells have completed"); + if (verbose) + message("All sends of pcells have completed"); /* Check data is unmodified while being offloaded. */ for (int k = 0; k < nr_send_pcells; k++) {