/* -*- Mode: C; c-basic-offset:4 ; -*- */ /* * * (C) 2003 by Argonne National Laboratory. * See COPYRIGHT in top-level directory. */ #include "mpi.h" #include #include #include "mpitest.h" static char MTEST_Descrip[] = "Test that communicators have reference count semantics"; #define NELM 128 #define NCOMM 1020 int main( int argc, char *argv[] ) { int errs = 0; int rank, size, source, dest, i; MPI_Comm comm; MPI_Comm tmpComm[NCOMM]; MPI_Status status; MPI_Request req; int *buf=0; MTest_Init( &argc, &argv ); MPI_Comm_dup( MPI_COMM_WORLD, &comm ); /* This is similar to the datatype test, except that we post an irecv on a simple data buffer but use a rank-reordered communicator. In this case, an error in handling the reference count will most likely cause the program to hang, so this should be run only if (a) you are confident that the code is correct or (b) a timeout is set for mpiexec */ MPI_Comm_rank( comm, &rank ); MPI_Comm_size( comm, &size ); if (size < 2) { fprintf( stderr, "This test requires at least two processes." ); MPI_Abort( MPI_COMM_WORLD, 1 ); } source = 0; dest = size - 1; if (rank == dest) { buf = (int *)malloc( NELM * sizeof(int) ); for (i=0; i