[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2b3-184-gc5ee3a0
Service Account
noreply at mpich.org
Sun Jul 5 22:18:07 CDT 2015
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 c5ee3a08c8458509849094a0c27a558b323e8ba4 (commit)
via f0a66babd3ffccdc976ace6f4e7cf7631bce4ce6 (commit)
from 9289c6e6a4c582f5707aaac92a2359d492832c58 (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/c5ee3a08c8458509849094a0c27a558b323e8ba4
commit c5ee3a08c8458509849094a0c27a558b323e8ba4
Author: Min Si <msi at il.is.s.u-tokyo.ac.jp>
Date: Tue Jun 30 22:49:02 2015 -0500
Added test to check remote completion of RMA+flush.
This patch adds two tests to check the remote completion of flush with
RMA write-like operations (PUT, ACC, GET_ACC, FOP, CAS). One test
confirms the result by shm load, and the other one confirms result by
GET issued from another process.
Signed-off-by: Xin Zhao <xinzhao3 at illinois.edu>
Signed-off-by: Halim Amer <aamer at anl.gov>
diff --git a/test/mpi/rma/Makefile.am b/test/mpi/rma/Makefile.am
index 6a7350f..c48a59b 100644
--- a/test/mpi/rma/Makefile.am
+++ b/test/mpi/rma/Makefile.am
@@ -158,7 +158,17 @@ noinst_PROGRAMS = \
manyget \
derived-acc-flush_local\
large-acc-flush_local \
- large-small-acc
+ large-small-acc \
+ put_flush_get \
+ acc_flush_get \
+ gacc_flush_get \
+ fop_flush_get \
+ cas_flush_get \
+ win_shared_put_flush_load \
+ win_shared_acc_flush_load \
+ win_shared_gacc_flush_load \
+ win_shared_fop_flush_load \
+ win_shared_cas_flush_load
if BUILD_MPIX_TESTS
noinst_PROGRAMS += aint
@@ -242,3 +252,27 @@ linked_list_bench_lock_shr_nocheck_CPPFLAGS = -DUSE_MODE_NOCHECK $(AM_CPPFLAGS)
win_shared_create_allocshm_SOURCES = win_shared_create.c
win_shared_create_no_allocshm_SOURCES = win_shared_create.c
win_shared_create_allocshm_CPPFLAGS = -DUSE_INFO_ALLOC_SHM $(AM_CPPFLAGS)
+
+put_flush_get_SOURCES = wrma_flush_get.c
+acc_flush_get_SOURCES = wrma_flush_get.c
+gacc_flush_get_SOURCES = wrma_flush_get.c
+fop_flush_get_SOURCES = wrma_flush_get.c
+cas_flush_get_SOURCES = wrma_flush_get.c
+
+put_flush_get_CPPFLAGS = -DTEST_PUT $(AM_CPPFLAGS)
+acc_flush_get_CPPFLAGS = -DTEST_ACC $(AM_CPPFLAGS)
+gacc_flush_get_CPPFLAGS = -DTEST_GACC $(AM_CPPFLAGS)
+fop_flush_get_CPPFLAGS = -DTEST_FOP $(AM_CPPFLAGS)
+cas_flush_get_CPPFLAGS = -DTEST_CAS $(AM_CPPFLAGS)
+
+win_shared_put_flush_load_SOURCES = win_shared_rma_flush_load.c
+win_shared_acc_flush_load_SOURCES = win_shared_rma_flush_load.c
+win_shared_gacc_flush_load_SOURCES = win_shared_rma_flush_load.c
+win_shared_fop_flush_load_SOURCES = win_shared_rma_flush_load.c
+win_shared_cas_flush_load_SOURCES = win_shared_rma_flush_load.c
+
+win_shared_put_flush_load_CPPFLAGS = -DTEST_PUT $(AM_CPPFLAGS)
+win_shared_acc_flush_load_CPPFLAGS = -DTEST_ACC $(AM_CPPFLAGS)
+win_shared_gacc_flush_load_CPPFLAGS = -DTEST_GACC $(AM_CPPFLAGS)
+win_shared_fop_flush_load_CPPFLAGS = -DTEST_FOP $(AM_CPPFLAGS)
+win_shared_cas_flush_load_CPPFLAGS = -DTEST_CAS $(AM_CPPFLAGS)
\ No newline at end of file
diff --git a/test/mpi/rma/testlist.in b/test/mpi/rma/testlist.in
index 42766cc..e2e3a4a 100644
--- a/test/mpi/rma/testlist.in
+++ b/test/mpi/rma/testlist.in
@@ -147,6 +147,16 @@ manyget 2
derived-acc-flush_local 3 mpiversion=3.0
large-acc-flush_local 3 mpiversion=3.0
large-small-acc 2
+win_shared_put_flush_load 3 mpiversion=3.0
+win_shared_acc_flush_load 3 mpiversion=3.0
+win_shared_gacc_flush_load 3 mpiversion=3.0
+win_shared_fop_flush_load 3 mpiversion=3.0
+win_shared_cas_flush_load 3 mpiversion=3.0
+put_flush_get 3 mpiversion=3.0
+acc_flush_get 3 mpiversion=3.0
+gacc_flush_get 3 mpiversion=3.0
+fop_flush_get 3 mpiversion=3.0
+cas_flush_get 3 mpiversion=3.0
## This test is not strictly correct. This was meant to test out the
## case when MPI_Test is not nonblocking. However, we ended up
diff --git a/test/mpi/rma/win_shared_rma_flush_load.c b/test/mpi/rma/win_shared_rma_flush_load.c
new file mode 100644
index 0000000..9edf270
--- /dev/null
+++ b/test/mpi/rma/win_shared_rma_flush_load.c
@@ -0,0 +1,296 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *
+ * (C) 2015 by Argonne National Laboratory.
+ * See COPYRIGHT in top-level directory.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <mpi.h>
+#include "mpitest.h"
+
+#define ITER 10000
+#define BUF_CNT 1
+int local_buf[BUF_CNT], result_addr[BUF_CNT];
+
+const int verbose = 0;
+
+/* This test checks the remote completion of flush with RMA write-like operations
+ * (PUT, ACC, GET_ACC, FOP, CAS), and confirms result by shm load.
+ * 1. P(target) and P(checker) allocate a shared window, and
+ * then create a global window with P(origin) by using the shared window buffer.
+ * 2. P(origin) issues RMA operations and flush to P(target) through the global
+ * window and then call send-recv to synchronize with P(checker).
+ * 3. P(checker) then checks the result through shm window by local load. */
+
+int rank = -1, nproc = 0;
+int origin = -1, target = -1, checker = -1;
+MPI_Win win = MPI_WIN_NULL, shm_win = MPI_WIN_NULL;
+int *shm_target_base = NULL, *my_base = NULL;
+
+/* Define operation name for error message */
+#ifdef TEST_PUT
+const char *rma_name = "Put";
+#elif defined(TEST_ACC)
+const char *rma_name = "Accumulate";
+#elif defined(TEST_GACC)
+const char *rma_name = "Get_accumulate";
+#elif defined(TEST_FOP)
+const char *rma_name = "Fetch_and_op";
+#elif defined(TEST_CAS)
+const char *rma_name = "Compare_and_swap";
+#else
+const char *rma_name = "None";
+#endif
+
+/* Issue functions for different RMA operations */
+#ifdef TEST_PUT
+static inline void issue_rma_op(int i)
+{
+ MPI_Put(&local_buf[i], 1, MPI_INT, target, i, 1, MPI_INT, win);
+}
+#elif defined(TEST_ACC)
+static inline void issue_rma_op(int i)
+{
+ MPI_Accumulate(&local_buf[i], 1, MPI_INT, target, i, 1, MPI_INT, MPI_REPLACE, win);
+}
+#elif defined(TEST_GACC)
+static inline void issue_rma_op(int i)
+{
+ MPI_Get_accumulate(&local_buf[i], 1, MPI_INT, &result_addr[i], 1, MPI_INT, target, i,
+ 1, MPI_INT, MPI_REPLACE, win);
+}
+#elif defined(TEST_FOP)
+static inline void issue_rma_op(int i)
+{
+ MPI_Fetch_and_op(&local_buf[i], &result_addr[i], MPI_INT, target, i, MPI_REPLACE, win);
+}
+#elif defined(TEST_CAS)
+static inline void issue_rma_op(int i)
+{
+ int compare_val = i; /* always equal to window value, thus swap happens */
+ MPI_Compare_and_swap(&local_buf[i], &compare_val, &result_addr[i], MPI_INT, target, i, win);
+}
+#endif
+
+
+/* Local check function for GET-like operations */
+#if defined(TEST_GACC) || defined(TEST_FOP) || defined(TEST_CAS)
+
+/* Check local result buffer for GET-like operations */
+static int check_local_result(int iter)
+{
+ int i = 0;
+ int errors = 0;
+
+ for (i = 0; i < BUF_CNT; i++) {
+ if (result_addr[i] != i) {
+ printf("rank %d (iter %d) - check %s, got result_addr[%d] = %d, expected %d\n",
+ rank, iter, rma_name, i, result_addr[i], i);
+ errors++;
+ }
+ }
+ return errors;
+}
+
+#else
+#define check_local_result(iter) (0)
+#endif
+
+static int run_test()
+{
+ int i = 0, x = 0;
+ int errors = 0;
+ int sbuf = 0, rbuf = 0;
+ MPI_Status stat;
+
+ for (x = 0; x < ITER; x++) {
+ /* 1. Target resets window data */
+ if (rank == target) {
+ for (i = 0; i < BUF_CNT; i++)
+ my_base[i] = i;
+ MPI_Win_sync(shm_win); /* write is done on shm window */
+ }
+
+ MPI_Barrier(MPI_COMM_WORLD);
+
+ /* 2. Every one resets local data */
+ for (i = 0; i < BUF_CNT; i++) {
+ local_buf[i] = BUF_CNT + x * BUF_CNT + i;
+ result_addr[i] = 0;
+ }
+
+ /* 3. Origin issues RMA operation to target */
+ if (rank == origin) {
+ /* 3-1. Issue RMA. */
+ for (i = 0; i < BUF_CNT; i++) {
+ issue_rma_op(i);
+ }
+ MPI_Win_flush(target, win);
+
+ /* 3-2. Check local result buffer. */
+ errors += check_local_result(x);
+
+ /* sync with checker */
+ MPI_Send(&sbuf, 1, MPI_INT, checker, 999, MPI_COMM_WORLD);
+ }
+
+ /* 4. Checker confirms result on target */
+ if (rank == checker) {
+ /* sync with origin */
+ MPI_Recv(&rbuf, 1, MPI_INT, origin, 999, MPI_COMM_WORLD, &stat);
+
+ MPI_Win_sync(shm_win);
+
+ for (i = 0; i < BUF_CNT; i++) {
+ if (shm_target_base[i] != local_buf[i]) {
+ printf("rank %d (iter %d) - check %s, got shm_target_base[%d] = %d, "
+ "expected %d\n", rank, x, rma_name, i, shm_target_base[i], local_buf[i]);
+ errors++;
+ }
+ }
+ }
+
+ MPI_Barrier(MPI_COMM_WORLD);
+ }
+
+ return errors;
+}
+
+int main(int argc, char *argv[])
+{
+ int i;
+ int errors = 0, all_errors = 0;
+ MPI_Comm shm_comm = MPI_COMM_NULL;
+ int shm_rank;
+ int *shm_ranks = NULL, *shm_root_ranks = NULL;
+ int win_size = sizeof(int) * BUF_CNT;
+ int win_unit = sizeof(int);
+ int shm_root_rank = -1, shm_target = -1, target_shm_root = -1;
+
+ MPI_Init(&argc, &argv);
+ MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &nproc);
+
+ if (nproc != 3) {
+ if (rank == 0)
+ printf("Error: must be run with three processes\n");
+ MPI_Barrier(MPI_COMM_WORLD);
+ MPI_Abort(MPI_COMM_WORLD, 1);
+ }
+
+#if !defined(TEST_PUT) && !defined(TEST_ACC) && !defined(TEST_GACC) && !defined(TEST_FOP) && !defined(TEST_CAS)
+ if (rank == 0)
+ printf("Error: must specify operation type at compile time\n");
+ MPI_Barrier(MPI_COMM_WORLD);
+ MPI_Abort(MPI_COMM_WORLD, 1);
+#endif
+
+ MPI_Comm_split_type(MPI_COMM_WORLD, MPI_COMM_TYPE_SHARED, rank, MPI_INFO_NULL, &shm_comm);
+ MPI_Comm_rank(shm_comm, &shm_rank);
+
+ shm_ranks = (int *) calloc(nproc, sizeof(int));
+ shm_root_ranks = (int *) calloc(nproc, sizeof(int));
+
+ /* Identify node id */
+ if (shm_rank == 0)
+ shm_root_rank = rank;
+ MPI_Bcast(&shm_root_rank, 1, MPI_INT, 0, shm_comm);
+
+ /* Exchange local root rank and local rank */
+ shm_ranks[rank] = shm_rank;
+ shm_root_ranks[rank] = shm_root_rank;
+
+ MPI_Allgather(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, shm_ranks, 1, MPI_INT, MPI_COMM_WORLD);
+ MPI_Allgather(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, shm_root_ranks, 1, MPI_INT, MPI_COMM_WORLD);
+
+ /* Check if there are at least two processes in shared memory. */
+ for (i = 0; i < nproc; i++) {
+ if (shm_ranks[i] != 0) {
+ target_shm_root = shm_root_ranks[i];
+ break;
+ }
+ }
+
+ /* Every process is in separate memory, we cannot create shared window. Just return. */
+ if (target_shm_root < 0)
+ goto exit;
+
+ /* Identify origin, target and checker ranks.
+ * the first process in shared memory is target, and the second one is checker;
+ * the last process is origin.*/
+ shm_target = 0;
+ for (i = 0; i < nproc; i++) {
+ if (shm_root_ranks[i] == target_shm_root) {
+ if (shm_ranks[i] == 0) {
+ target = i;
+ }
+ else if (shm_ranks[i] == 1) {
+ checker = i;
+ }
+ else {
+ /* all three processes are in shared memory, origin is the third one. */
+ origin = i;
+ }
+ }
+ else {
+ /* origin is in separate memory. */
+ origin = i;
+ }
+ }
+
+ if (verbose) {
+ printf("---- rank %d: origin = %d, checker = %d, target = %d, test %s\n",
+ rank, origin, checker, target, rma_name);
+ }
+
+ /* Allocate shared memory among local processes, then create a global window
+ * with the shared window buffers. */
+ MPI_Win_allocate_shared(win_size, win_unit, MPI_INFO_NULL, shm_comm, &my_base, &shm_win);
+ MPI_Win_create(my_base, win_size, win_unit, MPI_INFO_NULL, MPI_COMM_WORLD, &win);
+
+ /* Get address of target window on checker process. */
+ if (rank == checker) {
+ MPI_Aint size;
+ int disp_unit;
+ MPI_Win_shared_query(shm_win, shm_target, &size, &disp_unit, &shm_target_base);
+ if (verbose) {
+ printf("---- I am checker = %d, shm_target_base=%p\n", checker, shm_target_base);
+ }
+ }
+
+ /* Start checking. */
+ MPI_Win_lock_all(0, win);
+ MPI_Win_lock_all(0, shm_win);
+
+ errors = run_test();
+
+ MPI_Win_unlock_all(shm_win);
+ MPI_Win_unlock_all(win);
+
+ MPI_Reduce(&errors, &all_errors, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
+
+ exit:
+
+ if (rank == 0 && all_errors == 0)
+ printf(" No Errors\n");
+
+ if (shm_ranks)
+ free(shm_ranks);
+ if (shm_root_ranks)
+ free(shm_root_ranks);
+
+ if (shm_win != MPI_WIN_NULL)
+ MPI_Win_free(&shm_win);
+
+ if (win != MPI_WIN_NULL)
+ MPI_Win_free(&win);
+
+ if (shm_comm != MPI_COMM_NULL)
+ MPI_Comm_free(&shm_comm);
+
+ MPI_Finalize();
+
+ return 0;
+}
diff --git a/test/mpi/rma/wrma_flush_get.c b/test/mpi/rma/wrma_flush_get.c
new file mode 100644
index 0000000..c0b0fc2
--- /dev/null
+++ b/test/mpi/rma/wrma_flush_get.c
@@ -0,0 +1,212 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *
+ * (C) 2015 by Argonne National Laboratory.
+ * See COPYRIGHT in top-level directory.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <mpi.h>
+#include "mpitest.h"
+
+#define ITER 10000
+#define BUF_CNT 1
+int local_buf[BUF_CNT], result_addr[BUF_CNT], check_addr[BUF_CNT];
+
+const int verbose = 0;
+
+/* This test checks the remote completion of flush with RMA write-like operations
+ * (PUT, ACC, GET_ACC, FOP, CAS), and confirms result by GET issued from another
+ * process.
+ * 1. Three processes create window by Win_allocate.
+ * 2. P(origin) issues RMA operations and flush to P(target), then call
+ * send-recv to synchronize with P(checker).
+ * 3. P(checker) then issues get to P(target) to check the results.
+ */
+
+int rank = -1, nproc = 0;
+int origin = -1, target = -1, checker = -1;
+MPI_Win win = MPI_WIN_NULL;
+int *my_base = NULL;
+
+/* Define operation name for error message */
+#ifdef TEST_PUT
+const char *rma_name = "Put";
+#elif defined(TEST_ACC)
+const char *rma_name = "Accumulate";
+#elif defined(TEST_GACC)
+const char *rma_name = "Get_accumulate";
+#elif defined(TEST_FOP)
+const char *rma_name = "Fetch_and_op";
+#elif defined(TEST_CAS)
+const char *rma_name = "Compare_and_swap";
+#else
+const char *rma_name = "None";
+#endif
+
+/* Issue functions for different RMA operations */
+#ifdef TEST_PUT
+static inline void issue_rma_op(int i)
+{
+ MPI_Put(&local_buf[i], 1, MPI_INT, target, i, 1, MPI_INT, win);
+}
+#elif defined(TEST_ACC)
+static inline void issue_rma_op(int i)
+{
+ MPI_Accumulate(&local_buf[i], 1, MPI_INT, target, i, 1, MPI_INT, MPI_REPLACE, win);
+}
+#elif defined(TEST_GACC)
+static inline void issue_rma_op(int i)
+{
+ MPI_Get_accumulate(&local_buf[i], 1, MPI_INT, &result_addr[i], 1, MPI_INT, target, i,
+ 1, MPI_INT, MPI_REPLACE, win);
+}
+#elif defined(TEST_FOP)
+static inline void issue_rma_op(int i)
+{
+ MPI_Fetch_and_op(&local_buf[i], &result_addr[i], MPI_INT, target, i, MPI_REPLACE, win);
+}
+#elif defined(TEST_CAS)
+static inline void issue_rma_op(int i)
+{
+ int compare_val = i; /* always equal to window value, thus swap happens */
+ MPI_Compare_and_swap(&local_buf[i], &compare_val, &result_addr[i], MPI_INT, target, i, win);
+}
+#endif
+
+
+/* Local check function for GET-like operations */
+#if defined(TEST_GACC) || defined(TEST_FOP) || defined(TEST_CAS)
+
+/* Check local result buffer for GET-like operations */
+static int check_local_result(int iter)
+{
+ int i = 0;
+ int errors = 0;
+
+ for (i = 0; i < BUF_CNT; i++) {
+ if (result_addr[i] != i) {
+ printf("rank %d (iter %d) - check %s, got result_addr[%d] = %d, expected %d\n",
+ rank, iter, rma_name, i, result_addr[i], i);
+ errors++;
+ }
+ }
+ return errors;
+}
+
+#else
+#define check_local_result(iter) (0)
+#endif
+
+static int run_test()
+{
+ int i = 0, x = 0;
+ int errors = 0;
+ int sbuf = 0, rbuf = 0;
+ MPI_Status stat;
+
+ for (x = 0; x < ITER; x++) {
+ /* 1. Target resets window data */
+ if (rank == target) {
+ for (i = 0; i < BUF_CNT; i++)
+ my_base[i] = i;
+ MPI_Win_sync(win); /* write is done on window */
+ }
+
+ MPI_Barrier(MPI_COMM_WORLD);
+
+ /* 2. Every one resets local data */
+ for (i = 0; i < BUF_CNT; i++) {
+ local_buf[i] = BUF_CNT + x * BUF_CNT + i;
+ result_addr[i] = 0;
+ }
+
+ /* 3. Origin issues RMA operation to target */
+ if (rank == origin) {
+ /* 3-1. Issue RMA. */
+ for (i = 0; i < BUF_CNT; i++) {
+ issue_rma_op(i);
+ }
+ MPI_Win_flush(target, win);
+
+ /* 3-2. Sync with checker */
+ MPI_Send(&sbuf, 1, MPI_INT, checker, 999, MPI_COMM_WORLD);
+
+ /* 3-3. Check local result buffer */
+ errors += check_local_result(x);
+ }
+
+ /* 4. Checker issues GET to target and checks result */
+ if (rank == checker) {
+ /* 4-1. Sync with origin */
+ MPI_Recv(&rbuf, 1, MPI_INT, origin, 999, MPI_COMM_WORLD, &stat);
+
+ /* 4-2. Get result and check */
+ MPI_Get(check_addr, BUF_CNT, MPI_INT, target, 0, BUF_CNT, MPI_INT, win);
+ MPI_Win_flush(target, win);
+
+ for (i = 0; i < BUF_CNT; i++) {
+ if (check_addr[i] != local_buf[i]) {
+ printf("rank %d (iter %d) - check %s, got check_addr[%d] = %d, expected %d\n",
+ rank, x, rma_name, i, check_addr[i], local_buf[i]);
+ errors++;
+ }
+ }
+ }
+
+ MPI_Barrier(MPI_COMM_WORLD);
+ }
+
+ return errors;
+}
+
+int main(int argc, char *argv[])
+{
+ int errors = 0, all_errors = 0;
+ int win_size = sizeof(int) * BUF_CNT;
+ int win_unit = sizeof(int);
+
+ MPI_Init(&argc, &argv);
+ MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &nproc);
+
+ if (nproc != 3) {
+ if (rank == 0)
+ printf("Error: must be run with three processes\n");
+ MPI_Barrier(MPI_COMM_WORLD);
+ MPI_Abort(MPI_COMM_WORLD, 1);
+ }
+
+#if !defined(TEST_PUT) && !defined(TEST_ACC) && !defined(TEST_GACC) && !defined(TEST_FOP) && !defined(TEST_CAS)
+ if (rank == 0)
+ printf("Error: must specify operation type at compile time\n");
+ MPI_Barrier(MPI_COMM_WORLD);
+ MPI_Abort(MPI_COMM_WORLD, 1);
+#endif
+
+ /* Identify origin, target and checker ranks. */
+ target = 0;
+ checker = 2;
+ origin = 1;
+
+ MPI_Win_allocate(win_size, win_unit, MPI_INFO_NULL, MPI_COMM_WORLD, &my_base, &win);
+
+ /* Start checking. */
+ MPI_Win_lock_all(0, win);
+
+ errors = run_test();
+
+ MPI_Win_unlock_all(win);
+
+ MPI_Reduce(&errors, &all_errors, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
+ if (rank == 0 && all_errors == 0)
+ printf(" No Errors\n");
+
+ if (win != MPI_WIN_NULL)
+ MPI_Win_free(&win);
+
+ MPI_Finalize();
+
+ return 0;
+}
http://git.mpich.org/mpich.git/commitdiff/f0a66babd3ffccdc976ace6f4e7cf7631bce4ce6
commit f0a66babd3ffccdc976ace6f4e7cf7631bce4ce6
Author: Min Si <msi at il.is.s.u-tokyo.ac.jp>
Date: Tue Jun 30 14:24:39 2015 -0500
Fixed bug in atomic read-modify-write FOP/GACC/CAS tests.
These tests did not open access epoch when checking window result, this
patch fixed it.
Signed-off-by: Xin Zhao <xinzhao3 at illinois.edu>
diff --git a/test/mpi/rma/atomic_rmw_cas.c b/test/mpi/rma/atomic_rmw_cas.c
index 7db1b53..31968ae 100644
--- a/test/mpi/rma/atomic_rmw_cas.c
+++ b/test/mpi/rma/atomic_rmw_cas.c
@@ -32,6 +32,7 @@ int main(int argc, char *argv[])
int origin_shm, origin_am, dest;
int *orig_buf = NULL, *result_buf = NULL, *compare_buf = NULL,
*target_buf = NULL, *check_buf = NULL;
+ int target_value = 0;
MPI_Win win;
MPI_Status status;
@@ -93,8 +94,12 @@ int main(int argc, char *argv[])
MPI_Gather(result_buf, 1, MPI_INT, check_buf, 1, MPI_INT, dest, MPI_COMM_WORLD);
}
else {
+ MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win);
+ target_value = target_buf[0];
+ MPI_Win_unlock(rank, win);
+
MPI_Alloc_mem(sizeof(int) * 3, MPI_INFO_NULL, &check_buf);
- MPI_Gather(target_buf, 1, MPI_INT, check_buf, 1, MPI_INT, dest, MPI_COMM_WORLD);
+ MPI_Gather(&target_value, 1, MPI_INT, check_buf, 1, MPI_INT, dest, MPI_COMM_WORLD);
if (!(check_buf[dest] == 0 && check_buf[origin_shm] == 0 && check_buf[origin_am] == 1)
&& !(check_buf[dest] == 1 && check_buf[origin_shm] == 0 &&
diff --git a/test/mpi/rma/atomic_rmw_fop.c b/test/mpi/rma/atomic_rmw_fop.c
index f30318c..42875f6 100644
--- a/test/mpi/rma/atomic_rmw_fop.c
+++ b/test/mpi/rma/atomic_rmw_fop.c
@@ -114,12 +114,14 @@ int main(int argc, char *argv[])
}
}
else {
+ MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win);
/* check results on P1 */
if (target_buf[0] != AM_BUF_SIZE + SHM_BUF_SIZE) {
printf("LOOP=%d, rank=%d, FOP, target_buf[0] = %d, expected %d. \n",
k, rank, target_buf[0], AM_BUF_SIZE + SHM_BUF_SIZE);
errors++;
}
+ MPI_Win_unlock(rank, win);
}
}
diff --git a/test/mpi/rma/atomic_rmw_gacc.c b/test/mpi/rma/atomic_rmw_gacc.c
index 5a59ec2..87f5c35 100644
--- a/test/mpi/rma/atomic_rmw_gacc.c
+++ b/test/mpi/rma/atomic_rmw_gacc.c
@@ -30,6 +30,7 @@
int rank, size;
int dest, origin_shm, origin_am;
int *orig_buf = NULL, *result_buf = NULL, *target_buf = NULL, *check_buf = NULL;
+MPI_Win win;
void checkResults(int loop_k, int *errors)
{
@@ -63,6 +64,7 @@ void checkResults(int loop_k, int *errors)
}
}
else {
+ MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win);
/* check results on P1 */
for (i = 0; i < OP_COUNT; i++) {
if (target_buf[i] != AM_BUF_NUM + SHM_BUF_NUM) {
@@ -71,6 +73,7 @@ void checkResults(int loop_k, int *errors)
(*errors)++;
}
}
+ MPI_Win_unlock(rank, win);
}
}
@@ -79,7 +82,6 @@ int main(int argc, char *argv[])
int i, j, k;
int errors = 0, all_errors = 0;
int my_buf_num;
- MPI_Win win;
MPI_Datatype origin_dtp, target_dtp;
MPI_Init(&argc, &argv);
-----------------------------------------------------------------------
Summary of changes:
test/mpi/rma/Makefile.am | 36 ++++-
test/mpi/rma/atomic_rmw_cas.c | 7 +-
test/mpi/rma/atomic_rmw_fop.c | 2 +
test/mpi/rma/atomic_rmw_gacc.c | 4 +-
test/mpi/rma/testlist.in | 10 +
test/mpi/rma/win_shared_rma_flush_load.c | 296 ++++++++++++++++++++++++++++++
test/mpi/rma/wrma_flush_get.c | 212 +++++++++++++++++++++
7 files changed, 564 insertions(+), 3 deletions(-)
create mode 100644 test/mpi/rma/win_shared_rma_flush_load.c
create mode 100644 test/mpi/rma/wrma_flush_get.c
hooks/post-receive
--
MPICH primary repository
More information about the commits
mailing list