- if (rank == source) {
- MTestPrintfMsg( 1, "(%d) About to create isend and cancel\n",cs );
- MPI_Isend( buf, n, MPI_CHAR, dest, cs+n+1, comm, &req );
- MPI_Barrier( comm );
- MPI_Cancel( &req );
- MPI_Wait( &req, &status );
- MTestPrintfMsg( 1, "Completed wait on isend\n" );
- MPI_Test_cancelled( &status, &flag );
- if (flag) {
- errs ++;
- printf( "Cancelled a matched Isend request (msg size = %d)!\n",
- n );
- fflush(stdout);
- }
- else
- {
- n = 0;
- }
- /* Send the size, zero for not cancelled (success) */
- MPI_Send( &n, 1, MPI_INT, dest, 123, comm );
- }
- else if (rank == dest)
- {
- MPI_Recv( buf, n, MPI_CHAR, source, cs+n+1, comm, &status );
- MPI_Barrier( comm );
- MPI_Recv( &n, 1, MPI_INT, source, 123, comm, &status );
- }
- else {
- MPI_Barrier( comm );
- }
+ if (rank == source) {
+ MTestPrintfMsg(1, "(%d) About to create isend and cancel\n", cs);
+ MPI_Isend(buf, n, MPI_CHAR, dest, cs + n + 1, comm, &req);
+ MPI_Barrier(comm);
+ MPI_Cancel(&req);
+ MPI_Wait(&req, &status);
+ MTestPrintfMsg(1, "Completed wait on isend\n");
+ MPI_Test_cancelled(&status, &flag);
+ if (flag) {
+ errs++;
+ printf("Cancelled a matched Isend request (msg size = %d)!\n", n);
+ fflush(stdout);
+ }
+ else {
+ n = 0;
+ }
+ /* Send the size, zero for not cancelled (success) */
+ MPI_Send(&n, 1, MPI_INT, dest, 123, comm);
+ }
+ else if (rank == dest) {
+ MPI_Recv(buf, n, MPI_CHAR, source, cs + n + 1, comm, &status);
+ MPI_Barrier(comm);
+ MPI_Recv(&n, 1, MPI_INT, source, 123, comm, &status);
+ }
+ else {
+ MPI_Barrier(comm);
+ }