From de6a6a208019d2946ba354e9b8e960ff23e3405b Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Fri, 1 Dec 2017 17:34:50 +0100 Subject: [PATCH] add new rma test to the suite, from https://github.com/pmodels/mpich/commit/9d3af68d58a2b224002f6fd0df926216cc12cb5a --- teshsuite/smpi/mpich3-test/rma/CMakeLists.txt | 4 +- teshsuite/smpi/mpich3-test/rma/rget-testall.c | 75 +++++++++++++++++++ teshsuite/smpi/mpich3-test/rma/testlist | 1 + 3 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 teshsuite/smpi/mpich3-test/rma/rget-testall.c diff --git a/teshsuite/smpi/mpich3-test/rma/CMakeLists.txt b/teshsuite/smpi/mpich3-test/rma/CMakeLists.txt index 6c30288b97..1a1dcadab2 100644 --- a/teshsuite/smpi/mpich3-test/rma/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/rma/CMakeLists.txt @@ -19,7 +19,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) strided_acc_onelock strided_get_indexed strided_putget_indexed contention_put contention_putget adlb_mimic1 lock_contention_dt acc-loc get_acc_local get_accumulate put_base put_bottom linked_list_bench_lock_all linked_list_bench_lock_excl manyrma2 pscw_ordering rma-contig get-struct - rput_local_comp racc_local_comp) + rput_local_comp racc_local_comp rget-testall) # fence_shm fetchandadd_am fetchandadd fetchandadd_tree_am fetchandadd_tree # linked_list_bench_lock_shr linked_list linked_list_fop linked_list_lockall # mcs-mutex mixedsync mutex_bench lockcontention3 reqops @@ -61,7 +61,7 @@ foreach(file accfence1 accfence2_am accfence2 accpscw1 allocmem epochtest getfen rget-unlock overlap_wins_rma lock_nested derived-acc-flush_local large-acc-flush_local lockall_dt lockall_dt_flushall lockall_dt_flush nb_test lockall_dt_flushlocal lockall_dt_flushlocalall lock_contention_dt lock_dt lock_dt_flush lock_dt_flushlocal racc_local_comp rput_local_comp win_shared_create win_shared_put_flush_get win_shared_rma_flush_load - wrma_flush_get) + wrma_flush_get rget-testall) set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${file}.c) endforeach() diff --git a/teshsuite/smpi/mpich3-test/rma/rget-testall.c b/teshsuite/smpi/mpich3-test/rma/rget-testall.c new file mode 100644 index 0000000000..4f3eec243b --- /dev/null +++ b/teshsuite/smpi/mpich3-test/rma/rget-testall.c @@ -0,0 +1,75 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ +/* + * + * (C) 2017 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#include +#include +#include "mpitest.h" + +/* This test checks request-based get with MPI_Testall. Both the return value of + * MPI_Testall and status.MPI_ERROR should be correctly set. + * + * Thanks for Joseph Schuchart reporting this bug in MPICH and contributing + * the prototype of this test program. */ + +int main(int argc, char **argv) +{ + int rank, size; + MPI_Win win = MPI_WIN_NULL; + int *baseptr = NULL; + int errs = 0, mpi_errno = MPI_SUCCESS; + int val1 = 0, val2 = 0, flag = 0; + MPI_Request reqs[2]; + MPI_Status stats[2]; + + MTest_Init(&argc, &argv); + MPI_Comm_size(MPI_COMM_WORLD, &size); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN); + + MPI_Win_allocate(2 * sizeof(int), sizeof(int), MPI_INFO_NULL, MPI_COMM_WORLD, &baseptr, &win); + + /* Initialize window buffer */ + MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, win); + baseptr[0] = 1; + baseptr[1] = 2; + MPI_Win_unlock(rank, win); + + /* Issue request-based get with testall. */ + MPI_Win_lock_all(0, win); + MPI_Rget(&val1, 1, MPI_INT, 0, 0, 1, MPI_INT, win, &reqs[0]); + MPI_Rget(&val2, 1, MPI_INT, 0, 1, 1, MPI_INT, win, &reqs[1]); + + do { + mpi_errno = MPI_Testall(2, reqs, &flag, stats); + } while (flag == 0); + + /* Check get value. */ + if (val1 != 1 || val2 != 2) { + printf("%d - Got val1 = %d, val2 = %d, expected 1, 2\n", rank, val1, val2); + fflush(stdout); + errs++; + } + + /* Check return error code. */ + if (mpi_errno != MPI_SUCCESS) { + printf("%d - Got return errno %d, expected MPI_SUCCESS(%d)\n", + rank, mpi_errno, MPI_SUCCESS); + fflush(stdout); + errs++; + } + + MPI_Win_unlock_all(win); + MPI_Barrier(MPI_COMM_WORLD); + + MPI_Win_free(&win); + + MTest_Finalize(errs); + MPI_Finalize(); + + return errs != 0; +} diff --git a/teshsuite/smpi/mpich3-test/rma/testlist b/teshsuite/smpi/mpich3-test/rma/testlist index 3cf6fc838e..527b45b423 100644 --- a/teshsuite/smpi/mpich3-test/rma/testlist +++ b/teshsuite/smpi/mpich3-test/rma/testlist @@ -164,6 +164,7 @@ large-small-acc 2 #overlap_wins_fop 3 #overlap_wins_cas 3 lock_nested 3 +rget-testall 2 ## This test is not strictly correct. This was meant to test out the ## case when MPI_Test is not nonblocking. However, we ended up -- 2.20.1