1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
3 * (C) 2001 by Argonne National Laboratory.
4 * See COPYRIGHT in top-level directory.
16 int main( int argc, char **argv)
21 int sizes[NUM_SIZES] = { 100, 64*1024, 128*1024, 1024*1024 };
24 MTest_Init( &argc, &argv );
25 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
29 if (strcmp(argv[1], "-novalidate") == 0 || strcmp(argv[1], "-noverify") == 0)
33 buf = (int *) malloc(sizes[NUM_SIZES-1]*sizeof(int));
34 memset(buf, 0, sizes[NUM_SIZES-1]*sizeof(int));
36 for (n=0; n<NUM_SIZES; n++)
41 printf("bcasting %d MPI_INTs %d times\n", sizes[n], NUM_REPS);
45 for (reps=0; reps < NUM_REPS; reps++)
51 for (i=0; i<sizes[n]; i++)
53 buf[i] = 1000000 * (n * NUM_REPS + reps) + i;
58 for (i=0; i<sizes[n]; i++)
60 buf[i] = -1 - (n * NUM_REPS + reps);
67 printf("rank=%d, n=%d, reps=%d\n", rank, n, reps);
71 MPI_Bcast(buf, sizes[n], MPI_INT, ROOT, MPI_COMM_WORLD);
76 for (i=0; i<sizes[n]; i++)
78 if (buf[i] != 1000000 * (n * NUM_REPS + reps) + i)
83 printf("Error: Rank=%d, n=%d, reps=%d, i=%d, buf[i]=%d expected=%d\n", rank, n, reps, i, buf[i],
84 1000000 * (n * NUM_REPS + reps) +i);
91 printf("Error: Rank=%d, num_errors = %d\n", rank, num_errors);
100 MTest_Finalize( num_errors );