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.
12 static char MTEST_Descrip[] = "Get the group of an intercommunicator";
15 int main( int argc, char *argv[] )
18 int rank, size, grank, gsize;
19 int minsize = 2, isleft;
23 MTest_Init( &argc, &argv );
25 /* The following illustrates the use of the routines to
26 run through a selection of communicators and datatypes.
27 Use subsets of these for tests that do not involve combinations
28 of communicators, datatypes, and counts of datatypes */
29 while (MTestGetIntercomm( &comm, &isleft, minsize )) {
30 if (comm == MPI_COMM_NULL) continue;
31 /* Determine the sender and receiver */
32 MPI_Comm_rank( comm, &rank );
33 MPI_Comm_size( comm, &size );
34 MPI_Comm_group( comm, &group );
35 MPI_Group_rank( group, &grank );
36 MPI_Group_size( group, &gsize );
39 fprintf( stderr, "Ranks of groups do not match %d != %d\n",
44 fprintf( stderr, "Sizes of groups do not match %d != %d\n",
47 MPI_Group_free( &group );
48 MTestFreeComm( &comm );
51 MTest_Finalize( errs );