Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
We don't support MPI_Init( 0, 0 ), actually, and crash when this happens.
[simgrid.git] / teshsuite / smpi / mpich3-test / pt2pt / sendrecv3.c
index e0c21a7..4da5c86 100644 (file)
@@ -35,6 +35,7 @@ int main( int argc, char *argv[] )
     if (size < 2) {
        printf( "This test requires at least 2 processes\n" );
        MPI_Abort( MPI_COMM_WORLD, 1 );
+        exit(1);
     }
 
     for (testnum=0; msgsizes[testnum] > 0; testnum++) {
@@ -45,11 +46,12 @@ int main( int argc, char *argv[] )
            int *buf[MAX_NMSGS];
 
            for (i=0; i<nmsg; i++) {
-               buf[i] = (int *)malloc( msgSize );
+               buf[i] = (int *)malloc( msgSize * sizeof(int) );
                if (!buf[i]) {
                    fprintf( stderr, "Unable to allocate %d bytes\n", 
                             msgSize );
                    MPI_Abort( MPI_COMM_WORLD, 1 );
+                    exit(1);
                }
            }
            partner = (rank + 1) % size;
@@ -59,11 +61,11 @@ int main( int argc, char *argv[] )
                          MPI_STATUS_IGNORE );
            /* Try to fill up the outgoing message buffers */
            for (i=0; i<nmsg; i++) {
-               MPI_Isend( buf[i], msgSize, MPI_CHAR, partner, testnum, comm,
+               MPI_Isend( buf[i], msgSize, MPI_INT, partner, testnum, comm,
                           &r[i] );
            }
            for (i=0; i<nmsg; i++) {
-               MPI_Recv( buf[i], msgSize, MPI_CHAR, partner, testnum, comm,
+               MPI_Recv( buf[i], msgSize, MPI_INT, partner, testnum, comm,
                          MPI_STATUS_IGNORE );
            }
            MPI_Waitall( nmsg, r, MPI_STATUSES_IGNORE );
@@ -76,12 +78,12 @@ int main( int argc, char *argv[] )
            /* Try to fill up the outgoing message buffers */
            tsend = MPI_Wtime();
            for (i=0; i<nmsg; i++) {
-               MPI_Isend( buf[i], msgSize, MPI_CHAR, partner, testnum, comm,
+               MPI_Isend( buf[i], msgSize, MPI_INT, partner, testnum, comm,
                           &r[i] );
            }
            tsend = MPI_Wtime() - tsend;
            for (i=0; i<nmsg; i++) {
-               MPI_Recv( buf[i], msgSize, MPI_CHAR, partner, testnum, comm,
+               MPI_Recv( buf[i], msgSize, MPI_INT, partner, testnum, comm,
                          MPI_STATUS_IGNORE );
            }
            MPI_Waitall( nmsg, r, MPI_STATUSES_IGNORE );