1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
4 * (C) 2007 by Argonne National Laboratory.
5 * See COPYRIGHT in top-level directory.
14 * This test makes sure that each process can send to each other process.
15 * If there are bugs in the handling of request completions or in
16 * queue operations, then this test may fail on them (it did with
17 * early EagerShort handling).
21 #define MYBUFSIZE 16*1024
22 static int buffer[MAXPES][MYBUFSIZE];
26 int main ( int argc, char *argv[] )
32 MPI_Request request[MAXPES];
35 MTest_Init (&argc, &argv);
36 MPI_Comm_rank (MPI_COMM_WORLD, &self);
37 MPI_Comm_size (MPI_COMM_WORLD, &npes);
40 fprintf( stderr, "This program requires a comm_world no larger than %d",
42 MPI_Abort( MPI_COMM_WORLD, 1 );
45 for (size = 1; size <= MYBUFSIZE ; size += size) {
47 for (count = 0; count < NUM_RUNS; count++) {
48 MPI_Barrier (MPI_COMM_WORLD);
50 for (i = 0; i < npes; i++) {
52 MPI_Irecv (buffer[i], size, MPI_INT, i,
53 MPI_ANY_TAG, MPI_COMM_WORLD, &request[i]);
56 for (i = 0; i < npes; i++) {
58 MPI_Send (buffer[self], size, MPI_INT, i, 0, MPI_COMM_WORLD);
61 for (i = 0; i < npes; i++) {
63 MPI_Wait (&request[i], &status);
67 MPI_Barrier (MPI_COMM_WORLD);
71 secs = secs / (double) NUM_RUNS;
72 MTestPrintfMsg( 1, "length = %d ints\n", size );
76 /* Simple completion is all that we normally ask of this program */