[mpich] MPICH primary repository branch, master, updated. v3.1-139-ga80bf84
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "MPICH primary repository". The branch, master has been updated via a80bf84aecfc6c6152474623d418b2a3cb71fd53 (commit) from e24b44a721b37a92cfc46baa12c037c25a25efb5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://git.mpich.org/mpich.git/commitdiff/a80bf84aecfc6c6152474623d418b2a3cb... commit a80bf84aecfc6c6152474623d418b2a3cb71fd53 Author: James Dinan <[email protected]> Date: Mon Mar 3 14:06:02 2014 -0500 Add RMA accumulate test with min/maxloc operator Add a test to check for correct behavior of MPI_Accumulate operations with the MPI_MINLOC and MPI_MAXLOC operations. Signed-off-by: Xin Zhao <[email protected]> diff --git a/test/mpi/rma/Makefile.am b/test/mpi/rma/Makefile.am index 87b506c..61fb401 100644 --- a/test/mpi/rma/Makefile.am +++ b/test/mpi/rma/Makefile.am @@ -121,7 +121,8 @@ noinst_PROGRAMS = \ mutex_bench_shm \ rma-contig \ badrma \ - nb_test + nb_test \ + acc-loc strided_acc_indexed_LDADD = $(LDADD) -lm strided_acc_onelock_LDADD = $(LDADD) -lm diff --git a/test/mpi/rma/acc-loc.c b/test/mpi/rma/acc-loc.c new file mode 100644 index 0000000..18c3e3a --- /dev/null +++ b/test/mpi/rma/acc-loc.c @@ -0,0 +1,147 @@ +/* + * (C) 2006 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + * + * Portions of this code were written by Intel Corporation. + * Copyright (C) 2011-2012 Intel Corporation. Intel provides this material + * to Argonne National Laboratory subject to Software Grant and Corporate + * Contributor License Agreement dated February 8, 2012. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <mpi.h> +#include "mpitest.h" + +typedef struct { + int val; + int loc; +} twoint_t; + +static int errors = 0; + +int main(int argc, char **argv) { + int me, nproc; + twoint_t *data = NULL; + twoint_t mine; + MPI_Win win; + + MTest_Init(&argc, &argv); + + MPI_Comm_rank(MPI_COMM_WORLD, &me); + MPI_Comm_size(MPI_COMM_WORLD, &nproc); + + if (me == 0) { + MPI_Alloc_mem(sizeof(twoint_t), MPI_INFO_NULL, &data); + } + + MPI_Win_create(data, me == 0 ? sizeof(twoint_t) : 0, 1, MPI_INFO_NULL, MPI_COMM_WORLD, &win); + MPI_Win_fence(MPI_MODE_NOPRECEDE, win); + + /* All processes perform MAXLOC and MINLOC operations on a 2INT on rank 0. + * The loc is the origin process' rank, and the value is (nproc-me). In + * the case of MAXLOC, rank 0 should win and in the case of MINLOC, rank + * nproc-1 should win. + */ + + /** Test MAXLOC **/ + + if (me == 0) { + data->val = 0; + data->loc = -1; + } + MPI_Win_fence(0, win); + + mine.loc = me; + mine.val = nproc - me; + MPI_Accumulate(&mine, 1, MPI_2INT, 0, 0, 1, MPI_2INT, MPI_MAXLOC, win); + MPI_Win_fence(0, win); + + if (me == 0 && (data->loc != 0 || data->val != nproc)) { + errors++; + printf("Expected: { loc = %d, val = %d } Actual: { loc = %d, val = %d }\n", + 0, nproc, data->loc, data->val); + } + + /** Test MINLOC **/ + + if (me == 0) { + data->val = nproc; + data->loc = -1; + } + MPI_Win_fence(0, win); + + mine.loc = me; + mine.val = nproc - me; + MPI_Accumulate(&mine, 1, MPI_2INT, 0, 0, 1, MPI_2INT, MPI_MINLOC, win); + MPI_Win_fence(0, win); + + if (me == 0 && (data->loc != nproc-1 || data->val != 1)) { + errors++; + printf("Expected: { loc = %d, val = %d } Actual: { loc = %d, val = %d }\n", + nproc-1, 1, data->loc, data->val); + } + + /* All processes perform MAXLOC and MINLOC operations on a 2INT on rank 0. + * The loc is the origin process' rank, and the value is 1. In both cases, + * rank 0 should win because the values are equal and it has the lowest + * loc. + */ + + /** Test MAXLOC **/ + + if (me == 0) { + data->val = 0; + data->loc = -1; + } + MPI_Win_fence(MPI_MODE_NOSUCCEED, win); + + mine.loc = me; + mine.val = 1; + + MPI_Win_lock(MPI_LOCK_SHARED, 0, MPI_MODE_NOCHECK, win); + MPI_Accumulate(&mine, 1, MPI_2INT, 0, 0, 1, MPI_2INT, MPI_MAXLOC, win); + MPI_Win_unlock(0, win); + + MPI_Barrier(MPI_COMM_WORLD); + + if (me == 0 && (data->loc != 0 || data->val != 1)) { + errors++; + printf("Expected: { loc = %d, val = %d } Actual: { loc = %d, val = %d }\n", + 0, 1, data->loc, data->val); + } + MPI_Win_fence(MPI_MODE_NOPRECEDE, win); + + /** Test MINLOC **/ + + if (me == 0) { + data->val = nproc; + data->loc = -1; + } + MPI_Win_fence(MPI_MODE_NOSUCCEED, win); + + mine.loc = me; + mine.val = 1; + + MPI_Win_lock(MPI_LOCK_SHARED, 0, MPI_MODE_NOCHECK, win); + MPI_Accumulate(&mine, 1, MPI_2INT, 0, 0, 1, MPI_2INT, MPI_MINLOC, win); + MPI_Win_unlock(0, win); + + MPI_Barrier(MPI_COMM_WORLD); + + if (me == 0 && (data->loc != 0 || data->val != 1)) { + errors++; + printf("Expected: { loc = %d, val = %d } Actual: { loc = %d, val = %d }\n", + 0, 1, data->loc, data->val); + } + + MPI_Win_free(&win); + + if (me == 0) { + MPI_Free_mem(data); + } + + MTest_Finalize(errors); + MPI_Finalize(); + return 0; +} diff --git a/test/mpi/rma/testlist.in b/test/mpi/rma/testlist.in index f30f568..847689c 100644 --- a/test/mpi/rma/testlist.in +++ b/test/mpi/rma/testlist.in @@ -106,6 +106,7 @@ mutex_bench_shared 4 mpiversion=3.0 mutex_bench_shm 4 mpiversion=3.0 rma-contig 2 mpiversion=3.0 timeLimit=600 badrma 2 mpiversion=3.0 +acc-loc 4 ## This test is not strictly correct. This was meant to test out the ## case when MPI_Test is not nonblocking. However, we ended up ----------------------------------------------------------------------- Summary of changes: test/mpi/rma/Makefile.am | 3 +- test/mpi/rma/acc-loc.c | 147 ++++++++++++++++++++++++++++++++++++++++++++++ test/mpi/rma/testlist.in | 1 + 3 files changed, 150 insertions(+), 1 deletions(-) create mode 100644 test/mpi/rma/acc-loc.c hooks/post-receive -- MPICH primary repository
participants (1)
-
noreply@mpich.org