Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update RMA tests
[simgrid.git] / teshsuite / smpi / mpich3-test / rma / getgroup.c
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  *
4  *  (C) 2003 by Argonne National Laboratory.
5  *      See COPYRIGHT in top-level directory.
6  */
7 #include "mpi.h"
8 #include <stdio.h>
9 #include "mpitest.h"
10
11 /*
12 static char MTEST_Descrip[] = "Test of Win_get_group";
13 */
14
15 int main(int argc, char *argv[])
16 {
17     int errs = 0;
18     int result;
19     int buf[10];
20     MPI_Win win;
21     MPI_Group group, wingroup;
22     int minsize = 2;
23     MPI_Comm comm;
24
25     MTest_Init(&argc, &argv);
26
27     /* The following illustrates the use of the routines to
28      * run through a selection of communicators and datatypes.
29      * Use subsets of these for tests that do not involve combinations
30      * of communicators, datatypes, and counts of datatypes */
31     while (MTestGetIntracommGeneral(&comm, minsize, 1)) {
32         if (comm == MPI_COMM_NULL)
33             continue;
34
35         MPI_Win_create(buf, sizeof(int) * 10, sizeof(int), MPI_INFO_NULL, comm, &win);
36         MPI_Win_get_group(win, &wingroup);
37         MPI_Comm_group(comm, &group);
38         MPI_Group_compare(group, wingroup, &result);
39         if (result != MPI_IDENT) {
40             errs++;
41             fprintf(stderr, "Group returned by Win_get_group not the same as the input group\n");
42         }
43         MPI_Group_free(&wingroup);
44         MPI_Group_free(&group);
45         MPI_Win_free(&win);
46         MTestFreeComm(&comm);
47     }
48
49     MTest_Finalize(errs);
50     MPI_Finalize();
51     return 0;
52 }