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++) {
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;
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 );
/* 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 );