X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/db17323a11a3089f492c2cae1be7913673689d5c..c81c99a491282f76757c2673961e3cdee6853539:/teshsuite/smpi/mpich3-test/comm/cmfree.c diff --git a/teshsuite/smpi/mpich3-test/comm/cmfree.c b/teshsuite/smpi/mpich3-test/comm/cmfree.c new file mode 100644 index 0000000000..df377720b4 --- /dev/null +++ b/teshsuite/smpi/mpich3-test/comm/cmfree.c @@ -0,0 +1,118 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ +/* + * + * (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