1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
4 * (C) 2003 by Argonne National Laboratory.
5 * See COPYRIGHT in top-level directory.
11 #include "mpicolltest.h"
14 static char MTEST_Descrip[] = "Simple intercomm broadcast test";
17 int main(int argc, char *argv[])
21 int leftGroup, i, count, rank;
23 MPI_Datatype datatype;
25 MTest_Init(&argc, &argv);
28 /* Get an intercommunicator */
29 while (MTestGetIntercomm(&comm, &leftGroup, 4)) {
30 if (comm == MPI_COMM_NULL)
33 MPI_Comm_rank(comm, &rank);
35 /* To improve reporting of problems about operations, we
36 * change the error handler to errors return */
37 MPI_Comm_set_errhandler(comm, MPI_ERRORS_RETURN);
39 for (count = 1; count < 65000; count = 2 * count) {
40 buf = (int *) malloc(count * sizeof(int));
43 for (i = 0; i < count; i++)
47 for (i = 0; i < count; i++)
50 err = MTest_Bcast(buf, count, datatype,
51 (rank == 0) ? MPI_ROOT : MPI_PROC_NULL, comm);
56 /* Test that no other process in this group received the
59 for (i = 0; i < count; i++) {
67 /* In the right group */
68 for (i = 0; i < count; i++)
70 err = MTest_Bcast(buf, count, datatype, 0, comm);
75 /* Check that we have received the correct data */
76 for (i = 0; i < count; i++) {