X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2b4010b2a5fda082278a02a35a9e9eb18b58e110..826897d361add5db3272a9810e70371a40ba1660:/teshsuite/smpi/mpich3-test/rma/test4_am.c diff --git a/teshsuite/smpi/mpich3-test/rma/test4_am.c b/teshsuite/smpi/mpich3-test/rma/test4_am.c new file mode 100644 index 0000000000..83cb3efc01 --- /dev/null +++ b/teshsuite/smpi/mpich3-test/rma/test4_am.c @@ -0,0 +1,95 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ +#include "mpi.h" +#include "stdio.h" +#include "stdlib.h" +#include "mpitest.h" +#include "squelch.h" + +/* tests passive target RMA on 2 processes. tests the lock-single_op-unlock + optimization. */ + +/* same as test4.c but uses alloc_mem */ + +#define SIZE1 100 +#define SIZE2 200 + +int main(int argc, char *argv[]) +{ + int rank, nprocs, *A, *B, i; + MPI_Comm CommDeuce; + MPI_Win win; + int errs = 0; + + MTest_Init(&argc,&argv); + MPI_Comm_size(MPI_COMM_WORLD,&nprocs); + MPI_Comm_rank(MPI_COMM_WORLD,&rank); + + if (nprocs < 2) { + printf("Run this program with 2 or more processes\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + MPI_Comm_split(MPI_COMM_WORLD, (rank < 2), rank, &CommDeuce); + + if (rank < 2) { + i = MPI_Alloc_mem(SIZE2 * sizeof(int), MPI_INFO_NULL, &A); + if (i) { + printf("Can't allocate memory in test program\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + i = MPI_Alloc_mem(SIZE2 * sizeof(int), MPI_INFO_NULL, &B); + if (i) { + printf("Can't allocate memory in test program\n"); + MPI_Abort(MPI_COMM_WORLD, 1); + } + + if (rank == 0) { + for (i=0; i