Blame test/mpi/cxx/coll/icbarrierx.cxx
|
Packit Service |
c5cf8c |
/* -*- Mode: C++; c-basic-offset:4 ; -*- */
|
|
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 <iostream>
|
|
Packit Service |
c5cf8c |
#include "mpitestconf.h"
|
|
Packit Service |
c5cf8c |
#include "mpitestcxx.h"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
static char MTEST_Descrip[] = "Simple intercomm barrier test";
|
|
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;
|
|
Packit Service |
c5cf8c |
int leftGroup;
|
|
Packit Service |
c5cf8c |
MPI::Intercomm comm;
|
|
Packit Service |
c5cf8c |
MPI::Datatype datatype;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MTest_Init();
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
datatype = MPI::INT;
|
|
Packit Service |
c5cf8c |
while (MTestGetIntercomm(comm, leftGroup, 4)) {
|
|
Packit Service |
c5cf8c |
if (comm == MPI::COMM_NULL)
|
|
Packit Service |
c5cf8c |
continue;
|
|
Packit Service |
c5cf8c |
/* Get an intercommunicator */
|
|
Packit Service |
c5cf8c |
if (leftGroup) {
|
|
Packit Service |
c5cf8c |
try {
|
|
Packit Service |
c5cf8c |
comm.Barrier();
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
catch(MPI::Exception e) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
MTestPrintError(e.Get_error_code());
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
} else {
|
|
Packit Service |
c5cf8c |
/* In the right group */
|
|
Packit Service |
c5cf8c |
try {
|
|
Packit Service |
c5cf8c |
comm.Barrier();
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
catch(MPI::Exception e) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
MTestPrintError(e.Get_error_code());
|
|
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 0;
|
|
Packit Service |
c5cf8c |
}
|