Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new entry in Release_Notes.
[simgrid.git] / teshsuite / smpi / mpich3-test / coll / icbarrier.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 <stdlib.h>
10 #include "mpitest.h"
11 #include "mpicolltest.h"
12
13 /*
14 static char MTEST_Descrip[] = "Simple intercomm barrier test";
15 */
16
17 /* This only checks that the Barrier operation accepts intercommunicators.
18    It does not check for the semantics of a intercomm barrier (all processes
19    in the local group can exit when (but not before) all processes in the
20    remote group enter the barrier */
21 int main(int argc, char *argv[])
22 {
23     int errs = 0, err;
24     int leftGroup;
25     MPI_Comm comm;
26     MPI_Datatype datatype;
27
28     MTest_Init(&argc, &argv);
29
30     datatype = MPI_INT;
31     /* Get an intercommunicator */
32     while (MTestGetIntercomm(&comm, &leftGroup, 4)) {
33         if (comm == MPI_COMM_NULL)
34             continue;
35
36         /* To improve reporting of problems about operations, we
37          * change the error handler to errors return */
38         MPI_Comm_set_errhandler(comm, MPI_ERRORS_RETURN);
39         if (leftGroup) {
40             err = MTest_Barrier(comm);
41             if (err) {
42                 errs++;
43                 MTestPrintError(err);
44             }
45         }
46         else {
47             /* In the right group */
48             err = MTest_Barrier(comm);
49             if (err) {
50                 errs++;
51                 MTestPrintError(err);
52             }
53         }
54         MTestFreeComm(&comm);
55     }
56
57     MTest_Finalize(errs);
58     MPI_Finalize();
59     return 0;
60 }