Blame test/mpi/coll/icbarrier.c
|
Packit Service |
c5cf8c |
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* (C) 2003 by Argonne National Laboratory.
|
|
Packit Service |
c5cf8c |
* See COPYRIGHT in top-level directory.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
#include "mpi.h"
|
|
Packit Service |
c5cf8c |
#include <stdio.h>
|
|
Packit Service |
c5cf8c |
#include <stdlib.h>
|
|
Packit Service |
c5cf8c |
#include "mpitest.h"
|
|
Packit Service |
c5cf8c |
#include "mpicolltest.h"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
static char MTEST_Descrip[] = "Simple intercomm barrier test";
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* This only checks that the Barrier operation accepts intercommunicators.
|
|
Packit Service |
c5cf8c |
It does not check for the semantics of a intercomm barrier (all processes
|
|
Packit Service |
c5cf8c |
in the local group can exit when (but not before) all processes in the
|
|
Packit Service |
c5cf8c |
remote group enter the barrier */
|
|
Packit Service |
c5cf8c |
int main(int argc, char *argv[])
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
int errs = 0, err;
|
|
Packit Service |
c5cf8c |
int leftGroup;
|
|
Packit Service |
c5cf8c |
MPI_Comm comm;
|
|
Packit Service |
c5cf8c |
MPI_Datatype datatype;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MTest_Init(&argc, &argv);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
datatype = MPI_INT;
|
|
Packit Service |
c5cf8c |
/* Get an intercommunicator */
|
|
Packit Service |
c5cf8c |
while (MTestGetIntercomm(&comm, &leftGroup, 4)) {
|
|
Packit Service |
c5cf8c |
if (comm == MPI_COMM_NULL)
|
|
Packit Service |
c5cf8c |
continue;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* To improve reporting of problems about operations, we
|
|
Packit Service |
c5cf8c |
* change the error handler to errors return */
|
|
Packit Service |
c5cf8c |
MPI_Comm_set_errhandler(comm, MPI_ERRORS_RETURN);
|
|
Packit Service |
c5cf8c |
if (leftGroup) {
|
|
Packit Service |
c5cf8c |
err = MTest_Barrier(comm);
|
|
Packit Service |
c5cf8c |
if (err) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
MTestPrintError(err);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
/* In the right group */
|
|
Packit Service |
c5cf8c |
err = MTest_Barrier(comm);
|
|
Packit Service |
c5cf8c |
if (err) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
MTestPrintError(err);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
MTestFreeComm(&comm);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MTest_Finalize(errs);
|
|
Packit Service |
c5cf8c |
return MTestReturnValue(errs);
|
|
Packit Service |
c5cf8c |
}
|