Blame test/mpi/rma/getgroup.c

Packit 0848f5
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
Packit 0848f5
/*
Packit 0848f5
 *
Packit 0848f5
 *  (C) 2003 by Argonne National Laboratory.
Packit 0848f5
 *      See COPYRIGHT in top-level directory.
Packit 0848f5
 */
Packit 0848f5
#include "mpi.h"
Packit 0848f5
#include <stdio.h>
Packit 0848f5
#include "mpitest.h"
Packit 0848f5
Packit 0848f5
/*
Packit 0848f5
static char MTEST_Descrip[] = "Test of Win_get_group";
Packit 0848f5
*/
Packit 0848f5
Packit 0848f5
int main(int argc, char *argv[])
Packit 0848f5
{
Packit 0848f5
    int errs = 0;
Packit 0848f5
    int result;
Packit 0848f5
    int buf[10];
Packit 0848f5
    MPI_Win win;
Packit 0848f5
    MPI_Group group, wingroup;
Packit 0848f5
    int minsize = 2;
Packit 0848f5
    MPI_Comm comm;
Packit 0848f5
Packit 0848f5
    MTest_Init(&argc, &argv);
Packit 0848f5
Packit 0848f5
    /* The following illustrates the use of the routines to
Packit 0848f5
     * run through a selection of communicators and datatypes.
Packit 0848f5
     * Use subsets of these for tests that do not involve combinations
Packit 0848f5
     * of communicators, datatypes, and counts of datatypes */
Packit 0848f5
    while (MTestGetIntracommGeneral(&comm, minsize, 1)) {
Packit 0848f5
        if (comm == MPI_COMM_NULL)
Packit 0848f5
            continue;
Packit 0848f5
Packit 0848f5
        MPI_Win_create(buf, sizeof(int) * 10, sizeof(int), MPI_INFO_NULL, comm, &win);
Packit 0848f5
        MPI_Win_get_group(win, &wingroup);
Packit 0848f5
        MPI_Comm_group(comm, &group);
Packit 0848f5
        MPI_Group_compare(group, wingroup, &result);
Packit 0848f5
        if (result != MPI_IDENT) {
Packit 0848f5
            errs++;
Packit 0848f5
            fprintf(stderr, "Group returned by Win_get_group not the same as the input group\n");
Packit 0848f5
        }
Packit 0848f5
        MPI_Group_free(&wingroup);
Packit 0848f5
        MPI_Group_free(&group);
Packit 0848f5
        MPI_Win_free(&win);
Packit 0848f5
        MTestFreeComm(&comm);
Packit 0848f5
    }
Packit 0848f5
Packit 0848f5
    MTest_Finalize(errs);
Packit 0848f5
    MPI_Finalize();
Packit 0848f5
    return 0;
Packit 0848f5
}