Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add mpich3 test suite, to replace older one.
[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
12 /*
13 static char MTEST_Descrip[] = "Simple intercomm barrier test";
14 */
15
16 /* This only checks that the Barrier operation accepts intercommunicators.
17    It does not check for the semantics of a intercomm barrier (all processes
18    in the local group can exit when (but not before) all processes in the 
19    remote group enter the barrier */
20 int main( int argc, char *argv[] )
21 {
22     int errs = 0, err;
23     int leftGroup;
24     MPI_Comm comm;
25     MPI_Datatype datatype;
26
27     MTest_Init( &argc, &argv );
28
29     datatype = MPI_INT;
30     /* Get an intercommunicator */
31     while (MTestGetIntercomm( &comm, &leftGroup, 4 )) {
32         if (comm == MPI_COMM_NULL)
33             continue;
34
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 );
38         if (leftGroup) {
39             err = MPI_Barrier( comm );
40             if (err) {
41                 errs++;
42                 MTestPrintError( err );
43             }
44         }
45         else {
46             /* In the right group */
47             err = MPI_Barrier( comm );
48             if (err) {
49                 errs++;
50                 MTestPrintError( err );
51             }
52         }
53         MTestFreeComm( &comm );
54     }
55
56     MTest_Finalize( errs );
57     MPI_Finalize();
58     return 0;
59 }