diff --git a/notswiftmpistepsim2.c b/notswiftmpistepsim2.c index 4e9f96c50bc0cc019e028dacb17728054762c909..445f07d84e130ffac46c9934cec8fe07e03057e2 100644 --- a/notswiftmpistepsim2.c +++ b/notswiftmpistepsim2.c @@ -105,7 +105,7 @@ static int datacheck_test(size_t size, void *data) { } /** - * @brief send nitiates MPI_Isend requests and the waits for completion. + * @brief Initiates MPI_Isend requests and the waits for completion. */ static void *send_thread(void *arg) { @@ -168,10 +168,13 @@ static void *send_thread(void *arg) { if (datacheck) datacheck_fill(log->size, log->data); /* And send. Note using different communicator so need to construct - * different, still unique and computable, tag.*/ + * different, still unique and computable, tag. Also each send/recv pair + * needs the same communicator... as well as each send/test and recv/test + * the same thread! */ + log->tag = log->tag + maxtag * log->subtype; + int comm = log->otherrank % 2; err = MPI_Isend(log->data, log->size, MPI_BYTE, log->otherrank, - log->tag + maxtag * log->subtype, - subtypeMPI_comms[0], &log->req); + log->tag, subtypeMPI_comms[comm], &log->req); /* Add a new send request. */ sends_queue[nr_sends_queue] = log; @@ -249,7 +252,7 @@ static void *send_thread(void *arg) { } /** - * @brief send nitiates MPI_Irecv requests and the waits for completion. + * @brief Initiates MPI_Irecv requests and the waits for completion. */ static void *recv_thread(void *arg) { @@ -311,11 +314,11 @@ static void *recv_thread(void *arg) { /* Fill data with pattern. */ if (datacheck) datacheck_fill(log->size, log->data); - /* And listen for send. Note using different communicator so need to - * construct different, still unique and computable, tag.*/ - err = MPI_Isend(log->data, log->size, MPI_BYTE, log->otherrank, - log->tag + maxtag * log->subtype, - subtypeMPI_comms[1], &log->req); + /* And listen for remote sends. Same constraints as sends... */ + log->tag = log->tag + maxtag * log->subtype; + int comm = log->rank % 2; + err = MPI_Irecv(log->data, log->size, MPI_BYTE, log->otherrank, + log->tag, subtypeMPI_comms[comm], &log->req); /* Add a new recv request. */ recvs_queue[nr_recvs_queue] = log; @@ -324,7 +327,6 @@ static void *recv_thread(void *arg) { if (verbose) message("recv injections completed: %d", nr_recvs_queue); - /* Now we wait for the recvs to complete. */ /* Global MPI_Test statistics. */ int ncalls = 0;