5 #if defined(NEEDS_STDLIB_PROTOTYPES)
10 * This needs to test long messages as well as short ones.
11 * The most likely failure mode for this program is that it will
12 * hang. Sorry about that....
15 int main( int argc, char **argv )
21 int source = 0, recvtag = 2;
22 int dest = 0, sendtag = 2;
23 int i, *longsend, *longrecv;
25 int mpi_errno = MPI_SUCCESS;
26 MPI_Status status_array[2];
29 MPI_Init( &argc, &argv );
30 if ((mpi_errno = MPI_Irecv ( recvbuf, recvcount, MPI_INT,
31 source, recvtag, MPI_COMM_WORLD, &req[1] )))
33 if ((mpi_errno = MPI_Isend ( sendbuf, sendcount, MPI_INT, dest,
34 sendtag, MPI_COMM_WORLD, &req[0] )))
37 fprintf( stdout, "[%d] Starting waitall\n", 0 );
38 mpi_errno = MPI_Waitall ( 2, req, status_array );
39 fprintf( stdout, "[%d] Ending waitall\n", 0 );
41 for (i=16; i<257000; i *= 2) {
42 longsend = (int *)malloc( i * sizeof(int) );
43 longrecv = (int *)malloc( i * sizeof(int) );
44 if (!longsend || !longrecv) {
46 if ((mpi_errno = MPI_Irecv ( longrecv, i, MPI_INT, source, recvtag,
47 MPI_COMM_WORLD, &req[1] )))
49 if ((mpi_errno = MPI_Isend ( longsend, i, MPI_INT, dest, sendtag,
50 MPI_COMM_WORLD, &req[0] )))
53 fprintf( stdout, "[%d] Starting waitall (%d)\n", 0, i );
54 mpi_errno = MPI_Waitall ( 2, req, status_array );
55 fprintf( stdout, "[%d] Ending waitall\n", 0 );