- buf = (int *)malloc( NELM * sizeof(int) );
- for (i=0; i<NELM; i++) buf[i] = -i;
- MPI_Irecv( buf, NELM, MPI_INT, source, 0, comm, &req );
- MPI_Comm_free( &comm );
-
- if (comm != MPI_COMM_NULL) {
- errs++;
- printf( "Freed comm was not set to COMM_NULL\n" );
- }
-
- for (i=0; i<NCOMM; i++) {
- MPI_Comm_split( MPI_COMM_WORLD, 0, size - rank, &tmpComm[i] );
- }
-
- MPI_Sendrecv( NULL, 0, MPI_INT, source, 1,
- NULL, 0, MPI_INT, source, 1, MPI_COMM_WORLD, &status );
-
- MPI_Wait( &req, &status );
- for (i=0; i<NELM; i++) {
- if (buf[i] != i) {
- errs++;
- if (errs < 10) {
- printf( "buf[%d] = %d, expected %d\n", i, buf[i], i );
- }
- }
- }
- for (i=0; i<NCOMM; i++) {
- MPI_Comm_free( &tmpComm[i] );
- }
- free( buf );
+ buf = (int *) malloc(NELM * sizeof(int));
+ for (i = 0; i < NELM; i++)
+ buf[i] = -i;
+ MPI_Irecv(buf, NELM, MPI_INT, source, 0, comm, &req);
+ MPI_Comm_free(&comm);
+
+ if (comm != MPI_COMM_NULL) {
+ errs++;
+ printf("Freed comm was not set to COMM_NULL\n");
+ }
+
+ for (i = 0; i < NCOMM; i++) {
+ MPI_Comm_split(MPI_COMM_WORLD, 0, size - rank, &tmpComm[i]);
+ }
+
+ MPI_Sendrecv(NULL, 0, MPI_INT, source, 1,
+ NULL, 0, MPI_INT, source, 1, MPI_COMM_WORLD, &status);
+
+ MPI_Wait(&req, &status);
+ for (i = 0; i < NELM; i++) {
+ if (buf[i] != i) {
+ errs++;
+ if (errs < 10) {
+ printf("buf[%d] = %d, expected %d\n", i, buf[i], i);
+ }
+ }
+ }
+ for (i = 0; i < NCOMM; i++) {
+ MPI_Comm_free(&tmpComm[i]);
+ }
+ free(buf);