9 #if defined(NEEDS_STDLIB_PROTOTYPES)
14 #define MYBUFSIZE 8*1024
15 static int buffer[MAXPES][MYBUFSIZE];
20 int main ( int argc, char *argv[] )
26 MPI_Request request[MAXPES];
30 MPI_Init (&argc, &argv);
31 MPI_Comm_rank (MPI_COMM_WORLD, &self);
32 MPI_Comm_size (MPI_COMM_WORLD, &npes);
34 assert (npes <= MAXPES);
36 for (size = 1; size <= MYBUFSIZE ; size += size)
40 for (count = 0; count < NUM_RUNS; count++)
42 MPI_Barrier (MPI_COMM_WORLD);
44 for (i = 0; i < npes; i++)
48 MPI_Irecv (buffer[i], size, MPI_INT, i,
49 MPI_ANY_TAG, MPI_COMM_WORLD, &request[i]);
52 for (i = 0; i < npes; i++)
56 MPI_Send (buffer[self], size, MPI_INT, i, 0, MPI_COMM_WORLD);
59 for (i = 0; i < npes; i++)
63 MPI_Wait (&request[i], &status);
67 MPI_Barrier (MPI_COMM_WORLD);
72 secs = secs / (double) NUM_RUNS;
73 printf ( "length = %d ints\n", size );
77 (double) (size * sizeof (int) * (npes - 1)) /
78 (secs * 1024.0 * 1024.0));