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.
10 int main(int argc, char **argv)
18 MTest_Init(&argc, &argv);
19 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
20 MPI_Comm_size(MPI_COMM_WORLD, &size);
24 MPI_Reduce(&data, &result, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
25 MPI_Bcast(&result, 1, MPI_INT, 0, MPI_COMM_WORLD);
27 for (i = 0; i < size; i++)
29 if (result != correct_result)
32 MPI_Reduce(&data, &result, 1, MPI_INT, MPI_MIN, 0, MPI_COMM_WORLD);
33 MPI_Bcast(&result, 1, MPI_INT, 0, MPI_COMM_WORLD);
37 MPI_Reduce(&data, &result, 1, MPI_INT, MPI_MAX, 0, MPI_COMM_WORLD);
38 MPI_Bcast(&result, 1, MPI_INT, 0, MPI_COMM_WORLD);
39 if (result != (size - 1))
42 MTest_Finalize(errors);
44 return MTestReturnValue(errors);