commits
Threads by month
- ----- 2026 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
September 2014
- 1 participants
- 37 discussions
[mpich] MPICH primary repository branch, master, updated. v3.2a1-16-g09930cc
by noreply@mpich.org 20 Sep '14
by noreply@mpich.org 20 Sep '14
20 Sep '14
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 09930cc20a8532a2cfd9f7e022787bf40af8286f (commit)
from 9eacce005f347eeaba824f143a00974aafc0d27d (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/09930cc20a8532a2cfd9f7e022787bf40…
commit 09930cc20a8532a2cfd9f7e022787bf40af8286f
Author: Igor Ivanov <Igor.Ivanov(a)itseez.com>
Date: Fri Sep 12 16:11:50 2014 +0300
netmod/mxm: Change supported MXM version to 3.1+
- Changed MXM version that is supported to 3.1+
- Added additional debug output for iov
- Added check for datatype mismatch during noncontiguous data
Signed-off-by: Igor Ivanov <Igor.Ivanov(a)itseez.com>
diff --git a/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_cancel.c b/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_cancel.c
index 2de472d..202d149 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_cancel.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_cancel.c
@@ -50,7 +50,7 @@ int MPID_nem_mxm_cancel_send(MPIDI_VC_t * vc, MPID_Request * req)
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPID_nem_mxm_cancel_recv(MPIDI_VC_t * vc, MPID_Request * req)
{
- int mpi_errno = MPI_SUCCESS;
+ int mpi_errno ATTRIBUTE((unused)) = MPI_SUCCESS;
mxm_error_t ret = MXM_OK;
MPID_nem_mxm_req_area *req_area = REQ_BASE(req);
diff --git a/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_impl.h b/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_impl.h
index 6d3b9b2..bd80a69 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_impl.h
+++ b/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_impl.h
@@ -149,7 +149,7 @@ typedef struct {
} MPID_nem_mxm_vc_area;
/* macro for mxm private in VC */
-#define VC_BASE(vcp) ((MPID_nem_mxm_vc_area *)((vcp)->ch.netmod_area.padding))
+#define VC_BASE(vcp) ((vcp) ? (MPID_nem_mxm_vc_area *)((vcp)->ch.netmod_area.padding) : NULL)
/* The req provides a generic buffer in which network modules can store
private fields This removes all dependencies from the req structure
@@ -172,7 +172,7 @@ typedef struct {
} MPID_nem_mxm_req_area;
/* macro for mxm private in REQ */
-#define REQ_BASE(reqp) ((MPID_nem_mxm_req_area *)((reqp)->ch.netmod_area.padding))
+#define REQ_BASE(reqp) ((reqp) ? (MPID_nem_mxm_req_area *)((reqp)->ch.netmod_area.padding) : NULL)
typedef struct MPID_nem_mxm_module_t {
char *runtime_version;
@@ -212,7 +212,7 @@ static inline void list_grow_mxm_req(list_head_t * list_head)
static inline void _mxm_barrier(void)
{
- int pmi_errno;
+ int pmi_errno ATTRIBUTE((unused));
#ifdef USE_PMI2_API
pmi_errno = PMI2_KVS_Fence();
diff --git a/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_poll.c b/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_poll.c
index 87259f3..0defcbb 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_poll.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_poll.c
@@ -162,18 +162,22 @@ int MPID_nem_mxm_recv(MPIDI_VC_t * vc, MPID_Request * rreq)
int dt_contig;
MPI_Aint dt_true_lb;
MPID_Datatype *dt_ptr;
- MPID_nem_mxm_vc_area *vc_area = VC_BASE(vc);
- MPID_nem_mxm_req_area *req_area = REQ_BASE(rreq);
+ MPID_nem_mxm_vc_area *vc_area = NULL;
+ MPID_nem_mxm_req_area *req_area = NULL;
MPIDI_Datatype_get_info(rreq->dev.user_count, rreq->dev.datatype, dt_contig, data_sz,
dt_ptr, dt_true_lb);
rreq->dev.OnDataAvail = NULL;
rreq->dev.tmpbuf = NULL;
rreq->ch.vc = vc;
+ rreq->ch.noncontig = FALSE;
_dbg_mxm_output(5,
"Recv ========> Getting USER msg for req %p (context %d rank %d tag %d size %d) \n",
- rreq, context_id, source, tag, data_sz);
+ rreq, context_id, rreq->dev.match.parts.rank, tag, data_sz);
+
+ vc_area = VC_BASE(vc);
+ req_area = REQ_BASE(rreq);
req_area->ctx = rreq;
req_area->iov_buf = req_area->tmp_buf;
@@ -187,6 +191,7 @@ int MPID_nem_mxm_recv(MPIDI_VC_t * vc, MPID_Request * rreq)
req_area->iov_buf[0].length = data_sz;
}
else {
+ rreq->ch.noncontig = TRUE;
mpi_errno = _mxm_process_rdtype(&rreq, rreq->dev.datatype, dt_ptr, data_sz,
rreq->dev.user_buf, rreq->dev.user_count,
&req_area->iov_buf, &req_area->iov_count);
@@ -194,7 +199,7 @@ int MPID_nem_mxm_recv(MPIDI_VC_t * vc, MPID_Request * rreq)
MPIU_ERR_POP(mpi_errno);
}
- mpi_errno = _mxm_irecv((vc ? vc_area->mxm_ep : NULL), req_area,
+ mpi_errno = _mxm_irecv((vc_area ? vc_area->mxm_ep : NULL), req_area,
tag,
(rreq->comm ? (mxm_mq_h) rreq->comm->dev.ch.netmod_priv : mxm_obj->
mxm_mq), _mxm_tag_mpi2mxm(tag, context_id));
@@ -217,17 +222,18 @@ static int _mxm_handle_rreq(MPID_Request * req)
{
int complete = FALSE;
int dt_contig;
- MPI_Aint dt_true_lb;
+ MPI_Aint dt_true_lb ATTRIBUTE((unused));
MPIDI_msg_sz_t userbuf_sz;
MPID_Datatype *dt_ptr;
MPIDI_msg_sz_t data_sz;
MPIDI_VC_t *vc = NULL;
- MPID_nem_mxm_vc_area *vc_area = NULL;
- MPID_nem_mxm_req_area *req_area = NULL
+ MPID_nem_mxm_vc_area *vc_area ATTRIBUTE((unused)) = NULL;
+ MPID_nem_mxm_req_area *req_area = NULL;
+ void *tmp_buf = NULL;
MPIU_THREAD_CS_ENTER(MSGQUEUE, req);
- complete = MPIDI_CH3U_Recvq_DP(req)
- MPIU_THREAD_CS_EXIT(MSGQUEUE, req);
+ complete = MPIDI_CH3U_Recvq_DP(req);
+ MPIU_THREAD_CS_EXIT(MSGQUEUE, req);
if (!complete) {
return TRUE;
}
@@ -270,29 +276,60 @@ static int _mxm_handle_rreq(MPID_Request * req)
req->dev.recv_data_sz, userbuf_sz);
}
- if ((!dt_contig) && (req->dev.tmpbuf != NULL)) {
- MPIDI_msg_sz_t last;
+ if (!dt_contig) {
+ MPIDI_msg_sz_t last = 0;
- last = req->dev.recv_data_sz;
- MPID_Segment_unpack(req->dev.segment_ptr, 0, &last, req->dev.tmpbuf);
- MPIU_Free(req->dev.tmpbuf);
+ if (req->dev.tmpbuf != NULL) {
+ last = req->dev.recv_data_sz;
+ MPID_Segment_unpack(req->dev.segment_ptr, 0, &last, req->dev.tmpbuf);
+ tmp_buf = req->dev.tmpbuf;
+ }
+ else {
+ mxm_req_buffer_t * iov_buf;
+ MPID_IOV *iov;
+ int n_iov = 0;
+ int index;
+
+ last = req->dev.recv_data_sz;
+ n_iov = req_area->iov_count;
+ iov_buf = req_area->iov_buf;
+ if (last && n_iov > 0) {
+ iov = MPIU_Malloc(n_iov * sizeof(*iov));
+ MPIU_Assert(iov);
+
+ n_iov = req_area->iov_count;
+ iov_buf = req_area->iov_buf;
+ for (index = 0; index < n_iov; index++) {
+ iov[index].MPID_IOV_BUF = iov_buf[index].ptr;
+ iov[index].MPID_IOV_LEN = iov_buf[index].length;
+ }
+
+ MPID_Segment_unpack_vector(req->dev.segment_ptr, req->dev.segment_first, &last, iov, &n_iov);
+ MPIU_Free(iov);
+ }
+ if (req_area->iov_count > MXM_MPICH_MAX_IOV) {
+ tmp_buf = req_area->iov_buf;
+ req_area->iov_buf = req_area->tmp_buf;
+ req_area->iov_count = 0;
+ }
+ }
if (last != data_sz) {
MPIR_STATUS_SET_COUNT(req->status, last);
if (req->dev.recv_data_sz <= userbuf_sz) {
+ /* If the data can't be unpacked, the we have a
+ * mismatch between the datatype and the amount of
+ * data received. Throw away received data.
+ */
MPIU_ERR_SETSIMPLE(req->status.MPI_ERROR, MPI_ERR_TYPE, "**dtypemismatch");
}
}
}
- if (req_area->iov_count > MXM_MPICH_MAX_IOV) {
- MPIU_Free(req_area->iov_buf);
- req_area->iov_buf = req_area->tmp_buf;
- req_area->iov_count = 0;
- }
-
MPIDI_CH3U_Handle_recv_req(vc, req, &complete);
MPIU_Assert(complete == TRUE);
+ if (tmp_buf) MPIU_Free(tmp_buf);
+
return complete;
}
@@ -422,6 +459,14 @@ static int _mxm_process_rdtype(MPID_Request ** rreq_p, MPI_Datatype datatype,
MPID_Segment_unpack_vector(rreq->dev.segment_ptr, rreq->dev.segment_first, &last, iov, &n_iov);
MPIU_Assert(last == rreq->dev.segment_size);
+#if defined(MXM_DEBUG) && (MXM_DEBUG > 0)
+ _dbg_mxm_output(7, "Recv Noncontiguous data vector %i entries (free slots : %i)\n", n_iov, MXM_REQ_DATA_MAX_IOV);
+ for(index = 0; index < n_iov; index++) {
+ _dbg_mxm_output(7, "======= Recv iov[%i] = ptr : %p, len : %i \n",
+ index, iov[index].MPID_IOV_BUF, iov[index].MPID_IOV_LEN);
+ }
+#endif
+
if (n_iov <= MXM_REQ_DATA_MAX_IOV) {
if (n_iov > MXM_MPICH_MAX_IOV) {
*iov_buf = (mxm_req_buffer_t *) MPIU_Malloc(n_iov * sizeof(**iov_buf));
diff --git a/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_send.c b/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_send.c
index 701ed35..f91edf3 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_send.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_send.c
@@ -577,6 +577,7 @@ int MPID_nem_mxm_issend(MPIDI_VC_t * vc, const void *buf, int count, MPI_Datatyp
MPIDI_msg_sz_t last;
MPI_Aint packsize = 0;
+ sreq->ch.noncontig = TRUE;
sreq->dev.segment_ptr = MPID_Segment_alloc();
MPIU_ERR_CHKANDJUMP1((sreq->dev.segment_ptr == NULL), mpi_errno, MPI_ERR_OTHER,
"**nomem", "**nomem %s", "MPID_Segment_alloc");
@@ -593,7 +594,6 @@ int MPID_nem_mxm_issend(MPIDI_VC_t * vc, const void *buf, int count, MPI_Datatyp
req_area->iov_buf[0].ptr = sreq->dev.tmpbuf;
req_area->iov_buf[0].length = last;
}
- sreq->ch.noncontig = TRUE;
}
}
@@ -796,6 +796,14 @@ static int _mxm_process_sdtype(MPID_Request ** sreq_p, MPI_Datatype datatype,
MPID_Segment_pack_vector(sreq->dev.segment_ptr, sreq->dev.segment_first, &last, iov, &n_iov);
MPIU_Assert(last == sreq->dev.segment_size);
+#if defined(MXM_DEBUG) && (MXM_DEBUG > 0)
+ _dbg_mxm_output(7, "Send Noncontiguous data vector %i entries (free slots : %i)\n", n_iov, MXM_REQ_DATA_MAX_IOV);
+ for(index = 0; index < n_iov; index++) {
+ _dbg_mxm_output(7, "======= Recv iov[%i] = ptr : %p, len : %i \n",
+ index, iov[index].MPID_IOV_BUF, iov[index].MPID_IOV_LEN);
+ }
+#endif
+
if (n_iov > MXM_MPICH_MAX_IOV) {
*iov_buf = (mxm_req_buffer_t *) MPIU_Malloc(n_iov * sizeof(**iov_buf));
MPIU_Assert(*iov_buf);
diff --git a/src/mpid/ch3/channels/nemesis/netmod/mxm/subconfigure.m4 b/src/mpid/ch3/channels/nemesis/netmod/mxm/subconfigure.m4
index 28dcdd2..29f829a 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/mxm/subconfigure.m4
+++ b/src/mpid/ch3/channels/nemesis/netmod/mxm/subconfigure.m4
@@ -27,14 +27,14 @@ AM_COND_IF([BUILD_NEMESIS_NETMOD_MXM],[
#error "MXM Version is less than 1.5, please upgrade"
#endif
#
-#if MXM_API < MXM_VERSION(3,0)
-#error "MXM Version is less than 3.0, please upgrade"
+#if MXM_API < MXM_VERSION(3,1)
+#error "MXM Version is less than 3.1, please upgrade"
#endif],
[int a=0;],
mxm_api_version=yes,
mxm_api_version=no)
if test "$mxm_api_version" = no ; then
- AC_MSG_ERROR(['MXM API version Problem. Are you running a recent version of MXM (at least 3.0)?'])
+ AC_MSG_ERROR(['MXM API version Problem. Are you running a recent version of MXM (at least 3.1)?'])
fi;
AC_DEFINE([ENABLE_COMM_OVERRIDES], 1, [define to add per-vc function pointers to override send and recv functions])
PAC_APPEND_FLAG([-lmxm],[EXTERNAL_LIBS])
-----------------------------------------------------------------------
Summary of changes:
.../ch3/channels/nemesis/netmod/mxm/mxm_cancel.c | 2 +-
.../ch3/channels/nemesis/netmod/mxm/mxm_impl.h | 6 +-
.../ch3/channels/nemesis/netmod/mxm/mxm_poll.c | 85 +++++++++++++++-----
.../ch3/channels/nemesis/netmod/mxm/mxm_send.c | 10 ++-
.../channels/nemesis/netmod/mxm/subconfigure.m4 | 6 +-
5 files changed, 81 insertions(+), 28 deletions(-)
hooks/post-receive
--
MPICH primary repository
1
0
[mpich] MPICH primary repository branch, master, updated. v3.2a1-15-g9eacce0
by noreply@mpich.org 19 Sep '14
by noreply@mpich.org 19 Sep '14
19 Sep '14
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 9eacce005f347eeaba824f143a00974aafc0d27d (commit)
via 96ca97960ab8adb63ded829670f28dd845c17e13 (commit)
via 90096d60602d64efcdf440729aa0e104872ae18f (commit)
from 232c39024cf3af13568362b4ac6baba50b8d6068 (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/9eacce005f347eeaba824f143a00974aa…
commit 9eacce005f347eeaba824f143a00974aafc0d27d
Author: Xin Zhao <xinzhao3(a)illinois.edu>
Date: Tue Sep 16 11:00:43 2014 -0500
Enable SHM in PSCW tests.
Enable using MPI_Win_allocate, which by default turns
on SHM window, in PSCW tests, so that we can test PSCW
on SHM window.
Signed-off-by: Pavan Balaji <balaji(a)anl.gov>
diff --git a/test/mpi/rma/Makefile.am b/test/mpi/rma/Makefile.am
index ac88fdc..5975aea 100644
--- a/test/mpi/rma/Makefile.am
+++ b/test/mpi/rma/Makefile.am
@@ -17,7 +17,9 @@ noinst_PROGRAMS = \
ircpi \
test1 \
test2 \
+ test2_shm \
test3 \
+ test3_shm \
test4 \
test5 \
lockcontention \
@@ -30,9 +32,11 @@ noinst_PROGRAMS = \
put_bottom \
locknull \
wintest \
+ wintest_shm \
transpose1 \
transpose2 \
transpose3 \
+ transpose3_shm \
transpose4 \
transpose5 \
transpose6 \
@@ -53,7 +57,9 @@ noinst_PROGRAMS = \
contig_displ \
test1_am \
test2_am \
+ test2_am_shm \
test3_am \
+ test3_am_shm \
test4_am \
test5_am \
fetchandadd_am \
@@ -65,10 +71,12 @@ noinst_PROGRAMS = \
fkeyvalwin \
baseattrwin \
nullpscw \
+ nullpscw_shm \
rmanull \
rmazero \
mixedsync \
manyrma2 \
+ manyrma2_shm \
manyrma3 \
selfrma \
strided_acc_onelock \
@@ -118,6 +126,7 @@ noinst_PROGRAMS = \
req_example_shm \
win_info \
pscw_ordering \
+ pscw_ordering_shm \
mutex_bench \
mutex_bench_shared \
mutex_bench_shm \
@@ -173,6 +182,26 @@ get_accumulate_int_derived_SOURCES = get_accumulate.c
req_example_shm_CPPFLAGS = -DUSE_WIN_ALLOC_SHM $(AM_CPPFLAGS)
req_example_shm_SOURCES = req_example.c
+manyrma2_shm_CPPFLAGS = -DUSE_WIN_ALLOCATE $(AM_CPPFLAGS)
+wintest_shm_CPPFLAGS = -DUSE_WIN_ALLOCATE $(AM_CPPFLAGS)
+transpose3_shm_CPPFLAGS = -DUSE_WIN_ALLOCATE $(AM_CPPFLAGS)
+nullpscw_shm_CPPFLAGS = -DUSE_WIN_ALLOCATE $(AM_CPPFLAGS)
+pscw_ordering_shm_CPPFLAGS = -DUSE_WIN_ALLOCATE $(AM_CPPFLAGS)
+test2_shm_CPPFLAGS = -DUSE_WIN_ALLOCATE $(AM_CPPFLAGS)
+test2_am_shm_CPPFLAGS = -DUSE_WIN_ALLOCATE $(AM_CPPFLAGS)
+test3_shm_CPPFLAGS = -DUSE_WIN_ALLOCATE $(AM_CPPFLAGS)
+test3_am_shm_CPPFLAGS = -DUSE_WIN_ALLOCATE $(AM_CPPFLAGS)
+
+manyrma2_shm_SOURCES = manyrma2.c
+wintest_shm_SOURCES = wintest.c
+transpose3_shm_SOURCES = transpose3.c
+nullpscw_shm_SOURCES = nullpscw.c
+pscw_ordering_shm_SOURCES = pscw_ordering.c
+test2_shm_SOURCES = test2.c
+test2_am_shm_SOURCES = test2_am.c
+test3_shm_SOURCES = test3.c
+test3_am_shm_SOURCES = test3_am.c
+
mutex_bench_SOURCES = mutex_bench.c mcs-mutex.c mcs-mutex.h
mutex_bench_shared_CPPFLAGS = -DUSE_WIN_SHARED $(AM_CPPFLAGS)
mutex_bench_shared_SOURCES = mutex_bench.c mcs-mutex.c mcs-mutex.h
diff --git a/test/mpi/rma/manyrma2.c b/test/mpi/rma/manyrma2.c
index 571d29e..eb7f860 100644
--- a/test/mpi/rma/manyrma2.c
+++ b/test/mpi/rma/manyrma2.c
@@ -112,6 +112,14 @@ int main(int argc, char *argv[])
MPI_Group_free(&wgroup);
arraysize = maxSz * MAX_COUNT;
+#ifdef USE_WIN_ALLOCATE
+ MPI_Win_allocate(arraysize * sizeof(int), (int) sizeof(int), MPI_INFO_NULL,
+ MPI_COMM_WORLD, &arraybuffer, &win);
+ if (!arraybuffer) {
+ fprintf(stderr, "Unable to allocate %d words\n", arraysize);
+ MPI_Abort(MPI_COMM_WORLD, 1);
+ }
+#else
arraybuffer = (int *) malloc(arraysize * sizeof(int));
if (!arraybuffer) {
fprintf(stderr, "Unable to allocate %d words\n", arraysize);
@@ -120,6 +128,7 @@ int main(int argc, char *argv[])
MPI_Win_create(arraybuffer, arraysize * sizeof(int), (int) sizeof(int),
MPI_INFO_NULL, MPI_COMM_WORLD, &win);
+#endif
if (maxCount > MAX_COUNT) {
fprintf(stderr, "MaxCount must not exceed %d\n", MAX_COUNT);
@@ -212,6 +221,10 @@ int main(int argc, char *argv[])
MPI_Win_free(&win);
+#ifndef USE_WIN_ALLOCATE
+ free(arraybuffer);
+#endif
+
MPI_Group_free(&accessGroup);
MPI_Group_free(&exposureGroup);
diff --git a/test/mpi/rma/nullpscw.c b/test/mpi/rma/nullpscw.c
index c5b1342..38d9472 100644
--- a/test/mpi/rma/nullpscw.c
+++ b/test/mpi/rma/nullpscw.c
@@ -15,7 +15,12 @@ int main(int argc, char* argv[])
MTest_Init(&argc,&argv);
+#ifdef USE_WIN_ALLOCATE
+ char *baseptr;
+ MPI_Win_allocate(0, 1, MPI_INFO_NULL, MPI_COMM_WORLD, &baseptr, &win);
+#else
MPI_Win_create(NULL, 0, 1, MPI_INFO_NULL, MPI_COMM_WORLD, &win);
+#endif
MPI_Win_get_group(win, &group);
MPI_Win_post(group, 0, win);
diff --git a/test/mpi/rma/pscw_ordering.c b/test/mpi/rma/pscw_ordering.c
index 9cb1cee..caa15e6 100644
--- a/test/mpi/rma/pscw_ordering.c
+++ b/test/mpi/rma/pscw_ordering.c
@@ -59,13 +59,18 @@ int main(int argc, char **argv) {
/* Create the window */
+#ifdef USE_WIN_ALLOCATE
+ MPI_Win_allocate(nproc*sizeof(int), sizeof(int), MPI_INFO_NULL,
+ MPI_COMM_WORLD, &win_buf, &win);
+#else
MPI_Alloc_mem(nproc*sizeof(int), MPI_INFO_NULL, &win_buf);
-
- for (i = 0; i < nproc; i++)
- win_buf[i] = -1;
-
MPI_Win_create(win_buf, nproc*sizeof(int), sizeof(int), MPI_INFO_NULL,
MPI_COMM_WORLD, &win);
+#endif
+ MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win);
+ for (i = 0; i < nproc; i++)
+ win_buf[i] = -1;
+ MPI_Win_unlock(rank, win);
/* Perform PSCW communication: Odd/even matchup */
@@ -124,7 +129,9 @@ int main(int argc, char **argv) {
}
MPI_Win_free(&win);
+#ifndef USE_WIN_ALLOCATE
MPI_Free_mem(win_buf);
+#endif
MPI_Group_free(&world_group);
MPI_Group_free(&odd_group);
diff --git a/test/mpi/rma/test2.c b/test/mpi/rma/test2.c
index f4399ea..527c2d6 100644
--- a/test/mpi/rma/test2.c
+++ b/test/mpi/rma/test2.c
@@ -15,7 +15,7 @@
int main(int argc, char *argv[])
{
- int rank, destrank, nprocs, A[SIZE2], B[SIZE2], i;
+ int rank, destrank, nprocs, A[SIZE2], i;
MPI_Comm CommDeuce;
MPI_Group comm_group, group;
MPI_Win win;
@@ -37,8 +37,14 @@ int main(int argc, char *argv[])
MPI_Comm_group(CommDeuce, &comm_group);
if (rank == 0) {
+ int B[SIZE2];
for (i=0; i<SIZE2; i++) A[i] = B[i] = i;
+#ifdef USE_WIN_ALLOCATE
+ char *base_ptr;
+ MPI_Win_allocate(0, 1, MPI_INFO_NULL, CommDeuce, &base_ptr, &win);
+#else
MPI_Win_create(NULL, 0, 1, MPI_INFO_NULL, CommDeuce, &win);
+#endif
destrank = 1;
MPI_Group_incl(comm_group, 1, &destrank, &group);
MPI_Win_start(group, 0, win);
@@ -56,8 +62,17 @@ int main(int argc, char *argv[])
}
}
else if (rank == 1) {
- for (i=0; i<SIZE2; i++) B[i] = (-4)*i;
+#ifdef USE_WIN_ALLOCATE
+ int *B;
+ MPI_Win_allocate(SIZE2*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &B, &win);
+#else
+ int B[SIZE2];
MPI_Win_create(B, SIZE2*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &win);
+#endif
+ MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win);
+ for (i=0; i<SIZE2; i++) B[i] = (-4)*i;
+ MPI_Win_unlock(rank, win);
+
destrank = 0;
MPI_Group_incl(comm_group, 1, &destrank, &group);
MPI_Win_post(group, 0, win);
diff --git a/test/mpi/rma/test2_am.c b/test/mpi/rma/test2_am.c
index 53780d5..1d9c7d0 100644
--- a/test/mpi/rma/test2_am.c
+++ b/test/mpi/rma/test2_am.c
@@ -42,17 +42,23 @@ int main(int argc, char *argv[])
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);
- }
MPI_Comm_group(CommDeuce, &comm_group);
if (rank == 0) {
+ 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);
+ }
+
for (i=0; i<SIZE2; i++) A[i] = B[i] = i;
+#ifdef USE_WIN_ALLOCATE
+ char *base_ptr;
+ MPI_Win_allocate(0, 1, MPI_INFO_NULL, CommDeuce, &base_ptr, &win);
+#else
MPI_Win_create(NULL, 0, 1, MPI_INFO_NULL, CommDeuce, &win);
+#endif
destrank = 1;
MPI_Group_incl(comm_group, 1, &destrank, &group);
MPI_Win_start(group, 0, win);
@@ -68,10 +74,24 @@ int main(int argc, char *argv[])
SQUELCH( printf("Get Error: B[i] is %d, should be %d\n", B[i], (-4)*(i+SIZE1)); );
errs++;
}
+
+ MPI_Free_mem(B);
}
else if (rank == 1) {
- for (i=0; i<SIZE2; i++) B[i] = (-4)*i;
+#ifdef USE_WIN_ALLOCATE
+ MPI_Win_allocate(SIZE2*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &B, &win);
+#else
+ 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);
+ }
MPI_Win_create(B, SIZE2*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &win);
+#endif
+ MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win);
+ for (i=0; i<SIZE2; i++) B[i] = (-4)*i;
+ MPI_Win_unlock(rank, win);
+
destrank = 0;
MPI_Group_incl(comm_group, 1, &destrank, &group);
MPI_Win_post(group, 0, win);
@@ -83,13 +103,15 @@ int main(int argc, char *argv[])
errs++;
}
}
+#ifndef USE_WIN_ALLOCATE
+ MPI_Free_mem(B);
+#endif
}
MPI_Group_free(&group);
MPI_Group_free(&comm_group);
MPI_Win_free(&win);
MPI_Free_mem(A);
- MPI_Free_mem(B);
}
MPI_Comm_free(&CommDeuce);
diff --git a/test/mpi/rma/test3.c b/test/mpi/rma/test3.c
index 06dd53b..2a86c00 100644
--- a/test/mpi/rma/test3.c
+++ b/test/mpi/rma/test3.c
@@ -44,31 +44,51 @@ int main(int argc, char *argv[])
printf("Can't allocate memory in test program\n");
MPI_Abort(MPI_COMM_WORLD, 1);
}
- B = (int *) malloc(SIZE * sizeof(int));
- if (!B) {
- printf("Can't allocate memory in test program\n");
- MPI_Abort(MPI_COMM_WORLD, 1);
- }
MPI_Comm_group(CommDeuce, &comm_group);
if (rank == 0) {
+ B = (int *) malloc(SIZE * sizeof(int));
+ if (!B) {
+ printf("Can't allocate memory in test program\n");
+ MPI_Abort(MPI_COMM_WORLD, 1);
+ }
+
for (i=0; i<SIZE; i++) {
A[i] = i;
B[i] = SIZE + i;
}
+#ifdef USE_WIN_ALLOCATE
+ char *base_ptr;
+ MPI_Win_allocate(0, 1, MPI_INFO_NULL, CommDeuce, &base_ptr, &win);
+#else
MPI_Win_create(NULL, 0, 1, MPI_INFO_NULL, CommDeuce, &win);
+#endif
destrank = 1;
MPI_Group_incl(comm_group, 1, &destrank, &group);
MPI_Win_start(group, 0, win);
MPI_Put(A, SIZE, MPI_INT, 1, 0, SIZE, MPI_INT, win);
MPI_Win_complete(win);
MPI_Send(B, SIZE, MPI_INT, 1, 100, MPI_COMM_WORLD);
+
+ free(B);
}
else if (rank == 1) {
- for (i=0; i<SIZE; i++) A[i] = B[i] = (-4)*i;
+#ifdef USE_WIN_ALLOCATE
+ MPI_Win_allocate(SIZE*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &B, &win);
+#else
+ B = (int *) malloc(SIZE * sizeof(int));
+ if (!B) {
+ printf("Can't allocate memory in test program\n");
+ MPI_Abort(MPI_COMM_WORLD, 1);
+ }
MPI_Win_create(B, SIZE*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &win);
+#endif
+ MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win);
+ for (i=0; i<SIZE; i++) A[i] = B[i] = (-4)*i;
+ MPI_Win_unlock(rank, win);
+
destrank = 0;
MPI_Group_incl(comm_group, 1, &destrank, &group);
MPI_Win_post(group, 0, win);
@@ -85,13 +105,15 @@ int main(int argc, char *argv[])
errs++;
}
}
+#ifndef USE_WIN_ALLOCATE
+ free(B);
+#endif
}
MPI_Group_free(&group);
MPI_Group_free(&comm_group);
MPI_Win_free(&win);
free(A);
- free(B);
}
MPI_Comm_free(&CommDeuce);
MTest_Finalize(errs);
diff --git a/test/mpi/rma/test3_am.c b/test/mpi/rma/test3_am.c
index dc10c31..029dfc6 100644
--- a/test/mpi/rma/test3_am.c
+++ b/test/mpi/rma/test3_am.c
@@ -45,30 +45,50 @@ int main(int argc, char *argv[])
printf("Can't allocate memory in test program\n");
MPI_Abort(MPI_COMM_WORLD, 1);
}
- i = MPI_Alloc_mem(SIZE * sizeof(int), MPI_INFO_NULL, &B);
- if (i) {
- printf("Can't allocate memory in test program\n");
- MPI_Abort(MPI_COMM_WORLD, 1);
- }
MPI_Comm_group(CommDeuce, &comm_group);
if (rank == 0) {
+ i = MPI_Alloc_mem(SIZE * sizeof(int), MPI_INFO_NULL, &B);
+ if (i) {
+ printf("Can't allocate memory in test program\n");
+ MPI_Abort(MPI_COMM_WORLD, 1);
+ }
+
for (i=0; i<SIZE; i++) {
A[i] = i;
B[i] = SIZE + i;
}
+#ifdef USE_WIN_ALLOCATE
+ char *base_ptr;
+ MPI_Win_allocate(0, 1, MPI_INFO_NULL, CommDeuce, &base_ptr, &win);
+#else
MPI_Win_create(NULL, 0, 1, MPI_INFO_NULL, CommDeuce, &win);
+#endif
destrank = 1;
MPI_Group_incl(comm_group, 1, &destrank, &group);
MPI_Win_start(group, 0, win);
MPI_Put(A, SIZE, MPI_INT, 1, 0, SIZE, MPI_INT, win);
MPI_Win_complete(win);
MPI_Send(B, SIZE, MPI_INT, 1, 100, MPI_COMM_WORLD);
+
+ MPI_Free_mem(B);
}
else { /* rank=1 */
- for (i=0; i<SIZE; i++) A[i] = B[i] = (-4)*i;
+#ifdef USE_WIN_ALLOCATE
+ MPI_Win_allocate(SIZE*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &B, &win);
+#else
+ i = MPI_Alloc_mem(SIZE * sizeof(int), MPI_INFO_NULL, &B);
+ if (i) {
+ printf("Can't allocate memory in test program\n");
+ MPI_Abort(MPI_COMM_WORLD, 1);
+ }
MPI_Win_create(B, SIZE*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &win);
+#endif
+ MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win);
+ for (i=0; i<SIZE; i++) A[i] = B[i] = (-4)*i;
+ MPI_Win_unlock(rank, win);
+
destrank = 0;
MPI_Group_incl(comm_group, 1, &destrank, &group);
MPI_Win_post(group, 0, win);
@@ -85,13 +105,16 @@ int main(int argc, char *argv[])
errs++;
}
}
+
+#ifndef USE_WIN_ALLOCATE
+ MPI_Free_mem(B);
+#endif
}
MPI_Group_free(&group);
MPI_Group_free(&comm_group);
MPI_Win_free(&win);
MPI_Free_mem(A);
- MPI_Free_mem(B);
}
MPI_Comm_free(&CommDeuce);
MTest_Finalize(errs);
diff --git a/test/mpi/rma/testlist.in b/test/mpi/rma/testlist.in
index 267e041..cd867c5 100644
--- a/test/mpi/rma/testlist.in
+++ b/test/mpi/rma/testlist.in
@@ -12,12 +12,15 @@ getgroup 4
transpose1 2
transpose2 2
transpose3 2
+transpose3_shm 2
transpose5 2
transpose6 1
transpose7 2
test1 2
test2 2
+test2_shm 2
test3 2
+test3_shm 2
test4 2
test5 2
lockcontention 3
@@ -29,10 +32,13 @@ transpose4 2
fetchandadd 7
fetchandadd_tree 7
wintest 2
+wintest_shm 2
contig_displ 1
test1_am 2
test2_am 2
+test2_am_shm 2
test3_am 2
+test3_am_shm 2
test4_am 2
test5_am 2
fetchandadd_am 7
@@ -40,6 +46,7 @@ fetchandadd_tree_am 7
accfence2_am 4
test1_dt 2 timeLimit=30
nullpscw 7
+nullpscw_shm 7
attrorderwin 1
wincall 2
baseattrwin 1
@@ -65,6 +72,7 @@ put_base 2
put_bottom 2
win_flavors 4 mpiversion=3.0
manyrma2 2 timeLimit=500
+manyrma2_shm 2 timeLimit=500
manyrma3 2
win_shared 4 mpiversion=3.0
win_shared_noncontig 4 mpiversion=3.0
@@ -97,6 +105,7 @@ req_example_shm 4 mpiversion=3.0
win_info 4 mpiversion=3.0
linked_list_lockall 4 mpiversion=3.0
pscw_ordering 4 mpiversion=3.0
+pscw_ordering_shm 4 mpiversion=3.0
linked_list_bench_lock_all 4 mpiversion=3.0
linked_list_bench_lock_excl 4 mpiversion=3.0
linked_list_bench_lock_shr 4 mpiversion=3.0
diff --git a/test/mpi/rma/transpose3.c b/test/mpi/rma/transpose3.c
index 86ef3d5..e08ee80 100644
--- a/test/mpi/rma/transpose3.c
+++ b/test/mpi/rma/transpose3.c
@@ -17,7 +17,7 @@
int main(int argc, char *argv[])
{
- int rank, nprocs, A[NROWS][NCOLS], i, j, destrank;
+ int rank, nprocs, i, j, destrank;
MPI_Comm CommDeuce;
MPI_Win win;
MPI_Datatype column, xpose;
@@ -41,6 +41,8 @@ int main(int argc, char *argv[])
if (rank == 0)
{
+ int A[NROWS][NCOLS];
+
for (i=0; i<NROWS; i++)
for (j=0; j<NCOLS; j++)
A[i][j] = i*NCOLS + j;
@@ -51,7 +53,12 @@ int main(int argc, char *argv[])
MPI_Type_hvector(NCOLS, 1, sizeof(int), column, &xpose);
MPI_Type_commit(&xpose);
+#ifdef USE_WIN_ALLOCATE
+ int *base_ptr = NULL;
+ MPI_Win_allocate(0, 1, MPI_INFO_NULL, CommDeuce, &base_ptr, &win);
+#else
MPI_Win_create(NULL, 0, 1, MPI_INFO_NULL, CommDeuce, &win);
+#endif
destrank = 1;
MPI_Group_incl(comm_group, 1, &destrank, &group);
@@ -66,10 +73,19 @@ int main(int argc, char *argv[])
}
else
{ /* rank=1 */
+ int *A;
+#ifdef USE_WIN_ALLOCATE
+ MPI_Win_allocate(NROWS*NCOLS*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &A, &win);
+#else
+ MPI_Alloc_mem(NROWS*NCOLS*sizeof(int), MPI_INFO_NULL, &A);
+ MPI_Win_create(A, NROWS*NCOLS*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &win);
+#endif
+ MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win);
for (i=0; i<NROWS; i++)
for (j=0; j<NCOLS; j++)
- A[i][j] = -1;
- MPI_Win_create(A, NROWS*NCOLS*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &win);
+ A[i*NCOLS+j] = -1;
+ MPI_Win_unlock(rank, win);
+
destrank = 0;
MPI_Group_incl(comm_group, 1, &destrank, &group);
MPI_Win_post(group, 0, win);
@@ -79,12 +95,12 @@ int main(int argc, char *argv[])
{
for (i=0; i<NROWS; i++)
{
- if (A[j][i] != i*NCOLS + j)
+ if (A[j*NROWS+i] != i*NCOLS + j)
{
if (errs < 50)
{
SQUELCH( printf("Error: A[%d][%d]=%d should be %d\n", j, i,
- A[j][i], i*NCOLS + j); );
+ A[j*NROWS+i], i*NCOLS + j); );
}
errs++;
}
@@ -94,6 +110,9 @@ int main(int argc, char *argv[])
{
printf("Total number of errors: %d\n", errs);
}
+#ifndef USE_WIN_ALLOCATE
+ MPI_Free_mem(A);
+#endif
}
MPI_Group_free(&group);
diff --git a/test/mpi/rma/wintest.c b/test/mpi/rma/wintest.c
index a8a784c..7ac1401 100644
--- a/test/mpi/rma/wintest.c
+++ b/test/mpi/rma/wintest.c
@@ -15,7 +15,7 @@
int main(int argc, char *argv[])
{
- int rank, destrank, nprocs, A[SIZE2], B[SIZE2], i;
+ int rank, destrank, nprocs, A[SIZE2], i;
MPI_Comm CommDeuce;
MPI_Group comm_group, group;
MPI_Win win;
@@ -36,8 +36,14 @@ int main(int argc, char *argv[])
MPI_Comm_group(CommDeuce, &comm_group);
if (rank == 0) {
+ int B[SIZE2];
for (i=0; i<SIZE2; i++) A[i] = B[i] = i;
+#ifdef USE_WIN_ALLOCATE
+ int *base_ptr = NULL;
+ MPI_Win_allocate(0, 1, MPI_INFO_NULL, CommDeuce, &base_ptr, &win);
+#else
MPI_Win_create(NULL, 0, 1, MPI_INFO_NULL, CommDeuce, &win);
+#endif
destrank = 1;
MPI_Group_incl(comm_group, 1, &destrank, &group);
MPI_Win_start(group, 0, win);
@@ -55,8 +61,17 @@ int main(int argc, char *argv[])
}
}
else { /* rank=1 */
- for (i=0; i<SIZE2; i++) B[i] = (-4)*i;
+#ifdef USE_WIN_ALLOCATE
+ int *B;
+ MPI_Win_allocate(SIZE2*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &B, &win);
+#else
+ int B[SIZE2];
MPI_Win_create(B, SIZE2*sizeof(int), sizeof(int), MPI_INFO_NULL, CommDeuce, &win);
+#endif
+ MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win);
+ for (i=0; i<SIZE2; i++) B[i] = (-4)*i;
+ MPI_Win_unlock(rank, win);
+
destrank = 0;
MPI_Group_incl(comm_group, 1, &destrank, &group);
MPI_Win_post(group, 0, win);
http://git.mpich.org/mpich.git/commitdiff/96ca97960ab8adb63ded829670f28dd84…
commit 96ca97960ab8adb63ded829670f28dd845c17e13
Author: Xin Zhao <xinzhao3(a)illinois.edu>
Date: Wed Sep 17 14:42:03 2014 -0500
Bug-fix: skip synchronization in Win_start for MODE_NOCHECK.
If MPI_MODE_NOCHECK is passed to MPI_Win_start, we should not
wait for synchronization from targets.
Signed-off-by: Pavan Balaji <balaji(a)anl.gov>
diff --git a/src/mpid/ch3/src/ch3u_rma_sync.c b/src/mpid/ch3/src/ch3u_rma_sync.c
index 4a5c69f..6b48ac3 100644
--- a/src/mpid/ch3/src/ch3u_rma_sync.c
+++ b/src/mpid/ch3/src/ch3u_rma_sync.c
@@ -2567,8 +2567,14 @@ int MPIDI_Win_start(MPID_Group *group_ptr, int assert, MPID_Win *win_ptr)
mpi_errno = fill_ranks_in_win_grp(win_ptr, ranks_in_win_grp);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
- mpi_errno = recv_post_msgs(win_ptr, ranks_in_win_grp, 1);
- if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+ /* If MPI_MODE_NOCHECK was not specified, we need to check if
+ Win_post was called on the target processes on SHM window.
+ Wait for a 0-byte sync message from each target process. */
+ if ((win_ptr->start_assert & MPI_MODE_NOCHECK) == 0)
+ {
+ mpi_errno = recv_post_msgs(win_ptr, ranks_in_win_grp, 1);
+ if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+ }
/* Ensure ordering of load/store operations */
if (win_ptr->shm_allocated == TRUE) {
http://git.mpich.org/mpich.git/commitdiff/90096d60602d64efcdf440729aa0e1048…
commit 90096d60602d64efcdf440729aa0e104872ae18f
Author: Xin Zhao <xinzhao3(a)illinois.edu>
Date: Tue Sep 9 21:54:01 2014 -0500
Bug-fix: avoid wrong synchronization in MPI_Win_complete.
recv_post_msgs function on origin process is used to wait
for synchronization from target processes, and it can be
called from MPI_Win_start (for targets on SHM) and
MPI_Win_complete (for targets not on SHM). Here we fix the
bug so that origin will not wait for SHM targets again in
MPI_Win_complete.
Signed-off-by: Pavan Balaji <balaji(a)anl.gov>
diff --git a/src/mpid/ch3/src/ch3u_rma_sync.c b/src/mpid/ch3/src/ch3u_rma_sync.c
index 97ab0c8..4a5c69f 100644
--- a/src/mpid/ch3/src/ch3u_rma_sync.c
+++ b/src/mpid/ch3/src/ch3u_rma_sync.c
@@ -2391,6 +2391,7 @@ static int recv_post_msgs(MPID_Win *win_ptr, int *ranks_in_win_grp, int local)
MPI_Request *req;
MPI_Status *status;
MPID_Comm *comm_ptr = win_ptr->comm_ptr;
+ MPIDI_VC_t *orig_vc = NULL, *target_vc = NULL;
MPIU_CHKLMEM_DECL(2);
MPIDI_STATE_DECL(MPID_STATE_RECV_POST_MSGS);
@@ -2415,7 +2416,6 @@ static int recv_post_msgs(MPID_Win *win_ptr, int *ranks_in_win_grp, int local)
if (local && win_ptr->shm_allocated == TRUE) {
MPID_Request *req_ptr;
- MPIDI_VC_t *orig_vc = NULL, *target_vc = NULL;
MPIDI_Comm_get_vc(win_ptr->comm_ptr, rank, &orig_vc);
MPIDI_Comm_get_vc(win_ptr->comm_ptr, src, &target_vc);
@@ -2430,10 +2430,16 @@ static int recv_post_msgs(MPID_Win *win_ptr, int *ranks_in_win_grp, int local)
else if (!local) {
MPID_Request *req_ptr;
- mpi_errno = MPID_Irecv(NULL, 0, MPI_INT, src, SYNC_POST_TAG,
- comm_ptr, MPID_CONTEXT_INTRA_PT2PT, &req_ptr);
- if (mpi_errno) MPIU_ERR_POP(mpi_errno);
- req[j++] = req_ptr->handle;
+ MPIDI_Comm_get_vc(win_ptr->comm_ptr, rank, &orig_vc);
+ MPIDI_Comm_get_vc(win_ptr->comm_ptr, src, &target_vc);
+
+ if (win_ptr->shm_allocated != TRUE ||
+ orig_vc->node_id != target_vc->node_id) {
+ mpi_errno = MPID_Irecv(NULL, 0, MPI_INT, src, SYNC_POST_TAG,
+ comm_ptr, MPID_CONTEXT_INTRA_PT2PT, &req_ptr);
+ if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+ req[j++] = req_ptr->handle;
+ }
}
}
@@ -2442,7 +2448,7 @@ static int recv_post_msgs(MPID_Win *win_ptr, int *ranks_in_win_grp, int local)
if (mpi_errno && mpi_errno != MPI_ERR_IN_STATUS) MPIU_ERR_POP(mpi_errno);
/* --BEGIN ERROR HANDLING-- */
if (mpi_errno == MPI_ERR_IN_STATUS) {
- for (i = 0; i < start_grp_size; i++) {
+ for (i = 0; i < j; i++) {
if (status[i].MPI_ERROR != MPI_SUCCESS) {
mpi_errno = status[i].MPI_ERROR;
MPIU_ERR_POP(mpi_errno);
-----------------------------------------------------------------------
Summary of changes:
src/mpid/ch3/src/ch3u_rma_sync.c | 28 ++++++++++++++++++++--------
test/mpi/rma/Makefile.am | 29 +++++++++++++++++++++++++++++
test/mpi/rma/manyrma2.c | 13 +++++++++++++
test/mpi/rma/nullpscw.c | 5 +++++
test/mpi/rma/pscw_ordering.c | 15 +++++++++++----
test/mpi/rma/test2.c | 19 +++++++++++++++++--
test/mpi/rma/test2_am.c | 36 +++++++++++++++++++++++++++++-------
test/mpi/rma/test3.c | 36 +++++++++++++++++++++++++++++-------
test/mpi/rma/test3_am.c | 37 ++++++++++++++++++++++++++++++-------
test/mpi/rma/testlist.in | 9 +++++++++
test/mpi/rma/transpose3.c | 29 ++++++++++++++++++++++++-----
test/mpi/rma/wintest.c | 19 +++++++++++++++++--
12 files changed, 233 insertions(+), 42 deletions(-)
hooks/post-receive
--
MPICH primary repository
1
0
[mpich] MPICH primary repository branch, master, updated. v3.2a1-12-g232c390
by noreply@mpich.org 18 Sep '14
by noreply@mpich.org 18 Sep '14
18 Sep '14
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 232c39024cf3af13568362b4ac6baba50b8d6068 (commit)
from 9e08a8b6ba95b38f642ca4cc2549870644192409 (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/232c39024cf3af13568362b4ac6baba50…
commit 232c39024cf3af13568362b4ac6baba50b8d6068
Author: Su Huang <suhuang(a)us.ibm.com>
Date: Thu Sep 11 14:17:33 2014 -0400
pamid: LE RDMA hit "mlx5: got completion with error" and even coredump
Fixed a bug in MPID_Win_allgather to avoid passing 0 for memory registration
(ibm) D199265
Signed-off-by: Michael Blocksome <blocksom(a)us.ibm.com>
diff --git a/src/mpid/pamid/src/onesided/mpid_win_create.c b/src/mpid/pamid/src/onesided/mpid_win_create.c
index 15f5e60..6c1b9cc 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_create.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_create.c
@@ -127,7 +127,7 @@ MPIDI_Win_allgather( MPI_Aint size, MPID_Win **win_ptr )
/* --------------------------------------- */
/* Setup the PAMI sections of the window */
/* --------------------------------------- */
- rc = PAMI_Memregion_create(MPIDI_Context[0], win->mpid.info[rank].base_addr, win->mpid.info[rank].base_size, &length_out, &winfo->memregion);
+ rc = PAMI_Memregion_create(MPIDI_Context[0], win->mpid.info[rank].base_addr, win->size, &length_out, &winfo->memregion);
#ifdef USE_PAMI_RDMA
MPIU_ERR_CHKANDJUMP((rc != PAMI_SUCCESS), mpi_errno, MPI_ERR_OTHER, "**nomem");
MPIU_ERR_CHKANDJUMP((win->size < length_out), mpi_errno, MPI_ERR_OTHER, "**nomem");
-----------------------------------------------------------------------
Summary of changes:
src/mpid/pamid/src/onesided/mpid_win_create.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
hooks/post-receive
--
MPICH primary repository
1
0
[mpich] MPICH primary repository branch, master, updated. v3.2a1-11-g9e08a8b
by noreply@mpich.org 18 Sep '14
by noreply@mpich.org 18 Sep '14
18 Sep '14
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 9e08a8b6ba95b38f642ca4cc2549870644192409 (commit)
via 6b9e0dc0980125d45d54ca483371e1c217120e9a (commit)
via 8da6ae0aa335275526680f7758ea1bbaca405793 (commit)
via a6c20a785547de40ec30d2bbd823c7dcee790421 (commit)
from 30e40464c9beca4c57b4ee2153a9e0bcc8cbc77b (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/9e08a8b6ba95b38f642ca4cc254987064…
commit 9e08a8b6ba95b38f642ca4cc2549870644192409
Author: Rob Latham <robl(a)mcs.anl.gov>
Date: Tue Sep 16 09:48:04 2014 -0500
romio: remove allreduce in flush
long ago we thought there might be more than one process flushing data,
but that has not borne out. the much faster MPI_Bcast will suffice, and
we can avoid an MPI_Allreduce.
Signed-off-by: Paul Coffman <pkcoff(a)us.ibm.com>
diff --git a/src/mpi/romio/adio/ad_gpfs/ad_gpfs_flush.c b/src/mpi/romio/adio/ad_gpfs/ad_gpfs_flush.c
index 5f7b182..555002f 100644
--- a/src/mpi/romio/adio/ad_gpfs/ad_gpfs_flush.c
+++ b/src/mpi/romio/adio/ad_gpfs/ad_gpfs_flush.c
@@ -42,10 +42,7 @@ void ADIOI_GPFS_Flush(ADIO_File fd, int *error_code)
if (err == -1) err = errno;
else err = 0;
}
- /* Just pick an errno (using unsigned MPI_MAX) from any failures. We use
- * MPI_Allreduce in case one day we wish to fsync from more than one
- * process */
- MPI_Allreduce( MPI_IN_PLACE, (unsigned*)&err, 1, MPI_UNSIGNED, MPI_MAX, fd->comm);
+ MPI_Bcast(&err, 1, MPI_UNSIGNED, fd->hints->ranklist[0], fd->comm);
DBGV_FPRINTF(stderr,"aggregation result:fsync %s, errno %#X,\n",fd->filename, err);
if (err) /* if it's non-zero, it must be an errno */
http://git.mpich.org/mpich.git/commitdiff/6b9e0dc0980125d45d54ca483371e1c21…
commit 6b9e0dc0980125d45d54ca483371e1c217120e9a
Author: Rob Latham <robl(a)mcs.anl.gov>
Date: Thu Sep 11 11:01:46 2014 -0500
Remove comm_split in deferred open case
comm_split might scale poorly on some systems, and we don't even use the
resulting communicator. it was used as a marker, but we have enough
other information.
diff --git a/src/mpi/romio/adio/common/ad_close.c b/src/mpi/romio/adio/common/ad_close.c
index c34ffa3..7aa5ce0 100644
--- a/src/mpi/romio/adio/common/ad_close.c
+++ b/src/mpi/romio/adio/common/ad_close.c
@@ -25,7 +25,7 @@ void ADIO_Close(ADIO_File fd, int *error_code)
}
/* because of deferred open, this warants a bit of explaining. First, if
- * we've done aggregation (fd->agg_comm has a non-nulll communicator ),
+ * we've done aggregation,
* then close the file. Then, if any process left has done independent
* i/o, close the file. Otherwise, we'll skip the fs-specific close and
* just say everything is a-ok.
@@ -35,7 +35,7 @@ void ADIO_Close(ADIO_File fd, int *error_code)
* everyone who ever opened the file will close it. Is order important? Is
* timing important?
*/
- if (fd->agg_comm != MPI_COMM_NULL) {
+ if (fd->hints->deferred_open && fd->is_agg) {
(*(fd->fns->ADIOI_xxx_Close))(fd, error_code);
} else {
if(fd->is_open) {
@@ -101,10 +101,6 @@ void ADIO_Close(ADIO_File fd, int *error_code)
MPI_Comm_free(&(fd->comm));
- /* deferred open: if we created an aggregator communicator, free it */
- if (fd->agg_comm != MPI_COMM_NULL) {
- MPI_Comm_free(&(fd->agg_comm));
- }
ADIOI_Free(fd->filename);
MPI_Type_get_envelope(fd->etype, &i, &j, &k, &combiner);
diff --git a/src/mpi/romio/adio/common/ad_open.c b/src/mpi/romio/adio/common/ad_open.c
index 190561e..d26a072 100644
--- a/src/mpi/romio/adio/common/ad_open.c
+++ b/src/mpi/romio/adio/common/ad_open.c
@@ -31,7 +31,6 @@ MPI_File ADIO_Open(MPI_Comm orig_comm,
static char myname[] = "ADIO_OPEN";
int max_error_code;
MPI_Info dupinfo;
- MPI_Comm aggregator_comm = MPI_COMM_NULL; /* just for deferred opens */
*error_code = MPI_SUCCESS;
@@ -156,28 +155,12 @@ MPI_File ADIO_Open(MPI_Comm orig_comm,
ADIOI_Info_print_keyvals(fd->info);
}
- /* deferred open: if we are an aggregator, create a new communicator.
- * we'll use this aggregator communicator for opens and closes.
- * otherwise, we have a NULL communicator until we try to do independent
- * IO */
- fd->agg_comm = MPI_COMM_NULL;
fd->is_open = 0;
fd->my_cb_nodes_index = -2;
fd->is_agg = is_aggregator(rank, fd);
- if (fd->hints->deferred_open) {
- /* MPI_Comm_split will create a communication group of aggregators.
- * for non-aggregators it will return MPI_COMM_NULL . we rely on
- * fd->agg_comm == MPI_COMM_NULL for non-aggregators in several
- * tests in the code */
- if (fd->is_agg) {
- MPI_Comm_split(fd->comm, 1, 0, &aggregator_comm);
- fd->agg_comm = aggregator_comm;
- } else {
- MPI_Comm_split(fd->comm, MPI_UNDEFINED, 0, &aggregator_comm);
- fd->agg_comm = aggregator_comm;
- }
-
- }
+ /* deferred open used to split the communicator to create an "aggregator
+ * communicator", but we only used it as a way to indicate that deferred
+ * open happened. fd->is_open and fd->is_agg are sufficient */
/* actual opens start here */
/* generic open: one process opens to create the file, all others open */
@@ -197,7 +180,7 @@ MPI_File ADIO_Open(MPI_Comm orig_comm,
/* in the deferred open case, only those who have actually
opened the file should close it */
if (fd->hints->deferred_open) {
- if (fd->agg_comm != MPI_COMM_NULL) {
+ if (fd->is_agg) {
(*(fd->fns->ADIOI_xxx_Close))(fd, error_code);
}
}
diff --git a/src/mpi/romio/adio/common/ad_opencoll.c b/src/mpi/romio/adio/common/ad_opencoll.c
index 81dc0be..467a322 100644
--- a/src/mpi/romio/adio/common/ad_opencoll.c
+++ b/src/mpi/romio/adio/common/ad_opencoll.c
@@ -67,7 +67,7 @@ void ADIOI_GEN_OpenColl(ADIO_File fd, int rank,
/* if we are doing deferred open, non-aggregators should return now */
if (fd->hints->deferred_open ) {
- if (fd->agg_comm == MPI_COMM_NULL) {
+ if (!(fd->is_agg)) {
/* we might have turned off EXCL for the aggregators.
* restore access_mode that non-aggregators get the right
* value from get_amode */
@@ -82,7 +82,7 @@ void ADIOI_GEN_OpenColl(ADIO_File fd, int rank,
*error_code = MPI_SUCCESS;
ADIOI_Assert(fd->blksize > 0);
return;
- }
+ }
}
/* For writing with data sieving, a read-modify-write is needed. If
diff --git a/src/mpi/romio/adio/common/ad_opencoll_failsafe.c b/src/mpi/romio/adio/common/ad_opencoll_failsafe.c
index 78954d9..e7ac871 100644
--- a/src/mpi/romio/adio/common/ad_opencoll_failsafe.c
+++ b/src/mpi/romio/adio/common/ad_opencoll_failsafe.c
@@ -43,15 +43,13 @@ void ADIOI_FAILSAFE_OpenColl(ADIO_File fd, int rank,
}
}
/* if we are doing deferred open, non-aggregators should return now */
- if (fd->hints->deferred_open ) {
- if (fd->agg_comm == MPI_COMM_NULL) {
- /* we might have turned off EXCL for the aggregators.
- * restore access_mode that non-aggregators get the right
- * value from get_amode */
- fd->access_mode = orig_amode_excl;
- *error_code = MPI_SUCCESS;
- return;
- }
+ if (fd->hints->deferred_open && !(fd->is_agg)) {
+ /* we might have turned off EXCL for the aggregators.
+ * restore access_mode that non-aggregators get the right
+ * value from get_amode */
+ fd->access_mode = orig_amode_excl;
+ *error_code = MPI_SUCCESS;
+ return;
}
/* For writing with data sieving, a read-modify-write is needed. If
diff --git a/src/mpi/romio/adio/common/ad_opencoll_scalable.c b/src/mpi/romio/adio/common/ad_opencoll_scalable.c
index 1a68ac0..1c47201 100644
--- a/src/mpi/romio/adio/common/ad_opencoll_scalable.c
+++ b/src/mpi/romio/adio/common/ad_opencoll_scalable.c
@@ -19,11 +19,9 @@ void ADIOI_SCALEABLE_OpenColl(ADIO_File fd, int rank,
int orig_amode_wronly;
/* if we are doing deferred open, non-aggregators should return now */
- if (fd->hints->deferred_open ) {
- if (fd->agg_comm == MPI_COMM_NULL) {
- *error_code = MPI_SUCCESS;
- return;
- }
+ if (fd->hints->deferred_open && !(fd->is_agg)) {
+ *error_code = MPI_SUCCESS;
+ return;
}
/* For writing with data sieving, a read-modify-write is needed. If
diff --git a/src/mpi/romio/adio/include/adio.h b/src/mpi/romio/adio/include/adio.h
index 8c33bea..90206d9 100644
--- a/src/mpi/romio/adio/include/adio.h
+++ b/src/mpi/romio/adio/include/adio.h
@@ -203,7 +203,6 @@ typedef struct ADIOI_FileD {
in bytes */
ADIOI_Fns *fns; /* struct of I/O functions to use */
MPI_Comm comm; /* communicator indicating who called open */
- MPI_Comm agg_comm; /* deferred open: aggregators who called open */
int is_open; /* deferred open: 0: not open yet 1: is open */
int is_agg; /* bool: if I am an aggregator */
char *filename;
http://git.mpich.org/mpich.git/commitdiff/8da6ae0aa335275526680f7758ea1bbac…
commit 8da6ae0aa335275526680f7758ea1bbaca405793
Author: Rob Latham <robl(a)mcs.anl.gov>
Date: Thu Sep 11 14:40:55 2014 -0500
fix logic in syshint processing check
Ken was right: I was being too clever before. now, simply and more
explicitly check if anyone has a NULL systemwide-hint info object.
diff --git a/src/mpi/romio/adio/common/ad_open.c b/src/mpi/romio/adio/common/ad_open.c
index 67eb125..190561e 100644
--- a/src/mpi/romio/adio/common/ad_open.c
+++ b/src/mpi/romio/adio/common/ad_open.c
@@ -99,10 +99,16 @@ MPI_File ADIO_Open(MPI_Comm orig_comm,
*
* a code might do an "initialize from 0", so we can only skip hint
* processing once everyone has particpiated in hint processing */
- int dummy_info;
- MPI_Allreduce(&ADIOI_syshints, &dummy_info, 1, MPI_INT, MPI_MIN, fd->comm);
- if ((MPI_Info)dummy_info== MPI_INFO_NULL) {
- MPI_Info_create(&ADIOI_syshints);
+ int syshints_processed, can_skip;
+ if (ADIOI_syshints == MPI_INFO_NULL)
+ syshints_processed = 0;
+ else
+ syshints_processed = 1;
+
+ MPI_Allreduce(&syshints_processed, &can_skip, 1, MPI_INT, MPI_MIN, fd->comm);
+ if (!can_skip) {
+ if (ADIOI_syshints == MPI_INFO_NULL)
+ MPI_Info_create(&ADIOI_syshints);
ADIOI_process_system_hints(fd, ADIOI_syshints);
}
http://git.mpich.org/mpich.git/commitdiff/a6c20a785547de40ec30d2bbd823c7dce…
commit a6c20a785547de40ec30d2bbd823c7dcee790421
Author: Rob Latham <robl(a)mcs.anl.gov>
Date: Thu Sep 11 11:37:28 2014 -0500
no reason for a huge stack in these tests
diff --git a/src/mpi/romio/test/aggregation1.c b/src/mpi/romio/test/aggregation1.c
index 5331639..dee42d6 100644
--- a/src/mpi/romio/test/aggregation1.c
+++ b/src/mpi/romio/test/aggregation1.c
@@ -88,7 +88,9 @@ write_file( char *target, int rank, MPI_Info *info ) {
MPI_Status mpi_stat;
int mpi_ret;
int i;
- char buffer[OBJ_SIZE];
+ char *buffer;
+
+ buffer = malloc(OBJ_SIZE);
if ( debug ) printf( "%d writing file %s\n", rank, target );
@@ -116,6 +118,7 @@ write_file( char *target, int rank, MPI_Info *info ) {
fatal_error( mpi_ret, NULL, "close for write" );
}
if ( debug ) printf( "%d wrote file %s\n", rank, target );
+ free(buffer);
}
static int
@@ -136,8 +139,9 @@ read_file( char *target, int rank, MPI_Info *info, int *corrupt_blocks ) {
MPI_Status mpi_stat;
int mpi_ret;
int i;
- char buffer[OBJ_SIZE];
+ char *buffer;
char *verify_buf = NULL;
+ buffer = malloc(OBJ_SIZE);
verify_buf = (char *)malloc(OBJ_SIZE);
if ( debug ) printf( "%d reading file %s\n", rank, target );
@@ -171,6 +175,7 @@ read_file( char *target, int rank, MPI_Info *info, int *corrupt_blocks ) {
if( (mpi_ret = MPI_File_close( &rfh ) ) != MPI_SUCCESS ) {
fatal_error( mpi_ret, NULL, "close for read" );
}
+ free (buffer);
free(verify_buf);
}
-----------------------------------------------------------------------
Summary of changes:
src/mpi/romio/adio/ad_gpfs/ad_gpfs_flush.c | 5 +--
src/mpi/romio/adio/common/ad_close.c | 8 +---
src/mpi/romio/adio/common/ad_open.c | 39 ++++++++--------------
src/mpi/romio/adio/common/ad_opencoll.c | 4 +-
src/mpi/romio/adio/common/ad_opencoll_failsafe.c | 16 ++++-----
src/mpi/romio/adio/common/ad_opencoll_scalable.c | 8 ++---
src/mpi/romio/adio/include/adio.h | 1 -
src/mpi/romio/test/aggregation1.c | 9 ++++-
8 files changed, 36 insertions(+), 54 deletions(-)
hooks/post-receive
--
MPICH primary repository
1
0
[mpich] MPICH primary repository branch, master, updated. v3.2a1-7-g30e4046
by noreply@mpich.org 11 Sep '14
by noreply@mpich.org 11 Sep '14
11 Sep '14
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 30e40464c9beca4c57b4ee2153a9e0bcc8cbc77b (commit)
from 333610f04ec4a6eda2f23779fd98f97e18408815 (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/30e40464c9beca4c57b4ee2153a9e0bcc…
commit 30e40464c9beca4c57b4ee2153a9e0bcc8cbc77b
Author: Junchao Zhang <jczhang(a)mcs.anl.gov>
Date: Thu Sep 11 13:20:23 2014 -0500
Fix an "unused variable" warning in F77/90 MPI_PCONTROL
Signed-off-by: Rob Latham <robl(a)mcs.anl.gov>
diff --git a/src/binding/fortran/mpif_h/buildiface b/src/binding/fortran/mpif_h/buildiface
index 3324821..5498459 100755
--- a/src/binding/fortran/mpif_h/buildiface
+++ b/src/binding/fortran/mpif_h/buildiface
@@ -4197,8 +4197,7 @@ sub build_specials {
&print_routine_type_decl( $OUTFD, $out_prefix, "pcontrol" );
print $OUTFD "(MPI_Fint *v1)\n";
print $OUTFD "{\n";
- print $OUTFD " int ierr;\n";
- print $OUTFD " ierr = MPI_Pcontrol( (int)*v1 );\n";
+ print $OUTFD " MPI_Pcontrol( (int)*v1 );\n";
print $OUTFD "}\n";
close ($OUTFD);
&ReplaceIfDifferent( $filename, $filename . ".new" );
-----------------------------------------------------------------------
Summary of changes:
src/binding/fortran/mpif_h/buildiface | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
hooks/post-receive
--
MPICH primary repository
1
0
[mpich] MPICH primary repository branch, master, updated. v3.2a1-6-g333610f
by noreply@mpich.org 11 Sep '14
by noreply@mpich.org 11 Sep '14
11 Sep '14
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 333610f04ec4a6eda2f23779fd98f97e18408815 (commit)
from b293734ddfd76c34eea26794fda4acbb5cfee34a (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/333610f04ec4a6eda2f23779fd98f97e1…
commit 333610f04ec4a6eda2f23779fd98f97e18408815
Author: Junchao Zhang <jczhang(a)mcs.anl.gov>
Date: Tue Sep 9 15:30:27 2014 -0500
Fix F77/90 binding errors in MPI_Pcontrol
MPI_Pcontrol does not have the ierror argument.
Fixes #2173
Signed-off-by: William Gropp <wgropp(a)illinois.edu>
diff --git a/src/binding/fortran/mpif_h/buildiface b/src/binding/fortran/mpif_h/buildiface
index c9c0577..3324821 100755
--- a/src/binding/fortran/mpif_h/buildiface
+++ b/src/binding/fortran/mpif_h/buildiface
@@ -4185,21 +4185,30 @@ sub build_specials {
&ReplaceIfDifferent( $filename, $filename . ".new" );
&AddPrototype( $out_prefix, "init_thread", $args );
+ # MPI_Pcontrol does not have the ierror argument.
$OUTFD = "PCONTROLFFD";
$filename = "pcontrolf.c";
open( $OUTFD, ">$filename.new" ) || die "Cannot open $filename.new\n";
$files[$#files+1] = $filename;
- $args = "int";
- &print_header( "mpi_", "MPI_Pcontrol", "pcontrol", $args );
+ $returnType = "void";
+ &set_weak_decl( "MPI_Pcontrol", "MPI_Fint *", "void" );
+ &set_weak_decl( "PMPI_Pcontrol", "MPI_Fint *", "void" );
+ &print_header( "mpi_", "MPI_Pcontrol", "pcontrol", "");
&print_routine_type_decl( $OUTFD, $out_prefix, "pcontrol" );
- &print_args( $OUTFD, $args, 0, "pcontrol" );
- #&print_attr;
+ print $OUTFD "(MPI_Fint *v1)\n";
print $OUTFD "{\n";
- print $OUTFD " *ierr = MPI_Pcontrol( (int)*v1 );\n";
+ print $OUTFD " int ierr;\n";
+ print $OUTFD " ierr = MPI_Pcontrol( (int)*v1 );\n";
print $OUTFD "}\n";
close ($OUTFD);
&ReplaceIfDifferent( $filename, $filename . ".new" );
- &AddPrototype( $out_prefix, "pcontrol", $args );
+ if ($build_prototypes) {
+ print PROTOFD "extern ";
+ &print_routine_type_decl( PROTOFD, $out_prefix, "pcontrol" );
+ print PROTOFD "( MPI_Fint * )";
+ &print_attr( PROTOFD, $out_prefix."pcontrol_" );
+ print PROTOFD ";\n";
+ }
$OUTFD = "ADDRESSFFD";
$filename = "addressf.c";
-----------------------------------------------------------------------
Summary of changes:
src/binding/fortran/mpif_h/buildiface | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
hooks/post-receive
--
MPICH primary repository
1
0
[software/dev/stencil] Stencil code repository branch, master, created. 5c2816986cd0be1c0bb66652e08e213da1307700
by noreply@mpich.org 10 Sep '14
by noreply@mpich.org 10 Sep '14
10 Sep '14
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 "Stencil code repository".
The branch, master has been created
at 5c2816986cd0be1c0bb66652e08e213da1307700 (commit)
- Log -----------------------------------------------------------------
http://git.mpich.org/software/dev/stencil.git/commitdiff/5c2816986cd0be1c0b…
commit 5c2816986cd0be1c0bb66652e08e213da1307700
Author: Pavan Balaji <balaji(a)anl.gov>
Date: Sat Sep 6 21:11:06 2014 -0500
Added header file.
diff --git a/stencil_par.h b/stencil_par.h
new file mode 100644
index 0000000..2dba3d2
--- /dev/null
+++ b/stencil_par.h
@@ -0,0 +1,24 @@
+/*
+ * stencil_par.h
+ *
+ * Created on: Jan 4, 2012
+ * Author: htor
+ */
+
+#ifndef STENCIL_PAR_H_
+#define STENCIL_PAR_H_
+
+#include "mpi.h"
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+
+// row-major order
+#define ind(i,j) (j)*(bx+2)+(i)
+
+void printarr_par(int iter, double* array, int size, int px, int py, int rx, int ry, int bx, int by, int offx, int offy, MPI_Comm comm);
+
+
+#endif /* STENCIL_PAR_H_ */
http://git.mpich.org/software/dev/stencil.git/commitdiff/ef82f607fb83051c58…
commit ef82f607fb83051c58d894412293adcae65cb8f3
Author: Pavan Balaji <balaji(a)anl.gov>
Date: Sat Sep 6 19:14:05 2014 -0500
White space cleanup.
diff --git a/stencil.cpp b/stencil.cpp
index b4d7f2e..b417e06 100644
--- a/stencil.cpp
+++ b/stencil.cpp
@@ -6,527 +6,515 @@
*/
#include "stencil_par.h"
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
- int provide;
- MPI_Init(&argc,&argv);
- int r,p;
- MPI_Comm comm = MPI_COMM_WORLD;
- MPI_Comm_rank(comm, &r);
- MPI_Comm_size(comm, &p);
- int n, energy, niters,nx,ny, lpx,lpy,px, py;
+ int provide;
+ MPI_Init(&argc, &argv);
+ int r, p;
+ MPI_Comm comm = MPI_COMM_WORLD;
+ MPI_Comm_rank(comm, &r);
+ MPI_Comm_size(comm, &p);
+ int n, energy, niters, nx, ny, lpx, lpy, px, py;
- MPI_Comm shmcomm;
- MPI_Comm_split_type(comm, MPI_COMM_TYPE_SHARED, 0, MPI_INFO_NULL, &shmcomm);
- int sr, sp; // rank and size in shmem comm
+ MPI_Comm shmcomm;
+ MPI_Comm_split_type(comm, MPI_COMM_TYPE_SHARED, 0, MPI_INFO_NULL, &shmcomm);
+ int sr, sp; // rank and size in shmem comm
- MPI_Comm_size(shmcomm, &sp);
- MPI_Comm_rank(shmcomm, &sr);
- printf("shmcomm size = %d\n",sp);
- int CORENUM = 12;
- if (r==0) {
- // argument checking
- if(argc < 8) {
- if(!r) printf("usage: stencil_mpi <n> <energy> <niters> <nx> <ny> <lpx> <lpy>\n");
- MPI_Finalize();
- exit(1);
- }
+ MPI_Comm_size(shmcomm, &sp);
+ MPI_Comm_rank(shmcomm, &sr);
+ printf("shmcomm size = %d\n", sp);
+ int CORENUM = 12;
+ if (r == 0) {
+ // argument checking
+ if (argc < 8) {
+ if (!r)
+ printf("usage: stencil_mpi <n> <energy> <niters> <nx> <ny> <lpx> <lpy>\n");
+ MPI_Finalize();
+ exit(1);
+ }
+
+ n = atoi(argv[1]); // nxn grid
+ energy = atoi(argv[2]); // energy to be injected per iteration
+ niters = atoi(argv[3]); // number of iterations
- n = atoi(argv[1]); // nxn grid
- energy = atoi(argv[2]); // energy to be injected per iteration
- niters = atoi(argv[3]); // number of iterations
+ nx = atoi(argv[4]); // 1st dim processes
+ ny = atoi(argv[5]); // 2nd dim processes
+ lpx = atoi(argv[6]); // 1st dim processes
+ lpy = atoi(argv[7]); // 2nd dim processes
+ px = nx * lpx;
+ py = ny * lpy;
+ if (px * py != p)
+ MPI_Abort(comm, 1); // abort if px or py are wrong
+ if (n % py != 0)
+ MPI_Abort(comm, 2); // abort px needs to divide n
+ if (n % px != 0)
+ MPI_Abort(comm, 3); // abort py needs to divide n
+ if (nx * ny != p / CORENUM)
+ MPI_Abort(comm, 66);
+ if (lpx * lpy != CORENUM)
+ MPI_Abort(comm, 77);
+ // distribute arguments
+ int args[7] = { n, energy, niters, nx, ny, lpx, lpy };
+ MPI_Bcast(args, 7, MPI_INT, 0, comm);
+ }
+ else {
+ int args[7];
+ MPI_Bcast(args, 7, MPI_INT, 0, comm);
+ n = args[0];
+ energy = args[1];
+ niters = args[2];
- nx=atoi(argv[4]); // 1st dim processes
- ny=atoi(argv[5]); // 2nd dim processes
- lpx=atoi(argv[6]); // 1st dim processes
- lpy=atoi(argv[7]); // 2nd dim processes
- px = nx*lpx;
- py = ny*lpy;
- if(px * py != p) MPI_Abort(comm, 1);// abort if px or py are wrong
- if(n % py != 0) MPI_Abort(comm, 2); // abort px needs to divide n
- if(n % px != 0) MPI_Abort(comm, 3); // abort py needs to divide n
- if(nx*ny != p/CORENUM) MPI_Abort(comm,66);
- if(lpx*lpy != CORENUM) MPI_Abort(comm,77);
- // distribute arguments
- int args[7] = {n, energy, niters, nx,ny,lpx,lpy};
- MPI_Bcast(args, 7, MPI_INT, 0, comm);
- }
- else {
- int args[7];
- MPI_Bcast(args, 7, MPI_INT, 0, comm);
- n=args[0]; energy=args[1]; niters=args[2];
-
- nx=args[3]; ny=args[4];
- lpx = args[5];
- lpy = args[6];
-
- px = nx*lpx;
- py = ny*lpy;
- }
+ nx = args[3];
+ ny = args[4];
+ lpx = args[5];
+ lpy = args[6];
+
+ px = nx * lpx;
+ py = ny * lpy;
+ }
- int nodenum = nx*ny;
- int nodeidx, nodeidy;
- int nodeid = r/CORENUM;
- int CH = 2;
- if(CH == 1)
- {
- nodeidx = nodeid % nx;
- nodeidy = nodeid / nx;
- }
- else if(CH == 2)
- {
- nodeidx = nodeid / ny;
- nodeidy = nodeid % ny;
- }
- else if(CH == 3)
- {
- nodeidx = nodeid / ny;
- nodeidy = nodeid % ny;
- if(nodeidx % 2 != 0)
- {
- nodeidy = ny-1 - nodeidy;
- }
- }
+ int nodenum = nx * ny;
+ int nodeidx, nodeidy;
+ int nodeid = r / CORENUM;
+ int CH = 2;
+ if (CH == 1) {
+ nodeidx = nodeid % nx;
+ nodeidy = nodeid / nx;
+ }
+ else if (CH == 2) {
+ nodeidx = nodeid / ny;
+ nodeidy = nodeid % ny;
+ }
+ else if (CH == 3) {
+ nodeidx = nodeid / ny;
+ nodeidy = nodeid % ny;
+ if (nodeidx % 2 != 0) {
+ nodeidy = ny - 1 - nodeidy;
+ }
+ }
//nodeidx idy is the node coordinates(x,y)
//
- int localprocessindex = r%CORENUM;
- int local_x, local_y;
- local_x = localprocessindex%lpx;
- local_y = localprocessindex/lpx;
- // determine my coordinates (x,y) -- r=x*a+y in the 2d processor array
+ int localprocessindex = r % CORENUM;
+ int local_x, local_y;
+ local_x = localprocessindex % lpx;
+ local_y = localprocessindex / lpx;
+ // determine my coordinates (x,y) -- r=x*a+y in the 2d processor array
// int rx = r % px;
// int ry = r / px;
int rx;
int ry;
- rx = lpx*nodeidx+local_x;
- ry = lpy*nodeidy+local_y;
- int noden, nodes, nodew, nodee;
- if(nodeidy < ny-1)
- {
- if(CH ==1 )
- nodes = nodeid+ nx;
- if(CH == 2)
- nodes = nodeid+1;
- if(CH == 3)
- {
- if(nodeidx %2 ==0)
- nodes=nodeid+1;
- else
- nodes = nodeid-1;
- }
- }
- else
- {
- nodes = -1;
- }
- if(nodeidy == 0)
- {
- noden = -1;
- }
- else
- {
- if(CH==1)
- noden = nodeid - nx;
- if(CH == 2)
- noden = nodeid-1;
- if(CH == 3)
- {
- if(nodeidx %2 == 0)
- noden = nodeid-1;
- else
- noden = nodeid+1;
- }
-
- }
- if(nodeidx == 0)
- {
- nodew = -1;
- }
- else
- {
- if(CH ==1)
- nodew = nodeid -1;
- if(CH == 2)
- nodew = nodeid -ny;
- if(CH == 3)
- {
-
- if(nodeidx%2 == 0)
- nodew = nodeid - nodeidy -1-nodeidy;
- else
- {
- nodew = nodeid +nodeidy+1-2*ny+nodeidy;
- }
- }
- }
- if(nodeidx == nx -1)
- {
- nodee = -1;
- }
- else
- {
- if(CH==1)
- {
- nodee = nodeid+1;
- }
- if(CH==2)
- {
- nodee = nodeid + ny;
- }
- if(CH==3)
- {
- if(nodeidx%2 == 0)
- {
- nodee = nodeid - nodeidy + ny + ny-1-nodeidy;
- }
- else
- {
- nodee = nodeid +nodeidy +1 + nodeidy;
- }
- }
- }
- int north1, south1, west1, east1;
- if(local_y != 0)
- {
- //south
- north1 = r - lpx;
- }
- else
- {
- if(noden == -1)
- north1 = -1;
- else
- {
- north1 = r + (noden - nodeid)*CORENUM - r%CORENUM +(lpy-1) * lpx + local_x;
- //north1 = r + (noden - nodeid)*CORENUM - r%CORENUM + local_x;
- }
- }
- if(local_y < lpy-1)
- {
- //north
- south1 = r + lpx;
- }
- else
- {
- if(nodes == -1)
- south1 = -1;
- else
- {
- south1 = r + (nodes - nodeid)*CORENUM - r%CORENUM + local_x;
- //south1 = r + (noden - nodeid)*CORENUM - r%CORENUM +(lpy-1) * lpx + local_x;
- }
- }
- if(local_x != 0)
- {
- //west
- west1 = r-1;
- }
- else
- {
- if(nodew == -1)
- west1 = -1;
- else
- {
- west1 = r + (nodew - nodeid)*CORENUM - r%CORENUM + local_y*lpx + lpx-1;
- }
- }
- if(local_x == lpx-1)
- {
- //east
- if(nodee == -1)
- {
- east1 = -1;
- }
- else
- {
- east1 = r + (nodee - nodeid) * CORENUM - r%CORENUM + local_y*lpx;
- }
- }
- else
- {
-
- east1 = r+1;
- }
-
- // determine my four neighbors
- for(int i=0; i<p; i++)
- {
- if(r==i)
- printf("id=%d, sr=%d, nodeid=%d, north1=%d, south1=%d, west1=%d, east1=%d\n", r,sr,nodeid,north1,south1,west1,east1);
- MPI_Barrier(MPI_COMM_WORLD);
- }
- int north = north1; if(north1 < 0) north = MPI_PROC_NULL;
- int south = south1; if(south1 < 0) south = MPI_PROC_NULL;
- int west= west1; if(west1< 0) west = MPI_PROC_NULL;
- int east = east1; if(east1 < 0) east = MPI_PROC_NULL;
- //int temp = north; north = south; south = temp;
- int bx = n/px; // block size in x
- int by = n/py; // block size in y
- int offx = rx*bx; // offset in x
- int offy = ry*by; // offset in y
- double* volatile memO;
- double* volatile memN;
-
- //printf("rank %d N S W E is: %d %d %d %d\n",r,north, south, west, east);
- MPI_Win winO;
- MPI_Win winN;
- MPI_Win_allocate_shared((bx+2)*(by+2)*sizeof(double),1,MPI_INFO_NULL,shmcomm,(void*)&memO,&winO);
- MPI_Win_allocate_shared((bx+2)*(by+2)*sizeof(double),1,MPI_INFO_NULL,shmcomm,(void*)&memN,&winN);
- double* volatile westptrO;
- double* volatile eastptrO;
- double* volatile northptrO;
- double* volatile southptrO;
- double* volatile westptrN;
- double* volatile eastptrN;
- double* volatile northptrN;
- double* volatile southptrN;
- int needN = 0; int needS = 0; int needW = 0; int needE = 0;
- if(north != -1 && north / CORENUM == r/CORENUM)
- {
- needN = 1;
- }
- if(south != -1 && south / CORENUM == r/CORENUM)
- {
- needS = 1;
- }
- if(west != -1 && west / CORENUM == r/CORENUM)
- {
- needW = 1;
- }
- if(east != -1 && east / CORENUM == r/CORENUM)
- {
- needE = 1;
- }
- //temp = needN; needN =needS; needS = temp;
- MPI_Aint sz;
- int dsp_unit;
- if(needN)
- {
- MPI_Win_shared_query(winO,sr-lpx,&sz,&dsp_unit,(void*)&northptrO);
- MPI_Win_shared_query(winN,sr-lpx,&sz,&dsp_unit,(void*)&northptrN);
- }
- if(needS)
- {
- MPI_Win_shared_query(winO,sr+lpx,&sz,&dsp_unit,(void*)&southptrO);
- MPI_Win_shared_query(winN,sr+lpx,&sz,&dsp_unit,(void*)&southptrN);
- }
- if(needW)
- {
- MPI_Win_shared_query(winO,sr-1,&sz,&dsp_unit,(void*)&westptrO);
- MPI_Win_shared_query(winN,sr-1,&sz,&dsp_unit,(void*)&westptrN);
- }
- if(needE)
- {
- MPI_Win_shared_query(winO,sr+1,&sz,&dsp_unit,(void*)&eastptrO);
- MPI_Win_shared_query(winN,sr+1,&sz,&dsp_unit,(void*)&eastptrN);
- }
-
- // printf("rank %d N S W E is: %d %d %d %d\n",r,north, south, west, east);
- // decompose the domain
- // printf("%i (%i,%i) - w: %i, e: %i, n: %i, s: %i\n", r, ry,rx,west,east,north,south);
- // allocate two work arrays
- double* volatile tmp;
- // initialize three heat sources
- const int nsources=3;
- int sources[nsources][2] = {{n/2,n/2}, {n/3,n/3}, {n*4/5,n*8/9}};
- int locnsources=0; // number of sources in my area
- int locsources[nsources][2]; // sources local to my rank
- for (int i=0; i<nsources; ++i) { // determine which sources are in my patch
- int locx = sources[i][0] - offx;
- int locy = sources[i][1] - offy;
- if(locx >= 0 && locx < bx && locy >= 0 && locy < by) {
- locsources[locnsources][0] = locx+1; // offset by halo zone
- locsources[locnsources][1] = locy+1; // offset by halo zone
- locnsources++;
- }
- }
+ rx = lpx * nodeidx + local_x;
+ ry = lpy * nodeidy + local_y;
+ int noden, nodes, nodew, nodee;
+ if (nodeidy < ny - 1) {
+ if (CH == 1)
+ nodes = nodeid + nx;
+ if (CH == 2)
+ nodes = nodeid + 1;
+ if (CH == 3) {
+ if (nodeidx % 2 == 0)
+ nodes = nodeid + 1;
+ else
+ nodes = nodeid - 1;
+ }
+ }
+ else {
+ nodes = -1;
+ }
+ if (nodeidy == 0) {
+ noden = -1;
+ }
+ else {
+ if (CH == 1)
+ noden = nodeid - nx;
+ if (CH == 2)
+ noden = nodeid - 1;
+ if (CH == 3) {
+ if (nodeidx % 2 == 0)
+ noden = nodeid - 1;
+ else
+ noden = nodeid + 1;
+ }
+
+ }
+ if (nodeidx == 0) {
+ nodew = -1;
+ }
+ else {
+ if (CH == 1)
+ nodew = nodeid - 1;
+ if (CH == 2)
+ nodew = nodeid - ny;
+ if (CH == 3) {
+
+ if (nodeidx % 2 == 0)
+ nodew = nodeid - nodeidy - 1 - nodeidy;
+ else {
+ nodew = nodeid + nodeidy + 1 - 2 * ny + nodeidy;
+ }
+ }
+ }
+ if (nodeidx == nx - 1) {
+ nodee = -1;
+ }
+ else {
+ if (CH == 1) {
+ nodee = nodeid + 1;
+ }
+ if (CH == 2) {
+ nodee = nodeid + ny;
+ }
+ if (CH == 3) {
+ if (nodeidx % 2 == 0) {
+ nodee = nodeid - nodeidy + ny + ny - 1 - nodeidy;
+ }
+ else {
+ nodee = nodeid + nodeidy + 1 + nodeidy;
+ }
+ }
+ }
+ int north1, south1, west1, east1;
+ if (local_y != 0) {
+ //south
+ north1 = r - lpx;
+ }
+ else {
+ if (noden == -1)
+ north1 = -1;
+ else {
+ north1 = r + (noden - nodeid) * CORENUM - r % CORENUM + (lpy - 1) * lpx + local_x;
+ //north1 = r + (noden - nodeid)*CORENUM - r%CORENUM + local_x;
+ }
+ }
+ if (local_y < lpy - 1) {
+ //north
+ south1 = r + lpx;
+ }
+ else {
+ if (nodes == -1)
+ south1 = -1;
+ else {
+ south1 = r + (nodes - nodeid) * CORENUM - r % CORENUM + local_x;
+ //south1 = r + (noden - nodeid)*CORENUM - r%CORENUM +(lpy-1) * lpx + local_x;
+ }
+ }
+ if (local_x != 0) {
+ //west
+ west1 = r - 1;
+ }
+ else {
+ if (nodew == -1)
+ west1 = -1;
+ else {
+ west1 = r + (nodew - nodeid) * CORENUM - r % CORENUM + local_y * lpx + lpx - 1;
+ }
+ }
+ if (local_x == lpx - 1) {
+ //east
+ if (nodee == -1) {
+ east1 = -1;
+ }
+ else {
+ east1 = r + (nodee - nodeid) * CORENUM - r % CORENUM + local_y * lpx;
+ }
+ }
+ else {
- double tp = 0.0;
- // allocate communication buffers
- double *sbufnorth = (double*)calloc(1,bx*sizeof(double)); // send buffers
- double *sbufsouth = (double*)calloc(1,bx*sizeof(double));
- double *sbufeast = (double*)calloc(1,by*sizeof(double));
- double *sbufwest = (double*)calloc(1,by*sizeof(double));
- double *rbufnorth = (double*)calloc(1,bx*sizeof(double)); // receive buffers
- double *rbufsouth = (double*)calloc(1,bx*sizeof(double));
- double *rbufeast = (double*)calloc(1,by*sizeof(double));
- double *rbufwest = (double*)calloc(1,by*sizeof(double));
+ east1 = r + 1;
+ }
- double thetime[6];
- thetime[0] = thetime[1] = thetime[2] = thetime[3] =thetime [4] = thetime[5] = 0.0;
- double t=-MPI_Wtime(); // take time
- double heat; // total heat in system
- //the following is the loop for niters steps.--zhuxm
- //double* tempnew = (double*)malloc(bx*sizeof(double));
- //int basesize = 2*(bx+by);
- //int halfindex = basesize+4;
- //MPI_Win_lock_all(0, winO);
- //MPI_Win_lock_all(0, winN);
+ // determine my four neighbors
+ for (int i = 0; i < p; i++) {
+ if (r == i)
+ printf("id=%d, sr=%d, nodeid=%d, north1=%d, south1=%d, west1=%d, east1=%d\n", r, sr,
+ nodeid, north1, south1, west1, east1);
+ MPI_Barrier(MPI_COMM_WORLD);
+ }
+ int north = north1;
+ if (north1 < 0)
+ north = MPI_PROC_NULL;
+ int south = south1;
+ if (south1 < 0)
+ south = MPI_PROC_NULL;
+ int west = west1;
+ if (west1 < 0)
+ west = MPI_PROC_NULL;
+ int east = east1;
+ if (east1 < 0)
+ east = MPI_PROC_NULL;
+ //int temp = north; north = south; south = temp;
+ int bx = n / px; // block size in x
+ int by = n / py; // block size in y
+ int offx = rx * bx; // offset in x
+ int offy = ry * by; // offset in y
+ double *volatile memO;
+ double *volatile memN;
- MPI_Barrier(shmcomm);
- for(int iter=0; iter<niters; ++iter) {
- // refresh heat sources
- //MPI_Barrier(comm);
- //if(!r) printf("Step %d\n",iter);
- double time1 = MPI_Wtime();
- for(int i=0; i<locnsources; ++i) {
- memO[ind(locsources[i][0],locsources[i][1])] += energy; // heat source
- }
- double time2 = MPI_Wtime();
- // exchange data with neighbors
- MPI_Request reqs[8];
- if(!needN)
- for(int i=0; i<bx; ++i) sbufnorth[i] = memO[ind(i+1,1)]; // pack loop - last valid region
- if(!needS)
- for(int i=0; i<bx; ++i) sbufsouth[i] = memO[ind(i+1,by)]; // pack loop
- if(!needE)
- for(int i=0; i<by; ++i) sbufeast[i] = memO[ind(bx,i+1)]; // pack loop
- if(!needW)
- for(int i=0; i<by; ++i) sbufwest[i] = memO[ind(1,i+1)]; // pack loop
+ //printf("rank %d N S W E is: %d %d %d %d\n",r,north, south, west, east);
+ MPI_Win winO;
+ MPI_Win winN;
+ MPI_Win_allocate_shared((bx + 2) * (by + 2) * sizeof(double), 1, MPI_INFO_NULL, shmcomm,
+ (void *) &memO, &winO);
+ MPI_Win_allocate_shared((bx + 2) * (by + 2) * sizeof(double), 1, MPI_INFO_NULL, shmcomm,
+ (void *) &memN, &winN);
+ double *volatile westptrO;
+ double *volatile eastptrO;
+ double *volatile northptrO;
+ double *volatile southptrO;
+ double *volatile westptrN;
+ double *volatile eastptrN;
+ double *volatile northptrN;
+ double *volatile southptrN;
+ int needN = 0;
+ int needS = 0;
+ int needW = 0;
+ int needE = 0;
+ if (north != -1 && north / CORENUM == r / CORENUM) {
+ needN = 1;
+ }
+ if (south != -1 && south / CORENUM == r / CORENUM) {
+ needS = 1;
+ }
+ if (west != -1 && west / CORENUM == r / CORENUM) {
+ needW = 1;
+ }
+ if (east != -1 && east / CORENUM == r / CORENUM) {
+ needE = 1;
+ }
+ //temp = needN; needN =needS; needS = temp;
+ MPI_Aint sz;
+ int dsp_unit;
+ if (needN) {
+ MPI_Win_shared_query(winO, sr - lpx, &sz, &dsp_unit, (void *) &northptrO);
+ MPI_Win_shared_query(winN, sr - lpx, &sz, &dsp_unit, (void *) &northptrN);
+ }
+ if (needS) {
+ MPI_Win_shared_query(winO, sr + lpx, &sz, &dsp_unit, (void *) &southptrO);
+ MPI_Win_shared_query(winN, sr + lpx, &sz, &dsp_unit, (void *) &southptrN);
+ }
+ if (needW) {
+ MPI_Win_shared_query(winO, sr - 1, &sz, &dsp_unit, (void *) &westptrO);
+ MPI_Win_shared_query(winN, sr - 1, &sz, &dsp_unit, (void *) &westptrN);
+ }
+ if (needE) {
+ MPI_Win_shared_query(winO, sr + 1, &sz, &dsp_unit, (void *) &eastptrO);
+ MPI_Win_shared_query(winN, sr + 1, &sz, &dsp_unit, (void *) &eastptrN);
+ }
+
+ // printf("rank %d N S W E is: %d %d %d %d\n",r,north, south, west, east);
+ // decompose the domain
+ // printf("%i (%i,%i) - w: %i, e: %i, n: %i, s: %i\n", r, ry,rx,west,east,north,south);
+ // allocate two work arrays
+ double *volatile tmp;
+ // initialize three heat sources
+ const int nsources = 3;
+ int sources[nsources][2] = { {n / 2, n / 2}, {n / 3, n / 3}, {n * 4 / 5, n * 8 / 9} };
+ int locnsources = 0; // number of sources in my area
+ int locsources[nsources][2]; // sources local to my rank
+ for (int i = 0; i < nsources; ++i) { // determine which sources are in my patch
+ int locx = sources[i][0] - offx;
+ int locy = sources[i][1] - offy;
+ if (locx >= 0 && locx < bx && locy >= 0 && locy < by) {
+ locsources[locnsources][0] = locx + 1; // offset by halo zone
+ locsources[locnsources][1] = locy + 1; // offset by halo zone
+ locnsources++;
+ }
+ }
- double time3 = MPI_Wtime();
-
- int index = 0;
- if(!needN)
- {
- MPI_Isend(sbufnorth, bx, MPI_DOUBLE, north, 9, comm, &reqs[index++]);
- MPI_Irecv(rbufnorth, bx, MPI_DOUBLE, north, 9, comm, &reqs[index++]);
- }
- if(!needE)
- {
- MPI_Isend(sbufeast, by, MPI_DOUBLE, east, 9, comm, &reqs[index++]);
- MPI_Irecv(rbufeast, by, MPI_DOUBLE, east, 9, comm, &reqs[index++]);
- }
- if(!needW)
- {
- MPI_Isend(sbufwest, by, MPI_DOUBLE, west, 9, comm, &reqs[index++]);
- MPI_Irecv(rbufwest, by, MPI_DOUBLE, west, 9, comm, &reqs[index++]);
- }
- if(!needS)
- {
- MPI_Isend(sbufsouth, bx, MPI_DOUBLE, south, 9, comm, &reqs[index++]);
- MPI_Irecv(rbufsouth, bx, MPI_DOUBLE, south, 9, comm, &reqs[index++]);
- }
- printf("id = %d, iter=%d, OK\n", r, iter);
- int ReadN, ReadS, ReadW, ReadE;
- ReadN = ReadS = ReadW = ReadE = 0;
- if(!needN)
- {
- ReadN = 1;
- }
- if(!needS)
- {
- ReadS = 1;
- }
- if(!needW)
- {
- ReadW = 1;
- }
- if(!needE)
- {
- ReadE = 1;
- }
- //order: West0. East1, North2, South3
- while(!(ReadW * ReadE * ReadN * ReadS))
- {
- if(!ReadW)
- {
- for(int i=0; i<by; i++)
- // memO[(i+1)*(bx+2)]=westptrO[(i+1)*(bx+2)+bx];
- ReadW = 1;
- }
- if(!ReadE)
- {
- for(int i=0; i<by; i++)
- // memO[(i+1)*(bx+2)+bx+1]=eastptrO[(i+1)*(bx+2)+1];
- ReadE = 1;
- }
- if(!ReadN)
- {
- //memcpy(rbufnorth,northptr+2*by+bx,bx*sizeof(double));
- memcpy(memO+1,northptrO+(bx+2)*by+1,bx*sizeof(double));
- //northptr[basesize+3] = -1;
- ReadN = 1;
- }
- if(!ReadS)
- {
- //memcpy(rbufsouth,southptr+2*by, bx*sizeof(double));
- memcpy(memO+(bx+2)*(by+1)+1,southptrO+bx+2+1, bx*sizeof(double));
- //southptr[basesize+2] = -1;
- ReadS = 1;
- }
- }
- /*
- MPI_Isend(sbufnorth, bx, MPI_DOUBLE, north, 9, comm, &reqs[0]);
- MPI_Isend(sbufsouth, bx, MPI_DOUBLE, south, 9, comm, &reqs[1]);
- MPI_Isend(sbufeast, by, MPI_DOUBLE, east, 9, comm, &reqs[2]);
- MPI_Isend(sbufwest, by, MPI_DOUBLE, west, 9, comm, &reqs[3]);
- MPI_Irecv(rbufnorth, bx, MPI_DOUBLE, north, 9, comm, &reqs[4]);
- MPI_Irecv(rbufsouth, bx, MPI_DOUBLE, south, 9, comm, &reqs[5]);
- MPI_Irecv(rbufeast, by, MPI_DOUBLE, east, 9, comm, &reqs[6]);
- MPI_Irecv(rbufwest, by, MPI_DOUBLE, west, 9, comm, &reqs[7]);
- */
- MPI_Waitall(index, reqs, MPI_STATUS_IGNORE);
- double time4 = MPI_Wtime();
- if(!needN)
- for(int i=0; i<bx; ++i) memO[ind(i+1,0)] = rbufnorth[i]; // unpack loop - into ghost cells
- if(!needS)
- for(int i=0; i<bx; ++i) memO[ind(i+1,by+1)] = rbufsouth[i]; // unpack loop
- if(!needE)
- for(int i=0; i<by; ++i) memO[ind(bx+1,i+1)] = rbufeast[i]; // unpack loop
- if(!needW)
- for(int i=0; i<by; ++i) memO[ind(0,i+1)] = rbufwest[i]; // unpack loop
- double time5 = MPI_Wtime();
- heat = 0.0;
- tp = -MPI_Wtime();
- //double* aold2 = aold;
- //memcpy(aold2,aold,(bx+2)*(by+2)*sizeof(double));
- //double* anewtemp = malloc(by*sizeof(double));
- //for(int i=1; i<bx+1; ++i) {
- //for(int j=1; j<by+1; ++j) {
- for(int j=1; j<by+1; ++j) {
- for(int i=1; i<bx+1; ++i) {
- //double tt = anew[ind(i,j)]/2.0;
- double tt = memN[ind(i,j)]/2.0 + (memO[ind(i-1,j)] + memO[ind(i+1,j)] + memO[ind(i,j-1)] + memO[ind(i,j+1)])/4.0/2.0;
- //double tt = anew[ind(i,j)]/2.0 + ( aold[ind(i,j-1)] + aold[ind(i,j+1)])/4.0/2.0;
- //tt += (aold[ind(i-1,j)] + aold[ind(i+1,j)] + aold[ind(i,j-1)] + aold[ind(i,j+1)])/4.0/2.0;
- memN[ind(i,j)] = tt;
- //double d = anew[ind(i,j)]/2.0 + ((double)r+1.0+double(r+3.46)+double(iter))/4.0/2.0;
- //anew[ind(i,j)] = anew[ind(i,j)]/2.0;
- //tempnew[i-1] = tt;
- heat += memN[ind(i,j)];
- }
- }
- // swap arrays
- double time6 = MPI_Wtime();
- thetime[0] += (time2-time1);
- thetime[1] += (time3-time2);
- thetime[2] += (time4-time3);
- thetime[3] += (time5-time4);
- thetime[4] += (time6-time5);
- thetime[5] += (time6-time1);
+ double tp = 0.0;
+ // allocate communication buffers
+ double *sbufnorth = (double *) calloc(1, bx * sizeof(double)); // send buffers
+ double *sbufsouth = (double *) calloc(1, bx * sizeof(double));
+ double *sbufeast = (double *) calloc(1, by * sizeof(double));
+ double *sbufwest = (double *) calloc(1, by * sizeof(double));
+ double *rbufnorth = (double *) calloc(1, bx * sizeof(double)); // receive buffers
+ double *rbufsouth = (double *) calloc(1, bx * sizeof(double));
+ double *rbufeast = (double *) calloc(1, by * sizeof(double));
+ double *rbufwest = (double *) calloc(1, by * sizeof(double));
+
+ double thetime[6];
+ thetime[0] = thetime[1] = thetime[2] = thetime[3] = thetime[4] = thetime[5] = 0.0;
+ double t = -MPI_Wtime(); // take time
+ double heat; // total heat in system
+ //the following is the loop for niters steps.--zhuxm
+ //double* tempnew = (double*)malloc(bx*sizeof(double));
+ //int basesize = 2*(bx+by);
+ //int halfindex = basesize+4;
+ //MPI_Win_lock_all(0, winO);
+ //MPI_Win_lock_all(0, winN);
- tp += MPI_Wtime();
- tmp=memN; memN=memO; memO=tmp;
- tmp=northptrN; northptrN=northptrO; northptrO=tmp;
- tmp=southptrN; southptrN=southptrO; southptrO=tmp;
- tmp=eastptrN; eastptrN=eastptrO; eastptrO=tmp;
- tmp=westptrN; westptrN=northptrO; westptrO=tmp;
MPI_Barrier(shmcomm);
- }
- t+=MPI_Wtime();
+ for (int iter = 0; iter < niters; ++iter) {
+ // refresh heat sources
+ //MPI_Barrier(comm);
+ //if (!r) printf("Step %d\n",iter);
+ double time1 = MPI_Wtime();
+ for (int i = 0; i < locnsources; ++i) {
+ memO[ind(locsources[i][0], locsources[i][1])] += energy; // heat source
+ }
+ double time2 = MPI_Wtime();
+ // exchange data with neighbors
+ MPI_Request reqs[8];
+ if (!needN)
+ for (int i = 0; i < bx; ++i)
+ sbufnorth[i] = memO[ind(i + 1, 1)]; // pack loop - last valid region
+ if (!needS)
+ for (int i = 0; i < bx; ++i)
+ sbufsouth[i] = memO[ind(i + 1, by)]; // pack loop
+ if (!needE)
+ for (int i = 0; i < by; ++i)
+ sbufeast[i] = memO[ind(bx, i + 1)]; // pack loop
+ if (!needW)
+ for (int i = 0; i < by; ++i)
+ sbufwest[i] = memO[ind(1, i + 1)]; // pack loop
- // get final heat in the system
- double rheat;
- MPI_Allreduce(&heat, &rheat, 1, MPI_DOUBLE, MPI_SUM, comm);
- double totaltime[6];
- MPI_Allreduce(thetime,totaltime,6,MPI_DOUBLE,MPI_SUM,comm);
-if(!r)
- {
- printf("[%i] last heat: %f time: %f\n", r, rheat, t);
- printf("Times are: %lf, %lf, %lf, %lf, %lf, --> %lf\n",totaltime[0]/p,totaltime[1]/p,totaltime[2]/p,totaltime[3]/p,totaltime[4]/p,totaltime[5]/p);
+ double time3 = MPI_Wtime();
+
+ int index = 0;
+ if (!needN) {
+ MPI_Isend(sbufnorth, bx, MPI_DOUBLE, north, 9, comm, &reqs[index++]);
+ MPI_Irecv(rbufnorth, bx, MPI_DOUBLE, north, 9, comm, &reqs[index++]);
+ }
+ if (!needE) {
+ MPI_Isend(sbufeast, by, MPI_DOUBLE, east, 9, comm, &reqs[index++]);
+ MPI_Irecv(rbufeast, by, MPI_DOUBLE, east, 9, comm, &reqs[index++]);
+ }
+ if (!needW) {
+ MPI_Isend(sbufwest, by, MPI_DOUBLE, west, 9, comm, &reqs[index++]);
+ MPI_Irecv(rbufwest, by, MPI_DOUBLE, west, 9, comm, &reqs[index++]);
+ }
+ if (!needS) {
+ MPI_Isend(sbufsouth, bx, MPI_DOUBLE, south, 9, comm, &reqs[index++]);
+ MPI_Irecv(rbufsouth, bx, MPI_DOUBLE, south, 9, comm, &reqs[index++]);
+ }
+ printf("id = %d, iter=%d, OK\n", r, iter);
+ int ReadN, ReadS, ReadW, ReadE;
+ ReadN = ReadS = ReadW = ReadE = 0;
+ if (!needN) {
+ ReadN = 1;
+ }
+ if (!needS) {
+ ReadS = 1;
}
- MPI_Barrier(comm);
+ if (!needW) {
+ ReadW = 1;
+ }
+ if (!needE) {
+ ReadE = 1;
+ }
+ //order: West0. East1, North2, South3
+ while (!(ReadW * ReadE * ReadN * ReadS)) {
+ if (!ReadW) {
+ for (int i = 0; i < by; i++)
+ // memO[(i+1)*(bx+2)]=westptrO[(i+1)*(bx+2)+bx];
+ ReadW = 1;
+ }
+ if (!ReadE) {
+ for (int i = 0; i < by; i++)
+ // memO[(i+1)*(bx+2)+bx+1]=eastptrO[(i+1)*(bx+2)+1];
+ ReadE = 1;
+ }
+ if (!ReadN) {
+ //memcpy(rbufnorth,northptr+2*by+bx,bx*sizeof(double));
+ memcpy(memO + 1, northptrO + (bx + 2) * by + 1, bx * sizeof(double));
+ //northptr[basesize+3] = -1;
+ ReadN = 1;
+ }
+ if (!ReadS) {
+ //memcpy(rbufsouth,southptr+2*by, bx*sizeof(double));
+ memcpy(memO + (bx + 2) * (by + 1) + 1, southptrO + bx + 2 + 1, bx * sizeof(double));
+ //southptr[basesize+2] = -1;
+ ReadS = 1;
+ }
+ }
+ /*
+ * MPI_Isend(sbufnorth, bx, MPI_DOUBLE, north, 9, comm, &reqs[0]);
+ * MPI_Isend(sbufsouth, bx, MPI_DOUBLE, south, 9, comm, &reqs[1]);
+ * MPI_Isend(sbufeast, by, MPI_DOUBLE, east, 9, comm, &reqs[2]);
+ * MPI_Isend(sbufwest, by, MPI_DOUBLE, west, 9, comm, &reqs[3]);
+ * MPI_Irecv(rbufnorth, bx, MPI_DOUBLE, north, 9, comm, &reqs[4]);
+ * MPI_Irecv(rbufsouth, bx, MPI_DOUBLE, south, 9, comm, &reqs[5]);
+ * MPI_Irecv(rbufeast, by, MPI_DOUBLE, east, 9, comm, &reqs[6]);
+ * MPI_Irecv(rbufwest, by, MPI_DOUBLE, west, 9, comm, &reqs[7]);
+ */
+ MPI_Waitall(index, reqs, MPI_STATUS_IGNORE);
+ double time4 = MPI_Wtime();
+ if (!needN)
+ for (int i = 0; i < bx; ++i)
+ memO[ind(i + 1, 0)] = rbufnorth[i]; // unpack loop - into ghost cells
+ if (!needS)
+ for (int i = 0; i < bx; ++i)
+ memO[ind(i + 1, by + 1)] = rbufsouth[i]; // unpack loop
+ if (!needE)
+ for (int i = 0; i < by; ++i)
+ memO[ind(bx + 1, i + 1)] = rbufeast[i]; // unpack loop
+ if (!needW)
+ for (int i = 0; i < by; ++i)
+ memO[ind(0, i + 1)] = rbufwest[i]; // unpack loop
+ double time5 = MPI_Wtime();
+ heat = 0.0;
+ tp = -MPI_Wtime();
+ //double* aold2 = aold;
+ //memcpy(aold2,aold,(bx+2)*(by+2)*sizeof(double));
+ //double* anewtemp = malloc(by*sizeof(double));
+ //for(int i=1; i<bx+1; ++i) {
+ //for(int j=1; j<by+1; ++j) {
+ for (int j = 1; j < by + 1; ++j) {
+ for (int i = 1; i < bx + 1; ++i) {
+ //double tt = anew[ind(i,j)]/2.0;
+ double tt =
+ memN[ind(i, j)] / 2.0 + (memO[ind(i - 1, j)] + memO[ind(i + 1, j)] +
+ memO[ind(i, j - 1)] + memO[ind(i, j + 1)]) / 4.0 / 2.0;
+ //double tt = anew[ind(i,j)]/2.0 + (aold[ind(i,j-1)] + aold[ind(i,j+1)])/4.0/2.0;
+ //tt += (aold[ind(i-1,j)] + aold[ind(i+1,j)] + aold[ind(i,j-1)] + aold[ind(i,j+1)])/4.0/2.0;
+ memN[ind(i, j)] = tt;
+ //double d = anew[ind(i,j)]/2.0 + ((double)r+1.0+double(r+3.46)+double(iter))/4.0/2.0;
+ //anew[ind(i,j)] = anew[ind(i,j)]/2.0;
+ //tempnew[i-1] = tt;
+ heat += memN[ind(i, j)];
+ }
+ }
+ // swap arrays
+ double time6 = MPI_Wtime();
+ thetime[0] += (time2 - time1);
+ thetime[1] += (time3 - time2);
+ thetime[2] += (time4 - time3);
+ thetime[3] += (time5 - time4);
+ thetime[4] += (time6 - time5);
+ thetime[5] += (time6 - time1);
+
+ tp += MPI_Wtime();
+ tmp = memN;
+ memN = memO;
+ memO = tmp;
+ tmp = northptrN;
+ northptrN = northptrO;
+ northptrO = tmp;
+ tmp = southptrN;
+ southptrN = southptrO;
+ southptrO = tmp;
+ tmp = eastptrN;
+ eastptrN = eastptrO;
+ eastptrO = tmp;
+ tmp = westptrN;
+ westptrN = northptrO;
+ westptrO = tmp;
+ MPI_Barrier(shmcomm);
+ }
+ t += MPI_Wtime();
+
+ // get final heat in the system
+ double rheat;
+ MPI_Allreduce(&heat, &rheat, 1, MPI_DOUBLE, MPI_SUM, comm);
+ double totaltime[6];
+ MPI_Allreduce(thetime, totaltime, 6, MPI_DOUBLE, MPI_SUM, comm);
+ if (!r) {
+ printf("[%i] last heat: %f time: %f\n", r, rheat, t);
+ printf("Times are: %lf, %lf, %lf, %lf, %lf, --> %lf\n", totaltime[0] / p, totaltime[1] / p,
+ totaltime[2] / p, totaltime[3] / p, totaltime[4] / p, totaltime[5] / p);
+ }
+ MPI_Barrier(comm);
// printf("Rank %d times are: %lf, %lf, %lf, %lf, %lf, --> %lf\n",r, thetime[0],thetime[1],thetime[2],thetime[3],thetime[4],thetime[5]);
- MPI_Finalize();
+ MPI_Finalize();
}
http://git.mpich.org/software/dev/stencil.git/commitdiff/8ef7f7c268ec9f3866…
commit 8ef7f7c268ec9f3866f90ad4c2f51c51495b7a15
Author: Pavan Balaji <balaji(a)anl.gov>
Date: Sat Sep 6 19:13:39 2014 -0500
Initial draft of the stencil code from Shigang.
diff --git a/stencil.cpp b/stencil.cpp
new file mode 100644
index 0000000..b4d7f2e
--- /dev/null
+++ b/stencil.cpp
@@ -0,0 +1,532 @@
+/*
+ * Copyright (c) 2012 Torsten Hoefler. All rights reserved.
+ *
+ * Author(s): Torsten Hoefler <htor(a)illinois.edu>
+ *
+ */
+
+#include "stencil_par.h"
+int main(int argc, char **argv) {
+
+ int provide;
+ MPI_Init(&argc,&argv);
+ int r,p;
+ MPI_Comm comm = MPI_COMM_WORLD;
+ MPI_Comm_rank(comm, &r);
+ MPI_Comm_size(comm, &p);
+ int n, energy, niters,nx,ny, lpx,lpy,px, py;
+
+ MPI_Comm shmcomm;
+ MPI_Comm_split_type(comm, MPI_COMM_TYPE_SHARED, 0, MPI_INFO_NULL, &shmcomm);
+ int sr, sp; // rank and size in shmem comm
+
+ MPI_Comm_size(shmcomm, &sp);
+ MPI_Comm_rank(shmcomm, &sr);
+ printf("shmcomm size = %d\n",sp);
+ int CORENUM = 12;
+ if (r==0) {
+ // argument checking
+ if(argc < 8) {
+ if(!r) printf("usage: stencil_mpi <n> <energy> <niters> <nx> <ny> <lpx> <lpy>\n");
+ MPI_Finalize();
+ exit(1);
+ }
+
+ n = atoi(argv[1]); // nxn grid
+ energy = atoi(argv[2]); // energy to be injected per iteration
+ niters = atoi(argv[3]); // number of iterations
+
+ nx=atoi(argv[4]); // 1st dim processes
+ ny=atoi(argv[5]); // 2nd dim processes
+ lpx=atoi(argv[6]); // 1st dim processes
+ lpy=atoi(argv[7]); // 2nd dim processes
+ px = nx*lpx;
+ py = ny*lpy;
+ if(px * py != p) MPI_Abort(comm, 1);// abort if px or py are wrong
+ if(n % py != 0) MPI_Abort(comm, 2); // abort px needs to divide n
+ if(n % px != 0) MPI_Abort(comm, 3); // abort py needs to divide n
+ if(nx*ny != p/CORENUM) MPI_Abort(comm,66);
+ if(lpx*lpy != CORENUM) MPI_Abort(comm,77);
+ // distribute arguments
+ int args[7] = {n, energy, niters, nx,ny,lpx,lpy};
+ MPI_Bcast(args, 7, MPI_INT, 0, comm);
+ }
+ else {
+ int args[7];
+ MPI_Bcast(args, 7, MPI_INT, 0, comm);
+ n=args[0]; energy=args[1]; niters=args[2];
+
+ nx=args[3]; ny=args[4];
+ lpx = args[5];
+ lpy = args[6];
+
+ px = nx*lpx;
+ py = ny*lpy;
+ }
+
+ int nodenum = nx*ny;
+ int nodeidx, nodeidy;
+ int nodeid = r/CORENUM;
+ int CH = 2;
+ if(CH == 1)
+ {
+ nodeidx = nodeid % nx;
+ nodeidy = nodeid / nx;
+ }
+ else if(CH == 2)
+ {
+ nodeidx = nodeid / ny;
+ nodeidy = nodeid % ny;
+ }
+ else if(CH == 3)
+ {
+ nodeidx = nodeid / ny;
+ nodeidy = nodeid % ny;
+ if(nodeidx % 2 != 0)
+ {
+ nodeidy = ny-1 - nodeidy;
+ }
+ }
+//nodeidx idy is the node coordinates(x,y)
+//
+ int localprocessindex = r%CORENUM;
+ int local_x, local_y;
+ local_x = localprocessindex%lpx;
+ local_y = localprocessindex/lpx;
+ // determine my coordinates (x,y) -- r=x*a+y in the 2d processor array
+ // int rx = r % px;
+ // int ry = r / px;
+ int rx;
+ int ry;
+ rx = lpx*nodeidx+local_x;
+ ry = lpy*nodeidy+local_y;
+ int noden, nodes, nodew, nodee;
+ if(nodeidy < ny-1)
+ {
+ if(CH ==1 )
+ nodes = nodeid+ nx;
+ if(CH == 2)
+ nodes = nodeid+1;
+ if(CH == 3)
+ {
+ if(nodeidx %2 ==0)
+ nodes=nodeid+1;
+ else
+ nodes = nodeid-1;
+ }
+ }
+ else
+ {
+ nodes = -1;
+ }
+ if(nodeidy == 0)
+ {
+ noden = -1;
+ }
+ else
+ {
+ if(CH==1)
+ noden = nodeid - nx;
+ if(CH == 2)
+ noden = nodeid-1;
+ if(CH == 3)
+ {
+ if(nodeidx %2 == 0)
+ noden = nodeid-1;
+ else
+ noden = nodeid+1;
+ }
+
+ }
+ if(nodeidx == 0)
+ {
+ nodew = -1;
+ }
+ else
+ {
+ if(CH ==1)
+ nodew = nodeid -1;
+ if(CH == 2)
+ nodew = nodeid -ny;
+ if(CH == 3)
+ {
+
+ if(nodeidx%2 == 0)
+ nodew = nodeid - nodeidy -1-nodeidy;
+ else
+ {
+ nodew = nodeid +nodeidy+1-2*ny+nodeidy;
+ }
+ }
+ }
+ if(nodeidx == nx -1)
+ {
+ nodee = -1;
+ }
+ else
+ {
+ if(CH==1)
+ {
+ nodee = nodeid+1;
+ }
+ if(CH==2)
+ {
+ nodee = nodeid + ny;
+ }
+ if(CH==3)
+ {
+ if(nodeidx%2 == 0)
+ {
+ nodee = nodeid - nodeidy + ny + ny-1-nodeidy;
+ }
+ else
+ {
+ nodee = nodeid +nodeidy +1 + nodeidy;
+ }
+ }
+ }
+ int north1, south1, west1, east1;
+ if(local_y != 0)
+ {
+ //south
+ north1 = r - lpx;
+ }
+ else
+ {
+ if(noden == -1)
+ north1 = -1;
+ else
+ {
+ north1 = r + (noden - nodeid)*CORENUM - r%CORENUM +(lpy-1) * lpx + local_x;
+ //north1 = r + (noden - nodeid)*CORENUM - r%CORENUM + local_x;
+ }
+ }
+ if(local_y < lpy-1)
+ {
+ //north
+ south1 = r + lpx;
+ }
+ else
+ {
+ if(nodes == -1)
+ south1 = -1;
+ else
+ {
+ south1 = r + (nodes - nodeid)*CORENUM - r%CORENUM + local_x;
+ //south1 = r + (noden - nodeid)*CORENUM - r%CORENUM +(lpy-1) * lpx + local_x;
+ }
+ }
+ if(local_x != 0)
+ {
+ //west
+ west1 = r-1;
+ }
+ else
+ {
+ if(nodew == -1)
+ west1 = -1;
+ else
+ {
+ west1 = r + (nodew - nodeid)*CORENUM - r%CORENUM + local_y*lpx + lpx-1;
+ }
+ }
+ if(local_x == lpx-1)
+ {
+ //east
+ if(nodee == -1)
+ {
+ east1 = -1;
+ }
+ else
+ {
+ east1 = r + (nodee - nodeid) * CORENUM - r%CORENUM + local_y*lpx;
+ }
+ }
+ else
+ {
+
+ east1 = r+1;
+ }
+
+ // determine my four neighbors
+ for(int i=0; i<p; i++)
+ {
+ if(r==i)
+ printf("id=%d, sr=%d, nodeid=%d, north1=%d, south1=%d, west1=%d, east1=%d\n", r,sr,nodeid,north1,south1,west1,east1);
+ MPI_Barrier(MPI_COMM_WORLD);
+ }
+ int north = north1; if(north1 < 0) north = MPI_PROC_NULL;
+ int south = south1; if(south1 < 0) south = MPI_PROC_NULL;
+ int west= west1; if(west1< 0) west = MPI_PROC_NULL;
+ int east = east1; if(east1 < 0) east = MPI_PROC_NULL;
+ //int temp = north; north = south; south = temp;
+ int bx = n/px; // block size in x
+ int by = n/py; // block size in y
+ int offx = rx*bx; // offset in x
+ int offy = ry*by; // offset in y
+ double* volatile memO;
+ double* volatile memN;
+
+ //printf("rank %d N S W E is: %d %d %d %d\n",r,north, south, west, east);
+ MPI_Win winO;
+ MPI_Win winN;
+ MPI_Win_allocate_shared((bx+2)*(by+2)*sizeof(double),1,MPI_INFO_NULL,shmcomm,(void*)&memO,&winO);
+ MPI_Win_allocate_shared((bx+2)*(by+2)*sizeof(double),1,MPI_INFO_NULL,shmcomm,(void*)&memN,&winN);
+ double* volatile westptrO;
+ double* volatile eastptrO;
+ double* volatile northptrO;
+ double* volatile southptrO;
+ double* volatile westptrN;
+ double* volatile eastptrN;
+ double* volatile northptrN;
+ double* volatile southptrN;
+ int needN = 0; int needS = 0; int needW = 0; int needE = 0;
+ if(north != -1 && north / CORENUM == r/CORENUM)
+ {
+ needN = 1;
+ }
+ if(south != -1 && south / CORENUM == r/CORENUM)
+ {
+ needS = 1;
+ }
+ if(west != -1 && west / CORENUM == r/CORENUM)
+ {
+ needW = 1;
+ }
+ if(east != -1 && east / CORENUM == r/CORENUM)
+ {
+ needE = 1;
+ }
+ //temp = needN; needN =needS; needS = temp;
+ MPI_Aint sz;
+ int dsp_unit;
+ if(needN)
+ {
+ MPI_Win_shared_query(winO,sr-lpx,&sz,&dsp_unit,(void*)&northptrO);
+ MPI_Win_shared_query(winN,sr-lpx,&sz,&dsp_unit,(void*)&northptrN);
+ }
+ if(needS)
+ {
+ MPI_Win_shared_query(winO,sr+lpx,&sz,&dsp_unit,(void*)&southptrO);
+ MPI_Win_shared_query(winN,sr+lpx,&sz,&dsp_unit,(void*)&southptrN);
+ }
+ if(needW)
+ {
+ MPI_Win_shared_query(winO,sr-1,&sz,&dsp_unit,(void*)&westptrO);
+ MPI_Win_shared_query(winN,sr-1,&sz,&dsp_unit,(void*)&westptrN);
+ }
+ if(needE)
+ {
+ MPI_Win_shared_query(winO,sr+1,&sz,&dsp_unit,(void*)&eastptrO);
+ MPI_Win_shared_query(winN,sr+1,&sz,&dsp_unit,(void*)&eastptrN);
+ }
+
+ // printf("rank %d N S W E is: %d %d %d %d\n",r,north, south, west, east);
+ // decompose the domain
+ // printf("%i (%i,%i) - w: %i, e: %i, n: %i, s: %i\n", r, ry,rx,west,east,north,south);
+ // allocate two work arrays
+ double* volatile tmp;
+ // initialize three heat sources
+ const int nsources=3;
+ int sources[nsources][2] = {{n/2,n/2}, {n/3,n/3}, {n*4/5,n*8/9}};
+ int locnsources=0; // number of sources in my area
+ int locsources[nsources][2]; // sources local to my rank
+ for (int i=0; i<nsources; ++i) { // determine which sources are in my patch
+ int locx = sources[i][0] - offx;
+ int locy = sources[i][1] - offy;
+ if(locx >= 0 && locx < bx && locy >= 0 && locy < by) {
+ locsources[locnsources][0] = locx+1; // offset by halo zone
+ locsources[locnsources][1] = locy+1; // offset by halo zone
+ locnsources++;
+ }
+ }
+
+ double tp = 0.0;
+ // allocate communication buffers
+ double *sbufnorth = (double*)calloc(1,bx*sizeof(double)); // send buffers
+ double *sbufsouth = (double*)calloc(1,bx*sizeof(double));
+ double *sbufeast = (double*)calloc(1,by*sizeof(double));
+ double *sbufwest = (double*)calloc(1,by*sizeof(double));
+ double *rbufnorth = (double*)calloc(1,bx*sizeof(double)); // receive buffers
+ double *rbufsouth = (double*)calloc(1,bx*sizeof(double));
+ double *rbufeast = (double*)calloc(1,by*sizeof(double));
+ double *rbufwest = (double*)calloc(1,by*sizeof(double));
+
+ double thetime[6];
+ thetime[0] = thetime[1] = thetime[2] = thetime[3] =thetime [4] = thetime[5] = 0.0;
+ double t=-MPI_Wtime(); // take time
+ double heat; // total heat in system
+ //the following is the loop for niters steps.--zhuxm
+ //double* tempnew = (double*)malloc(bx*sizeof(double));
+ //int basesize = 2*(bx+by);
+ //int halfindex = basesize+4;
+ //MPI_Win_lock_all(0, winO);
+ //MPI_Win_lock_all(0, winN);
+
+ MPI_Barrier(shmcomm);
+ for(int iter=0; iter<niters; ++iter) {
+ // refresh heat sources
+ //MPI_Barrier(comm);
+ //if(!r) printf("Step %d\n",iter);
+ double time1 = MPI_Wtime();
+ for(int i=0; i<locnsources; ++i) {
+ memO[ind(locsources[i][0],locsources[i][1])] += energy; // heat source
+ }
+ double time2 = MPI_Wtime();
+ // exchange data with neighbors
+ MPI_Request reqs[8];
+ if(!needN)
+ for(int i=0; i<bx; ++i) sbufnorth[i] = memO[ind(i+1,1)]; // pack loop - last valid region
+ if(!needS)
+ for(int i=0; i<bx; ++i) sbufsouth[i] = memO[ind(i+1,by)]; // pack loop
+ if(!needE)
+ for(int i=0; i<by; ++i) sbufeast[i] = memO[ind(bx,i+1)]; // pack loop
+ if(!needW)
+ for(int i=0; i<by; ++i) sbufwest[i] = memO[ind(1,i+1)]; // pack loop
+
+ double time3 = MPI_Wtime();
+
+ int index = 0;
+ if(!needN)
+ {
+ MPI_Isend(sbufnorth, bx, MPI_DOUBLE, north, 9, comm, &reqs[index++]);
+ MPI_Irecv(rbufnorth, bx, MPI_DOUBLE, north, 9, comm, &reqs[index++]);
+ }
+ if(!needE)
+ {
+ MPI_Isend(sbufeast, by, MPI_DOUBLE, east, 9, comm, &reqs[index++]);
+ MPI_Irecv(rbufeast, by, MPI_DOUBLE, east, 9, comm, &reqs[index++]);
+ }
+ if(!needW)
+ {
+ MPI_Isend(sbufwest, by, MPI_DOUBLE, west, 9, comm, &reqs[index++]);
+ MPI_Irecv(rbufwest, by, MPI_DOUBLE, west, 9, comm, &reqs[index++]);
+ }
+ if(!needS)
+ {
+ MPI_Isend(sbufsouth, bx, MPI_DOUBLE, south, 9, comm, &reqs[index++]);
+ MPI_Irecv(rbufsouth, bx, MPI_DOUBLE, south, 9, comm, &reqs[index++]);
+ }
+ printf("id = %d, iter=%d, OK\n", r, iter);
+ int ReadN, ReadS, ReadW, ReadE;
+ ReadN = ReadS = ReadW = ReadE = 0;
+ if(!needN)
+ {
+ ReadN = 1;
+ }
+ if(!needS)
+ {
+ ReadS = 1;
+ }
+ if(!needW)
+ {
+ ReadW = 1;
+ }
+ if(!needE)
+ {
+ ReadE = 1;
+ }
+ //order: West0. East1, North2, South3
+ while(!(ReadW * ReadE * ReadN * ReadS))
+ {
+ if(!ReadW)
+ {
+ for(int i=0; i<by; i++)
+ // memO[(i+1)*(bx+2)]=westptrO[(i+1)*(bx+2)+bx];
+ ReadW = 1;
+ }
+ if(!ReadE)
+ {
+ for(int i=0; i<by; i++)
+ // memO[(i+1)*(bx+2)+bx+1]=eastptrO[(i+1)*(bx+2)+1];
+ ReadE = 1;
+ }
+ if(!ReadN)
+ {
+ //memcpy(rbufnorth,northptr+2*by+bx,bx*sizeof(double));
+ memcpy(memO+1,northptrO+(bx+2)*by+1,bx*sizeof(double));
+ //northptr[basesize+3] = -1;
+ ReadN = 1;
+ }
+ if(!ReadS)
+ {
+ //memcpy(rbufsouth,southptr+2*by, bx*sizeof(double));
+ memcpy(memO+(bx+2)*(by+1)+1,southptrO+bx+2+1, bx*sizeof(double));
+ //southptr[basesize+2] = -1;
+ ReadS = 1;
+ }
+ }
+ /*
+ MPI_Isend(sbufnorth, bx, MPI_DOUBLE, north, 9, comm, &reqs[0]);
+ MPI_Isend(sbufsouth, bx, MPI_DOUBLE, south, 9, comm, &reqs[1]);
+ MPI_Isend(sbufeast, by, MPI_DOUBLE, east, 9, comm, &reqs[2]);
+ MPI_Isend(sbufwest, by, MPI_DOUBLE, west, 9, comm, &reqs[3]);
+ MPI_Irecv(rbufnorth, bx, MPI_DOUBLE, north, 9, comm, &reqs[4]);
+ MPI_Irecv(rbufsouth, bx, MPI_DOUBLE, south, 9, comm, &reqs[5]);
+ MPI_Irecv(rbufeast, by, MPI_DOUBLE, east, 9, comm, &reqs[6]);
+ MPI_Irecv(rbufwest, by, MPI_DOUBLE, west, 9, comm, &reqs[7]);
+ */
+ MPI_Waitall(index, reqs, MPI_STATUS_IGNORE);
+ double time4 = MPI_Wtime();
+ if(!needN)
+ for(int i=0; i<bx; ++i) memO[ind(i+1,0)] = rbufnorth[i]; // unpack loop - into ghost cells
+ if(!needS)
+ for(int i=0; i<bx; ++i) memO[ind(i+1,by+1)] = rbufsouth[i]; // unpack loop
+ if(!needE)
+ for(int i=0; i<by; ++i) memO[ind(bx+1,i+1)] = rbufeast[i]; // unpack loop
+ if(!needW)
+ for(int i=0; i<by; ++i) memO[ind(0,i+1)] = rbufwest[i]; // unpack loop
+ double time5 = MPI_Wtime();
+ heat = 0.0;
+ tp = -MPI_Wtime();
+ //double* aold2 = aold;
+ //memcpy(aold2,aold,(bx+2)*(by+2)*sizeof(double));
+ //double* anewtemp = malloc(by*sizeof(double));
+ //for(int i=1; i<bx+1; ++i) {
+ //for(int j=1; j<by+1; ++j) {
+ for(int j=1; j<by+1; ++j) {
+ for(int i=1; i<bx+1; ++i) {
+ //double tt = anew[ind(i,j)]/2.0;
+ double tt = memN[ind(i,j)]/2.0 + (memO[ind(i-1,j)] + memO[ind(i+1,j)] + memO[ind(i,j-1)] + memO[ind(i,j+1)])/4.0/2.0;
+ //double tt = anew[ind(i,j)]/2.0 + ( aold[ind(i,j-1)] + aold[ind(i,j+1)])/4.0/2.0;
+ //tt += (aold[ind(i-1,j)] + aold[ind(i+1,j)] + aold[ind(i,j-1)] + aold[ind(i,j+1)])/4.0/2.0;
+ memN[ind(i,j)] = tt;
+ //double d = anew[ind(i,j)]/2.0 + ((double)r+1.0+double(r+3.46)+double(iter))/4.0/2.0;
+ //anew[ind(i,j)] = anew[ind(i,j)]/2.0;
+ //tempnew[i-1] = tt;
+ heat += memN[ind(i,j)];
+ }
+ }
+ // swap arrays
+ double time6 = MPI_Wtime();
+ thetime[0] += (time2-time1);
+ thetime[1] += (time3-time2);
+ thetime[2] += (time4-time3);
+ thetime[3] += (time5-time4);
+ thetime[4] += (time6-time5);
+ thetime[5] += (time6-time1);
+
+ tp += MPI_Wtime();
+ tmp=memN; memN=memO; memO=tmp;
+ tmp=northptrN; northptrN=northptrO; northptrO=tmp;
+ tmp=southptrN; southptrN=southptrO; southptrO=tmp;
+ tmp=eastptrN; eastptrN=eastptrO; eastptrO=tmp;
+ tmp=westptrN; westptrN=northptrO; westptrO=tmp;
+ MPI_Barrier(shmcomm);
+ }
+ t+=MPI_Wtime();
+
+ // get final heat in the system
+ double rheat;
+ MPI_Allreduce(&heat, &rheat, 1, MPI_DOUBLE, MPI_SUM, comm);
+ double totaltime[6];
+ MPI_Allreduce(thetime,totaltime,6,MPI_DOUBLE,MPI_SUM,comm);
+if(!r)
+ {
+ printf("[%i] last heat: %f time: %f\n", r, rheat, t);
+ printf("Times are: %lf, %lf, %lf, %lf, %lf, --> %lf\n",totaltime[0]/p,totaltime[1]/p,totaltime[2]/p,totaltime[3]/p,totaltime[4]/p,totaltime[5]/p);
+ }
+ MPI_Barrier(comm);
+// printf("Rank %d times are: %lf, %lf, %lf, %lf, %lf, --> %lf\n",r, thetime[0],thetime[1],thetime[2],thetime[3],thetime[4],thetime[5]);
+ MPI_Finalize();
+}
-----------------------------------------------------------------------
hooks/post-receive
--
Stencil code repository
1
0
[mpich] MPICH primary repository branch, master, updated. v3.2a1-5-gb293734
by noreply@mpich.org 08 Sep '14
by noreply@mpich.org 08 Sep '14
08 Sep '14
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 b293734ddfd76c34eea26794fda4acbb5cfee34a (commit)
from 96c1107031f89b02dd3b4360862ddf98b8d5f43e (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/b293734ddfd76c34eea26794fda4acbb5…
commit b293734ddfd76c34eea26794fda4acbb5cfee34a
Author: Pavan Balaji <balaji(a)anl.gov>
Date: Thu Sep 4 13:13:16 2014 -0500
Fix incorrect portals library name.
Signed-off-by: Ken Raffenetti <raffenet(a)mcs.anl.gov>
diff --git a/src/mpid/ch3/channels/nemesis/netmod/portals4/subconfigure.m4 b/src/mpid/ch3/channels/nemesis/netmod/portals4/subconfigure.m4
index 2e617f0..5e98951 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/portals4/subconfigure.m4
+++ b/src/mpid/ch3/channels/nemesis/netmod/portals4/subconfigure.m4
@@ -17,7 +17,7 @@ AM_COND_IF([BUILD_NEMESIS_NETMOD_PORTALS4],[
PAC_SET_HEADER_LIB_PATH(portals4)
PAC_PUSH_FLAG(LIBS)
PAC_CHECK_HEADER_LIB_FATAL(portals4, portals4.h, portals, PtlInit)
- PAC_APPEND_FLAG([-lportals4],[EXTERNAL_LIBS])
+ PAC_APPEND_FLAG([-lportals],[EXTERNAL_LIBS])
PAC_POP_FLAG(LIBS)
AC_DEFINE([ENABLE_COMM_OVERRIDES], 1, [define to add per-vc function pointers to override send and recv functions])
-----------------------------------------------------------------------
Summary of changes:
.../nemesis/netmod/portals4/subconfigure.m4 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
hooks/post-receive
--
MPICH primary repository
1
0
[mpich] MPICH primary repository branch, master, updated. v3.2a1-4-g96c1107
by noreply@mpich.org 08 Sep '14
by noreply@mpich.org 08 Sep '14
08 Sep '14
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 96c1107031f89b02dd3b4360862ddf98b8d5f43e (commit)
from c99d3467e2d96ecfd143921740eaa60cec222494 (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/96c1107031f89b02dd3b4360862ddf98b…
commit 96c1107031f89b02dd3b4360862ddf98b8d5f43e
Author: Junchao Zhang <jczhang(a)mcs.anl.gov>
Date: Fri Sep 5 14:17:15 2014 -0500
Fix switch(datatype) kind of errors
In MPI, the predefined named constant handles like MPI_INT are link-time
but not necessarily compile-time constants, so they should not be used in
switch/case clauses. If you do so, this kind of code only compiles with
MPICH but not OpenMPI.
Fixes #2169, #2171
Signed-off-by: Rob Latham <robl(a)mcs.anl.gov>
diff --git a/src/env/mpivars.c b/src/env/mpivars.c
index 080aedd..91e21aa 100644
--- a/src/env/mpivars.c
+++ b/src/env/mpivars.c
@@ -468,33 +468,25 @@ int getCvarValueAsStr( int idx, MPI_Datatype datatype,
MPI_T_cvar_handle_alloc( idx, NULL, &chandle, &count );
if (count == 1 || (datatype==MPI_CHAR && count < varValueLen)) {
- switch (datatype) {
- case MPI_INT:
+ if (MPI_INT == datatype) {
MPI_T_cvar_read( chandle, &ival );
snprintf( varValue, varValueLen, "%d", ival );
hasValue = 1;
- break;
- case MPI_UNSIGNED:
+ } else if (MPI_UNSIGNED == datatype) {
MPI_T_cvar_read( chandle, &uval );
snprintf( varValue, varValueLen, "%u", uval );
hasValue = 1;
- break;
- case MPI_UNSIGNED_LONG:
+ } else if (MPI_UNSIGNED_LONG == datatype) {
MPI_T_cvar_read( chandle, &ulval );
snprintf( varValue, varValueLen, "%lu", ulval );
hasValue = 1;
- break;
- case MPI_UNSIGNED_LONG_LONG:
+ } else if (MPI_UNSIGNED_LONG_LONG == datatype) {
MPI_T_cvar_read( chandle, &ullval );
snprintf( varValue, varValueLen, "%llu", ullval );
hasValue = 1;
- break;
- case MPI_CHAR:
+ } else if (MPI_CHAR == datatype) {
MPI_T_cvar_read( chandle, varValue );
hasValue = 1;
- break;
- default:
- break;
}
}
MPI_T_cvar_handle_free( &chandle );
@@ -534,38 +526,29 @@ int getPvarValueAsStr( int idx, MPI_Datatype datatype, int isContinuous,
goto fn_fail;
}
}
- switch (datatype) {
- case MPI_INT:
+ if (MPI_INT == datatype) {
MPI_T_pvar_read( session, phandle, &ival );
snprintf( varValue, varValueLen, "%d", ival );
hasValue = 1;
- break;
- case MPI_UNSIGNED:
+ } else if (MPI_UNSIGNED == datatype) {
MPI_T_pvar_read( session, phandle, &uval );
snprintf( varValue, varValueLen, "%u", uval );
hasValue = 1;
- break;
- case MPI_UNSIGNED_LONG:
+ } else if (MPI_UNSIGNED_LONG == datatype) {
MPI_T_pvar_read( session, phandle, &ulval );
snprintf( varValue, varValueLen, "%lu", ulval );
hasValue = 1;
- break;
- case MPI_UNSIGNED_LONG_LONG:
+ } else if (MPI_UNSIGNED_LONG_LONG == datatype) {
MPI_T_pvar_read( session, phandle, &ullval );
snprintf( varValue, varValueLen, "%llu", ullval );
hasValue = 1;
- break;
- case MPI_DOUBLE:
+ } else if (MPI_DOUBLE == datatype) {
MPI_T_pvar_read( session, phandle, &dval );
snprintf( varValue, varValueLen, "%e", dval );
hasValue = 1;
- break;
- case MPI_CHAR:
+ } else if (MPI_CHAR == datatype) {
MPI_T_pvar_read( session, phandle, varValue );
hasValue = 1;
- break;
- default:
- break;
}
}
fn_fail:
diff --git a/test/mpi/mpi_t/cvarwrite.c b/test/mpi/mpi_t/cvarwrite.c
index aaf84d2..41d0b29 100644
--- a/test/mpi/mpi_t/cvarwrite.c
+++ b/test/mpi/mpi_t/cvarwrite.c
@@ -45,55 +45,47 @@ int main(int argc, char* argv[])
MPI_T_cvar_handle_alloc(i, NULL, &chandle, &count);
if (count == 1 || (datatype == MPI_CHAR && count < sizeof(cin))) {
- switch (datatype) {
- case MPI_INT:
- iin = 123;
- iout = 456;
- MPI_T_cvar_read(chandle, &iold); /* Read the old value */
- MPI_T_cvar_write(chandle, &iin); /* Write an arbitrary value */
- MPI_T_cvar_read(chandle, &iout); /* Read the value again */
- MPI_T_cvar_write(chandle, &iold); /* Restore the old value */
- if (iin != iout) errs++;
- break;
- case MPI_UNSIGNED:
- uin = 133;
- uout = 986;
- MPI_T_cvar_read(chandle, &uold);
- MPI_T_cvar_write(chandle, &uin);
- MPI_T_cvar_read(chandle, &uout);
- MPI_T_cvar_write(chandle, &uold);
- if (uin != uout) errs++;
- break;
- case MPI_UNSIGNED_LONG:
- ulin = 1830;
- ulout = 2014;
- MPI_T_cvar_read(chandle, &ulold);
- MPI_T_cvar_write(chandle, &ulin);
- MPI_T_cvar_read(chandle, &ulout);
- MPI_T_cvar_write(chandle, &ulold);
- if (ulin != ulout) errs++;
- break;
- case MPI_UNSIGNED_LONG_LONG:
- ullin = 11930;
- ullout = 52014;
- MPI_T_cvar_read(chandle, &ullold);
- MPI_T_cvar_write(chandle, &ullin);
- MPI_T_cvar_read(chandle, &ullout);
- MPI_T_cvar_write(chandle, &ullold);
- if (ullin != ullout) errs++;
- break;
- case MPI_CHAR:
- strcpy(cin, "GARBAGE MPI_CHAR CVAR VALUE");
- strcpy(cout, "TEMPORARY MPI_CHAR CVAR VALUE");
- MPI_T_cvar_read(chandle, cold);
- MPI_T_cvar_write(chandle, cin);
- MPI_T_cvar_read(chandle, cout);
- MPI_T_cvar_write(chandle, cold);
- /* printf("%s = %s\n", name, cold); */
- if (strcmp(cin, cout)) errs++;
- break;
- default:
- break;
+ if (MPI_INT == datatype) {
+ iin = 123;
+ iout = 456;
+ MPI_T_cvar_read(chandle, &iold); /* Read the old value */
+ MPI_T_cvar_write(chandle, &iin); /* Write an arbitrary value */
+ MPI_T_cvar_read(chandle, &iout); /* Read the value again */
+ MPI_T_cvar_write(chandle, &iold); /* Restore the old value */
+ if (iin != iout) errs++;
+ } else if (MPI_UNSIGNED == datatype) {
+ uin = 133;
+ uout = 986;
+ MPI_T_cvar_read(chandle, &uold);
+ MPI_T_cvar_write(chandle, &uin);
+ MPI_T_cvar_read(chandle, &uout);
+ MPI_T_cvar_write(chandle, &uold);
+ if (uin != uout) errs++;
+ } else if (MPI_UNSIGNED_LONG == datatype) {
+ ulin = 1830;
+ ulout = 2014;
+ MPI_T_cvar_read(chandle, &ulold);
+ MPI_T_cvar_write(chandle, &ulin);
+ MPI_T_cvar_read(chandle, &ulout);
+ MPI_T_cvar_write(chandle, &ulold);
+ if (ulin != ulout) errs++;
+ } else if (MPI_UNSIGNED_LONG_LONG == datatype) {
+ ullin = 11930;
+ ullout = 52014;
+ MPI_T_cvar_read(chandle, &ullold);
+ MPI_T_cvar_write(chandle, &ullin);
+ MPI_T_cvar_read(chandle, &ullout);
+ MPI_T_cvar_write(chandle, &ullold);
+ if (ullin != ullout) errs++;
+ } else if (MPI_CHAR == datatype) {
+ strcpy(cin, "GARBAGE MPI_CHAR CVAR VALUE");
+ strcpy(cout, "TEMPORARY MPI_CHAR CVAR VALUE");
+ MPI_T_cvar_read(chandle, cold);
+ MPI_T_cvar_write(chandle, cin);
+ MPI_T_cvar_read(chandle, cout);
+ MPI_T_cvar_write(chandle, cold);
+ /* printf("%s = %s\n", name, cold); */
+ if (strcmp(cin, cout)) errs++;
}
}
-----------------------------------------------------------------------
Summary of changes:
src/env/mpivars.c | 39 +++++--------------
test/mpi/mpi_t/cvarwrite.c | 90 ++++++++++++++++++++------------------------
2 files changed, 52 insertions(+), 77 deletions(-)
hooks/post-receive
--
MPICH primary repository
1
0
[mpich] MPICH primary repository branch, master, updated. v3.2a1-3-gc99d346
by noreply@mpich.org 08 Sep '14
by noreply@mpich.org 08 Sep '14
08 Sep '14
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 c99d3467e2d96ecfd143921740eaa60cec222494 (commit)
via dc5df5b0d05cf5ab313a1386ca18b709069876b5 (commit)
from 79444598bb51599702cabcecab341b5a20847124 (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/c99d3467e2d96ecfd143921740eaa60ce…
commit c99d3467e2d96ecfd143921740eaa60cec222494
Author: Norio Yamaguchi <norio.yamaguchi(a)riken.jp>
Date: Fri Sep 5 14:50:35 2014 +0900
Modify the method of IB-dereg_mr
Deregister until the total amount released exceeds the requested length.
If a registration fails after deregistering some memory regions, then
deregister a next memory region and try to re-register.
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
index 59b967d..30bc222 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
@@ -1475,12 +1475,13 @@ int MPID_nem_ib_com_isend(int condesc,
conp->icom_sr[MPID_NEM_IB_COM_SMT_NOINLINE].sg_list[num_sge].lkey = mr_rdmawr_from->lkey;
num_sge += 1;
+ struct MPID_nem_ib_com_reg_mr_cache_entry_t *mr_cache = NULL;
if (sz_data) {
//dprintf("MPID_nem_ib_com_isend,data=%p,sz_data=%d\n", data, sz_data);
- struct ibv_mr *mr_data =
- MPID_nem_ib_com_reg_mr_fetch(data, sz_data, 0, MPID_NEM_IB_COM_REG_MR_GLOBAL);
- MPID_NEM_IB_COM_ERR_CHKANDJUMP(!mr_data, -1,
+ mr_cache = MPID_nem_ib_com_reg_mr_fetch(data, sz_data, 0, MPID_NEM_IB_COM_REG_MR_GLOBAL);
+ MPID_NEM_IB_COM_ERR_CHKANDJUMP(!mr_cache, -1,
printf("MPID_nem_ib_com_isend,ibv_reg_mr_fetch failed\n"));
+ struct ibv_mr *mr_data = mr_cache->mr;
#ifdef HAVE_LIBDCFA
conp->icom_sr[MPID_NEM_IB_COM_SMT_NOINLINE].sg_list[num_sge].mic_addr = (uint64_t) data;
conp->icom_sr[MPID_NEM_IB_COM_SMT_NOINLINE].sg_list[num_sge].addr =
@@ -1524,6 +1525,7 @@ int MPID_nem_ib_com_isend(int condesc,
MPID_nem_ib_rc_send_request *wrap_wr_id = MPIU_Malloc(sizeof(MPID_nem_ib_rc_send_request));
wrap_wr_id->wr_id = wr_id;
wrap_wr_id->mf = MPID_NEM_IB_LAST_PKT;
+ wrap_wr_id->mr_cache = (void *) mr_cache;
conp->icom_sr[MPID_NEM_IB_COM_SMT_NOINLINE].wr_id = (uint64_t) wrap_wr_id;
#else
@@ -1964,14 +1966,16 @@ int MPID_nem_ib_com_lrecv(int condesc, uint64_t wr_id, void *raddr, long sz_data
MPID_NEM_IB_COM_ERR_CHKANDJUMP(!sz_data, -1, dprintf("MPID_nem_ib_com_lrecv,sz_data==0\n"));
/* register memory area containing data */
- struct ibv_mr *mr_data =
+ struct MPID_nem_ib_com_reg_mr_cache_entry_t *mr_cache =
MPID_nem_ib_com_reg_mr_fetch(laddr, sz_data, 0, MPID_NEM_IB_COM_REG_MR_GLOBAL);
- MPID_NEM_IB_COM_ERR_CHKANDJUMP(!mr_data, -1,
+ MPID_NEM_IB_COM_ERR_CHKANDJUMP(!mr_cache, -1,
dprintf("MPID_nem_ib_com_lrecv,ibv_reg_mr_fetch failed\n"));
+ struct ibv_mr *mr_data = mr_cache->mr;
MPID_nem_ib_rc_send_request *wrap_wr_id = MPIU_Malloc(sizeof(MPID_nem_ib_rc_send_request));
wrap_wr_id->wr_id = wr_id;
wrap_wr_id->mf = last;
+ wrap_wr_id->mr_cache = (void *) mr_cache;
num_sge = 0;
@@ -2039,10 +2043,11 @@ int MPID_nem_ib_com_put_lmt(int condesc, uint64_t wr_id, void *raddr, int sz_dat
num_sge = 0;
/* register memory area containing data */
- struct ibv_mr *mr_data =
+ struct MPID_nem_ib_com_reg_mr_cache_entry_t *mr_cache =
MPID_nem_ib_com_reg_mr_fetch(laddr, sz_data, 0, MPID_NEM_IB_COM_REG_MR_GLOBAL);
- MPID_NEM_IB_COM_ERR_CHKANDJUMP(!mr_data, -1,
+ MPID_NEM_IB_COM_ERR_CHKANDJUMP(!mr_cache, -1,
dprintf("MPID_nem_ib_com_put_lmt,ibv_reg_mr_fetch failed\n"));
+ struct ibv_mr *mr_data = mr_cache->mr;
#ifdef HAVE_LIBDCFA
conp->icom_sr[MPID_NEM_IB_COM_LMT_PUT].sg_list[num_sge].mic_addr = (uint64_t) laddr;
@@ -2060,6 +2065,7 @@ int MPID_nem_ib_com_put_lmt(int condesc, uint64_t wr_id, void *raddr, int sz_dat
MPID_nem_ib_rc_send_request *wrap_wr_id = MPIU_Malloc(sizeof(MPID_nem_ib_rc_send_request));
wrap_wr_id->wr_id = wr_id;
wrap_wr_id->mf = MPID_NEM_IB_LAST_PKT;
+ wrap_wr_id->mr_cache = (void *) mr_cache;
conp->icom_sr[MPID_NEM_IB_COM_LMT_PUT].wr_id = (uint64_t) wrap_wr_id;
#else
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h
index 88e871f..ae28f55 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h
@@ -356,6 +356,7 @@ MPID_nem_ib_rdmawr_to_alloc_hdr_t;
typedef struct {
uint64_t wr_id; /* address of MPID_Request */
int mf; /* more fragment (0 means the end of packet) */
+ void *mr_cache; /* address of mr_cache_entry. derecement refc in drain_scq */
} MPID_nem_ib_rc_send_request;
#define MPID_NEM_IB_LMT_LAST_PKT 0
@@ -572,11 +573,27 @@ extern int MPID_nem_ib_com_mem_udwr_from(int condesc, void **out);
extern int MPID_nem_ib_com_mem_udwr_to(int condesc, void **out);
/* ib_reg_mr.c */
+struct MPID_nem_ib_com_reg_mr_listnode_t {
+ struct MPID_nem_ib_com_reg_mr_listnode_t *lru_next;
+ struct MPID_nem_ib_com_reg_mr_listnode_t *lru_prev;
+};
+
+struct MPID_nem_ib_com_reg_mr_cache_entry_t {
+ /* : public MPID_nem_ib_com_reg_mr_listnode_t */
+ struct MPID_nem_ib_com_reg_mr_listnode_t *lru_next;
+ struct MPID_nem_ib_com_reg_mr_listnode_t *lru_prev;
+ struct MPID_nem_ib_com_reg_mr_listnode_t g_lru;
+
+ struct ibv_mr *mr;
+ void *addr;
+ long len;
+ int refc;
+};
extern int MPID_nem_ib_com_register_cache_init(void);
extern int MPID_nem_ib_com_register_cache_release(void);
-extern struct ibv_mr *MPID_nem_ib_com_reg_mr_fetch(void *addr, long len,
- enum ibv_access_flags additional_flags,
- int mode);
+extern void *MPID_nem_ib_com_reg_mr_fetch(void *addr, long len,
+ enum ibv_access_flags additional_flags, int mode);
+extern void MPID_nem_ib_com_reg_mr_release(struct MPID_nem_ib_com_reg_mr_cache_entry_t *entry);
#define MPID_NEM_IB_COM_REG_MR_GLOBAL (0)
#define MPID_NEM_IB_COM_REG_MR_STICKY (1)
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
index 8f878fb..4941ccb 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
@@ -137,9 +137,11 @@ int MPID_nem_ib_lmt_initiate_lmt(struct MPIDI_VC *vc, union MPIDI_CH3_Pkt *rts_p
length = data_sz;
}
/* put IB rkey */
- struct ibv_mr *mr =
+ struct MPID_nem_ib_com_reg_mr_cache_entry_t *mr_cache =
MPID_nem_ib_com_reg_mr_fetch(write_from_buf, length, 0, MPID_NEM_IB_COM_REG_MR_GLOBAL);
- MPIU_ERR_CHKANDJUMP(!mr, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_reg_mr_fetch");
+ MPIU_ERR_CHKANDJUMP(!mr_cache, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_reg_mr_fetch");
+ struct ibv_mr *mr = mr_cache->mr;
+ REQ_FIELD(req, lmt_mr_cache) = (void *) mr_cache;
#ifdef HAVE_LIBDCFA
s_cookie_buf->addr = (void *) mr->host_addr;
dprintf("lmt_initiate_lmt,s_cookie_buf->addr=%p\n", s_cookie_buf->addr);
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
index 050aefd..9106eb9 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
@@ -107,6 +107,13 @@ int MPID_nem_ib_drain_scq(int dont_call_progress)
MPID_nem_ib_rc_send_request *req_wrap = (MPID_nem_ib_rc_send_request *) cqe[i].wr_id;
req = (MPID_Request *) req_wrap->wr_id;
+ /* decrement reference counter of mr_cache_entry registered by ib_com_isend or ib_com_lrecv */
+ struct MPID_nem_ib_com_reg_mr_cache_entry_t *mr_cache =
+ (struct MPID_nem_ib_com_reg_mr_cache_entry_t *) req_wrap->mr_cache;
+ if (mr_cache) {
+ MPID_nem_ib_com_reg_mr_release(mr_cache);
+ }
+
kind = req->kind;
req_type = MPIDI_Request_get_type(req);
msg_type = MPIDI_Request_get_msg_type(req);
@@ -2227,6 +2234,10 @@ int MPID_nem_ib_pkt_GET_DONE_handler(MPIDI_VC_t * vc,
#endif
//dprintf("lmt_start_recv,reply_seq_num,sendq_empty=%d,ncom=%d,ncqe=%d,rdmabuf_occ=%d\n", MPID_nem_ib_sendq_empty(vc_ib->sendq), vc_ib->ibcom->ncom, MPID_nem_ib_ncqe, MPID_nem_ib_diff16(vc_ib->ibcom->sseq_num, vc_ib->ibcom->lsr_seq_num_tail));
#endif
+
+ /* decrement reference counter of mr_cache_entry */
+ MPID_nem_ib_com_reg_mr_release(REQ_FIELD(req, lmt_mr_cache));
+
/* try to send from sendq because at least one RDMA-write-to buffer has been released */
//dprintf("lmt_start_recv,reply_seq_num,send_progress\n");
if (!MPID_nem_ib_sendq_empty(vc_ib->sendq)) {
@@ -2261,9 +2272,13 @@ int MPID_nem_ib_pkt_GET_DONE_handler(MPIDI_VC_t * vc,
void *addr =
(void *) ((char *) REQ_FIELD(req, buf.from) +
(long) (next_seg_seq_num - 1) * REQ_FIELD(req, max_msg_sz));
- struct ibv_mr *mr =
+ struct MPID_nem_ib_com_reg_mr_cache_entry_t *mr_cache =
MPID_nem_ib_com_reg_mr_fetch(addr, length, 0, MPID_NEM_IB_COM_REG_MR_GLOBAL);
- MPIU_ERR_CHKANDJUMP(!mr, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_reg_mr_fetch");
+ MPIU_ERR_CHKANDJUMP(!mr_cache, mpi_errno, MPI_ERR_OTHER,
+ "**MPID_nem_ib_com_reg_mr_fetch");
+ struct ibv_mr *mr = mr_cache->mr;
+ /* store new cache entry */
+ REQ_FIELD(req, lmt_mr_cache) = (void *) mr_cache;
#ifdef HAVE_LIBDCFA
void *_addr = mr->host_addr;
@@ -2492,6 +2507,9 @@ int MPID_nem_ib_pkt_rma_lmt_getdone(MPIDI_VC_t * vc,
MPIU_THREAD_CS_ENTER(LMT,);
+ /* decrement reference counter of mr_cache_entry */
+ MPID_nem_ib_com_reg_mr_release(REQ_FIELD(req, lmt_mr_cache));
+
req_type = MPIDI_Request_get_type(req);
/* free memory area for cookie */
if (!req->ch.s_cookie) {
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_reg_mr.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_reg_mr.c
index bbabe11..2a2c8b6 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_reg_mr.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_reg_mr.c
@@ -96,23 +96,6 @@ static inline void afree(const void *p, int id)
#endif
}
-struct MPID_nem_ib_com_reg_mr_listnode_t {
- struct MPID_nem_ib_com_reg_mr_listnode_t *lru_next;
- struct MPID_nem_ib_com_reg_mr_listnode_t *lru_prev;
-};
-
-struct MPID_nem_ib_com_reg_mr_cache_entry_t {
- /* : public MPID_nem_ib_com_reg_mr_listnode_t */
- struct MPID_nem_ib_com_reg_mr_listnode_t *lru_next;
- struct MPID_nem_ib_com_reg_mr_listnode_t *lru_prev;
- struct MPID_nem_ib_com_reg_mr_listnode_t g_lru;
-
- struct ibv_mr *mr;
- void *addr;
- long len;
- int refc;
-};
-
static struct MPID_nem_ib_com_reg_mr_listnode_t MPID_nem_ib_com_reg_mr_global_cache;
static struct MPID_nem_ib_com_reg_mr_listnode_t
MPID_nem_ib_com_reg_mr_cache[MPID_NEM_IB_COM_REG_MR_NLINE];
@@ -169,8 +152,8 @@ static inline void __lru_queue_display()
}
}
-struct ibv_mr *MPID_nem_ib_com_reg_mr_fetch(void *addr, long len,
- enum ibv_access_flags additional_flags, int mode)
+void *MPID_nem_ib_com_reg_mr_fetch(void *addr, long len,
+ enum ibv_access_flags additional_flags, int mode)
{
#if 0 /* debug */
struct ibv_mr *mr;
@@ -254,10 +237,61 @@ struct ibv_mr *MPID_nem_ib_com_reg_mr_fetch(void *addr, long len,
if (ibcom_errno != 0) {
/* ib_com_reg_mr returns the errno of ibv_reg_mr */
if (ibcom_errno == ENOMEM) {
+#if 1
+ /* deregister memory region unused and re-register new one */
+ struct MPID_nem_ib_com_reg_mr_listnode_t *ptr;
+ struct MPID_nem_ib_com_reg_mr_cache_entry_t *victim;
+ unsigned long long dereg_total = 0;
+ int reg_success = 0;
+ for (ptr = MPID_nem_ib_com_reg_mr_global_cache.lru_prev;
+ ptr !=
+ (struct MPID_nem_ib_com_reg_mr_listnode_t *) &MPID_nem_ib_com_reg_mr_global_cache;)
+ {
+ victim = list_entry(ptr, struct MPID_nem_ib_com_reg_mr_cache_entry_t, g_lru);
+ ptr = ptr->lru_prev;
+ /* 'refc == 0' means this cache_entry is not used */
+ if (victim && victim->addr && (victim->refc == 0)) {
+ MPID_nem_ib_com_reg_mr_unlink((struct MPID_nem_ib_com_reg_mr_listnode_t *)
+ victim);
+ MPID_nem_ib_com_reg_mr_unlink(&(victim->g_lru));
+
+ ibcom_errno = MPID_nem_ib_com_dereg_mr(victim->mr);
+ if (ibcom_errno) {
+ printf("mrcache,MPID_nem_ib_com_dereg_mr\n");
+ afree(e, MPID_NEM_IB_COM_AALLOC_ID_MRCACHE);
+ goto fn_fail;
+ }
+ dereg_total += (unsigned long long) victim->len;
+ afree(victim, MPID_NEM_IB_COM_AALLOC_ID_MRCACHE);
+ num_global_cache--;
+
+ /* end loop if the total length released exceeds the requested */
+ if (dereg_total > len_aligned) {
+ dprintf("ib_com_reg_mr_fetch,dereg=%llu,len=%ld\n", dereg_total,
+ len_aligned);
+ /* re-registraion */
+ ibcom_errno =
+ MPID_nem_ib_com_reg_mr(addr_aligned, len_aligned, &e->mr,
+ additional_flags);
+ if (ibcom_errno == 0) {
+ /* ibv_reg_mr success */
+ reg_success = 1;
+ break;
+ }
+ }
+ }
+ }
+
+ if (reg_success == 0) {
+ fprintf(stderr, "mrcache,MPID_nem_ib_com_reg_mr,failed\n");
+ afree(e, MPID_NEM_IB_COM_AALLOC_ID_MRCACHE);
+ goto fn_fail;
+ }
+#else
/* deregister memory region. The value of 'num_global_cache' means the number of global-cached.
* delete 5 percents of global-cached */
int i;
- int del_num = num_global_cache / 20;
+ int del_num = (num_global_cache + 19) / 20;
struct MPID_nem_ib_com_reg_mr_cache_entry_t *victim;
dprintf("mrcache,MPID_nem_ib_com_reg_mr,ENOMEM,del_num(%d)\n", del_num);
@@ -286,6 +320,7 @@ struct ibv_mr *MPID_nem_ib_com_reg_mr_fetch(void *addr, long len,
afree(e, MPID_NEM_IB_COM_AALLOC_ID_MRCACHE);
goto fn_fail;
}
+#endif
}
else {
/* errno is not ENOMEM */
@@ -338,7 +373,10 @@ struct ibv_mr *MPID_nem_ib_com_reg_mr_fetch(void *addr, long len,
//__lru_queue_display();
fn_exit:
- return e->mr;
+ if (mode == MPID_NEM_IB_COM_REG_MR_STICKY)
+ return e->mr;
+ else
+ return e;
fn_fail:
goto fn_exit;
#endif
@@ -358,6 +396,11 @@ static void MPID_nem_ib_com_reg_mr_dereg(struct ibv_mr *mr)
//e->refc, offset);
}
#endif
+void MPID_nem_ib_com_reg_mr_release(struct MPID_nem_ib_com_reg_mr_cache_entry_t *entry)
+{
+ entry->refc--;
+ MPIU_Assert(ref_count >= 0);
+}
int MPID_nem_ib_com_register_cache_init()
{
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
index 69615c1..152f33c 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
@@ -253,10 +253,14 @@ static int MPID_nem_ib_iSendContig_core(MPIDI_VC_t * vc, MPID_Request * sreq, vo
sreq->ch.s_cookie = s_cookie_buf;
s_cookie_buf->tail = *((uint8_t *) ((uint8_t *) write_from_buf + data_sz - sizeof(uint8_t)));
-
- struct ibv_mr *mr =
- MPID_nem_ib_com_reg_mr_fetch(write_from_buf, data_sz, 0, MPID_NEM_IB_COM_REG_MR_GLOBAL);
- MPIU_ERR_CHKANDJUMP(!mr, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_reg_mr_fetch");
+ /* put IB rkey */
+ struct MPID_nem_ib_com_reg_mr_cache_entry_t *mr_cache =
+ MPID_nem_ib_com_reg_mr_fetch(write_from_buf, data_sz, 0,
+ MPID_NEM_IB_COM_REG_MR_GLOBAL);
+ MPIU_ERR_CHKANDJUMP(!mr_cache, mpi_errno, MPI_ERR_OTHER,
+ "**MPID_nem_ib_com_reg_mr_fetch");
+ struct ibv_mr *mr = mr_cache->mr;
+ REQ_FIELD(sreq, lmt_mr_cache) = (void *) mr_cache;
#ifdef HAVE_LIBDCFA
s_cookie_buf->addr = (void *) mr->host_addr;
#else
@@ -816,9 +820,14 @@ static int MPID_nem_ib_SendNoncontig_core(MPIDI_VC_t * vc, MPID_Request * sreq,
sreq->ch.s_cookie = s_cookie_buf;
s_cookie_buf->tail = *((uint8_t *) ((uint8_t *) write_from_buf + last - sizeof(uint8_t)));
-
- struct ibv_mr *mr = MPID_nem_ib_com_reg_mr_fetch(write_from_buf, last, 0, MPID_NEM_IB_COM_REG_MR_GLOBAL);
- MPIU_ERR_CHKANDJUMP(!mr, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_reg_mr_fetch");
+ /* put IB rkey */
+ struct MPID_nem_ib_com_reg_mr_cache_entry_t *mr_cache =
+ MPID_nem_ib_com_reg_mr_fetch(write_from_buf, last, 0,
+ MPID_NEM_IB_COM_REG_MR_GLOBAL);
+ MPIU_ERR_CHKANDJUMP(!mr_cache, mpi_errno, MPI_ERR_OTHER,
+ "**MPID_nem_ib_com_reg_mr_fetch");
+ struct ibv_mr *mr = mr_cache->mr;
+ REQ_FIELD(sreq, lmt_mr_cache) = (void *) mr_cache;
#ifdef HAVE_LIBDCFA
s_cookie_buf->addr = (void *) mr->host_addr;
#else
http://git.mpich.org/mpich.git/commitdiff/dc5df5b0d05cf5ab313a1386ca18b7090…
commit dc5df5b0d05cf5ab313a1386ca18b709069876b5
Author: Norio Yamaguchi <norio.yamaguchi(a)riken.jp>
Date: Fri Sep 5 13:39:59 2014 +0900
Divide memory area to segments when registering
There is a maximum message size supported by HCA port. So it's necessary
to divide a memory area to segments when a message size is larger than it.
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/errnames.txt b/src/mpid/ch3/channels/nemesis/netmod/ib/errnames.txt
index a7f7adc..f11ac62 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/errnames.txt
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/errnames.txt
@@ -42,6 +42,7 @@
**MPID_nem_ib_lmt_done_recv:MPID_nem_ib_lmt_done_recv failed
**MPID_nem_ib_lmt_done_send:MPID_nem_ib_lmt_done_send failed
**MPID_nem_ib_lmt_send_GET_DONE:MPID_nem_ib_lmt_send_GET_DONE failed
+**MPID_nem_ib_lmt_send_RTS:MPID_nem_ib_lmt_send_RTS failed
**MPID_nem_ib_npollingset:MPID_nem_ib_npollingset failed
**MPID_nem_ib_poll:MPID_nem_ib_poll failed
**MPID_nem_ib_poll_eager:MPID_nem_ib_poll_eager failed
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
index 5f4ec31..59b967d 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
@@ -1523,7 +1523,7 @@ int MPID_nem_ib_com_isend(int condesc,
#if 1
MPID_nem_ib_rc_send_request *wrap_wr_id = MPIU_Malloc(sizeof(MPID_nem_ib_rc_send_request));
wrap_wr_id->wr_id = wr_id;
- wrap_wr_id->mf = 0;
+ wrap_wr_id->mf = MPID_NEM_IB_LAST_PKT;
conp->icom_sr[MPID_NEM_IB_COM_SMT_NOINLINE].wr_id = (uint64_t) wrap_wr_id;
#else
@@ -1948,14 +1948,13 @@ int MPID_nem_ib_com_udrecv(int condesc)
}
int MPID_nem_ib_com_lrecv(int condesc, uint64_t wr_id, void *raddr, long sz_data, uint32_t rkey,
- void *laddr, int *post_num)
+ void *laddr, int last)
{
MPID_nem_ib_com_t *conp;
int ibcom_errno = 0;
struct ibv_send_wr *bad_wr;
int ib_errno;
int num_sge = 0;
- int i;
dprintf("MPID_nem_ib_com_lrecv,enter,raddr=%p,sz_data=%ld,laddr=%p\n", raddr, sz_data, laddr);
@@ -1970,79 +1969,12 @@ int MPID_nem_ib_com_lrecv(int condesc, uint64_t wr_id, void *raddr, long sz_data
MPID_NEM_IB_COM_ERR_CHKANDJUMP(!mr_data, -1,
dprintf("MPID_nem_ib_com_lrecv,ibv_reg_mr_fetch failed\n"));
-#if 1
- *post_num = 1;
-
- /* Type of max_msg_sz is uint32_t. */
- if (sz_data > (long) conp->icom_pattr.max_msg_sz) {
- *post_num += sz_data / (long)conp->icom_pattr.max_msg_sz;
- }
-
- for (i = 0; i < *post_num; i++) {
- MPID_nem_ib_rc_send_request *wrap_wr_id = MPIU_Malloc(sizeof(MPID_nem_ib_rc_send_request));
- wrap_wr_id->wr_id = wr_id;
-
- if (i == *post_num - 1)
- wrap_wr_id->mf = 0; /* end of packet */
- else
- wrap_wr_id->mf = 1;
-
- dprintf("MPID_nem_ib_com_lrecv,mf=%d,post=%d/%d\n", wrap_wr_id->mf, i + 1, *post_num);
-
- num_sge = 0;
-
-#ifdef HAVE_LIBDCFA
- conp->icom_sr[MPID_NEM_IB_COM_LMT_INITIATOR].sg_list[num_sge].mic_addr =
- (uint64_t) laddr + (i * conp->icom_pattr.max_msg_sz);
- conp->icom_sr[MPID_NEM_IB_COM_LMT_INITIATOR].sg_list[num_sge].addr =
- mr_data->host_addr + (i * conp->icom_pattr.max_msg_sz) + ((uint64_t) laddr -
- (uint64_t) laddr);
-#else
- conp->icom_sr[MPID_NEM_IB_COM_LMT_INITIATOR].sg_list[num_sge].addr =
- (uint64_t) laddr + (i * conp->icom_pattr.max_msg_sz);
-#endif
- if (sz_data > (long) conp->icom_pattr.max_msg_sz) {
- if (i == *post_num - 1) {
- conp->icom_sr[MPID_NEM_IB_COM_LMT_INITIATOR].sg_list[num_sge].length =
- (uint32_t) (sz_data - (long) conp->icom_pattr.max_msg_sz * i);
- }
- else {
- conp->icom_sr[MPID_NEM_IB_COM_LMT_INITIATOR].sg_list[num_sge].length =
- conp->icom_pattr.max_msg_sz;
- }
- }
- else {
- conp->icom_sr[MPID_NEM_IB_COM_LMT_INITIATOR].sg_list[num_sge].length = sz_data;
- }
- conp->icom_sr[MPID_NEM_IB_COM_LMT_INITIATOR].sg_list[num_sge].lkey = mr_data->lkey;
- num_sge += 1;
-
- conp->icom_sr[MPID_NEM_IB_COM_LMT_INITIATOR].num_sge = num_sge;
- conp->icom_sr[MPID_NEM_IB_COM_LMT_INITIATOR].wr_id = (uint64_t) wrap_wr_id;
- conp->icom_sr[MPID_NEM_IB_COM_LMT_INITIATOR].wr.rdma.remote_addr =
- (uint64_t) raddr + (i * conp->icom_pattr.max_msg_sz);
- conp->icom_sr[MPID_NEM_IB_COM_LMT_INITIATOR].wr.rdma.rkey = rkey;
-
-#ifdef HAVE_LIBDCFA
- ib_errno = ibv_post_send(conp->icom_qp, &conp->icom_sr[MPID_NEM_IB_COM_LMT_INITIATOR]);
- MPID_NEM_IB_COM_ERR_CHKANDJUMP(ib_errno, -1,
- dprintf("MPID_nem_ib_com_lrecv, ibv_post_send, rc=%d\n",
- ib_errno));
-#else
- ib_errno =
- ibv_post_send(conp->icom_qp, &conp->icom_sr[MPID_NEM_IB_COM_LMT_INITIATOR], &bad_wr);
- MPID_NEM_IB_COM_ERR_CHKANDJUMP(ib_errno, -1,
- printf
- ("MPID_nem_ib_com_lrecv, ibv_post_send, rc=%d, bad_wr=%p\n",
- ib_errno, bad_wr));
-#endif
+ MPID_nem_ib_rc_send_request *wrap_wr_id = MPIU_Malloc(sizeof(MPID_nem_ib_rc_send_request));
+ wrap_wr_id->wr_id = wr_id;
+ wrap_wr_id->mf = last;
- /* other commands can be executed before RDMA-rd command */
- /* see the "Ordering and the Fence Indicator" section in "InfiniBand Architecture" by William T. Futral */
+ num_sge = 0;
- conp->ncom += 1;
- }
-#else
/* Erase magic, super bug!! */
//((MPID_nem_ib_netmod_trailer_t*)(laddr + sz_data - sizeof(MPID_nem_ib_netmod_trailer_t)))->magic = 0;
#ifdef HAVE_LIBDCFA
@@ -2057,7 +1989,7 @@ int MPID_nem_ib_com_lrecv(int condesc, uint64_t wr_id, void *raddr, long sz_data
num_sge += 1;
conp->icom_sr[MPID_NEM_IB_COM_LMT_INITIATOR].num_sge = num_sge;
- conp->icom_sr[MPID_NEM_IB_COM_LMT_INITIATOR].wr_id = wr_id;
+ conp->icom_sr[MPID_NEM_IB_COM_LMT_INITIATOR].wr_id = (uint64_t) wrap_wr_id;
conp->icom_sr[MPID_NEM_IB_COM_LMT_INITIATOR].wr.rdma.remote_addr = (uint64_t) raddr;
conp->icom_sr[MPID_NEM_IB_COM_LMT_INITIATOR].wr.rdma.rkey = rkey;
@@ -2080,7 +2012,6 @@ int MPID_nem_ib_com_lrecv(int condesc, uint64_t wr_id, void *raddr, long sz_data
conp->after_rdma_rd = 1;
#endif
conp->ncom += 1;
-#endif
fn_exit:
return ibcom_errno;
@@ -2128,7 +2059,7 @@ int MPID_nem_ib_com_put_lmt(int condesc, uint64_t wr_id, void *raddr, int sz_dat
#if 1
MPID_nem_ib_rc_send_request *wrap_wr_id = MPIU_Malloc(sizeof(MPID_nem_ib_rc_send_request));
wrap_wr_id->wr_id = wr_id;
- wrap_wr_id->mf = 0;
+ wrap_wr_id->mf = MPID_NEM_IB_LAST_PKT;
conp->icom_sr[MPID_NEM_IB_COM_LMT_PUT].wr_id = (uint64_t) wrap_wr_id;
#else
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h
index 180a1fc..88e871f 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h
@@ -358,6 +358,11 @@ typedef struct {
int mf; /* more fragment (0 means the end of packet) */
} MPID_nem_ib_rc_send_request;
+#define MPID_NEM_IB_LMT_LAST_PKT 0
+#define MPID_NEM_IB_LMT_SEGMENT_LAST 1
+#define MPID_NEM_IB_LMT_PART_OF_SEGMENT 2
+#define MPID_NEM_IB_LAST_PKT MPID_NEM_IB_LMT_LAST_PKT
+
/* Ring-buffer to which a remote note RDMA-writes */
#define MPID_NEM_IB_NRINGBUF 64
#define MPID_NEM_IB_RINGBUF_NSLOT 16
@@ -539,7 +544,7 @@ extern int MPID_nem_ib_com_udsend(int condesc, union ibv_gid *remote_gid, uint16
uint32_t remote_qpn, uint32_t imm_data, uint64_t wr_id);
extern int MPID_nem_ib_com_udrecv(int condesc);
extern int MPID_nem_ib_com_lrecv(int condesc, uint64_t wr_id, void *raddr, long sz_data,
- uint32_t rkey, void *laddr, int *post_num);
+ uint32_t rkey, void *laddr, int last);
extern int MPID_nem_ib_com_put_lmt(int condesc, uint64_t wr_id, void *raddr, int sz_data,
uint32_t rkey, void *laddr);
extern int MPID_nem_ib_com_scratch_pad_recv(int condesc, int sz_data);
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
index 2d462eb..576c61f 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
@@ -67,7 +67,7 @@ typedef struct {
struct MPID_Request *sendq_next; /* for sendq */
void *lmt_raddr; /* remember this for sendq, it might be better to use sreq->dev.iov[0].MPID_IOV_BUF instead */
uint32_t lmt_rkey; /* remember this for sendq, survive over lrecv and referenced when dequeueing from sendq */
- uint32_t lmt_szsend; /* remember this for sendq */
+ long lmt_szsend; /* remember this for sendq */
uint8_t lmt_tail, lmt_sender_tail, lmt_receiver_tail; /* survive over lrecv and referenced when polling */
MPI_Aint lmt_dt_true_lb; /* to locate the last byte of receive buffer */
void *lmt_write_to_buf; /* user buffer or temporary buffer for pack and remember it for lmt_orderq */
@@ -75,6 +75,16 @@ typedef struct {
void *buf_from; /* address of RDMA write from buffer */
uint32_t buf_from_sz; /* size of RDMA write from buffer. It's set on sending, referenced on freeing */
uint8_t ask; /* Issued ask or not on send */
+ union {
+ void *from;
+ void *to;
+ } buf;
+ uint32_t max_msg_sz; /* remember this for sendq, max message size */
+ MPIDI_msg_sz_t data_sz;
+ int seg_seq_num; /* sequence number of segments */
+ int seg_num; /* number of segments */
+ int last; /* flag for last packet or not */
+ void *lmt_mr_cache; /* address of mr_cache_entry */
} MPID_nem_ib_req_area;
/* macro for secret area in req */
@@ -602,8 +612,8 @@ int MPID_nem_ib_send_progress(MPIDI_VC_t * vc);
/* CH3--lmt send/recv functions */
int MPID_nem_ib_lmt_initiate_lmt(struct MPIDI_VC *vc, union MPIDI_CH3_Pkt *rts_pkt,
struct MPID_Request *req);
-int MPID_nem_ib_lmt_start_recv_core(struct MPID_Request *req, void *raddr, uint32_t rkey,
- void *write_to_buf);
+int MPID_nem_ib_lmt_start_recv_core(struct MPID_Request *req, void *raddr, uint32_t rkey, long len,
+ void *write_to_buf, uint32_t max_msg_sz, int end);
int MPID_nem_ib_lmt_start_recv(struct MPIDI_VC *vc, struct MPID_Request *req, MPID_IOV s_cookie);
int MPID_nem_ib_lmt_handle_cookie(struct MPIDI_VC *vc, struct MPID_Request *req, MPID_IOV cookie);
int MPID_nem_ib_lmt_switch_send(struct MPIDI_VC *vc, struct MPID_Request *req);
@@ -692,6 +702,9 @@ typedef struct {
int seq_num_tail; /* notify RDMA-write-to buffer occupation */
#endif
uint8_t tail; /* last word of payload */
+ uint32_t max_msg_sz; /* max message size */
+ int seg_seq_num;
+ int seg_num;
} MPID_nem_ib_lmt_cookie_t;
typedef struct {
@@ -700,6 +713,7 @@ typedef struct {
uint8_t tail; /* last word of payload */
int len;
MPI_Request sender_req_id; /* request id of sender side */
+ uint32_t max_msg_sz; /* max message size */
} MPID_nem_ib_rma_lmt_cookie_t;
typedef enum MPID_nem_ib_pkt_subtype {
@@ -712,6 +726,7 @@ typedef enum MPID_nem_ib_pkt_subtype {
MPIDI_NEM_IB_PKT_GET,
MPIDI_NEM_IB_PKT_GET_RESP,
MPIDI_NEM_IB_PKT_LMT_GET_DONE,
+ MPIDI_NEM_IB_PKT_LMT_RTS,
MPIDI_NEM_IB_PKT_REQ_SEQ_NUM,
MPIDI_NEM_IB_PKT_REPLY_SEQ_NUM,
MPIDI_NEM_IB_PKT_CHG_RDMABUF_OCC_NOTIFY_STATE,
@@ -734,8 +749,20 @@ typedef struct MPID_nem_ib_pkt_lmt_get_done {
/* additional field */
MPI_Request req_id;
int16_t seq_num_tail;
+ MPI_Request receiver_req_id;
} MPID_nem_ib_pkt_lmt_get_done_t;
+typedef struct MPID_nem_ib_pkt_lmt_rts {
+ MPIDI_CH3_Pkt_type_t type;
+ unsigned subtype;
+ /* additional field */
+ MPI_Request req_id;
+ int16_t seq_num_tail;
+ void *addr;
+ uint32_t rkey;
+ int seg_seq_num;
+} MPID_nem_ib_pkt_lmt_rts_t;
+
/* derived from MPID_nem_pkt_netmod_t */
typedef struct MPID_nem_ib_pkt_req_seq_num_t {
MPIDI_CH3_Pkt_type_t type;
@@ -784,6 +811,8 @@ int MPID_nem_ib_PktHandler_lmt_done(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
MPIDI_msg_sz_t * buflen, MPID_Request ** rreqp);
int MPID_nem_ib_pkt_GET_DONE_handler(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
MPIDI_msg_sz_t * buflen, MPID_Request ** rreqp);
+int MPID_nem_ib_pkt_RTS_handler(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
+ MPIDI_msg_sz_t * buflen, MPID_Request ** rreqp);
int MPID_nem_ib_PktHandler_req_seq_num(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
MPIDI_msg_sz_t * buflen, MPID_Request ** rreqp);
int MPID_nem_ib_PktHandler_reply_seq_num(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
@@ -886,6 +915,7 @@ int pkt_DONE_handler(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt, MPIDI_msg_sz_t * bu
MPIDI_Pkt_init(_done_pkt, MPIDI_NEM_PKT_NETMOD); \
_done_pkt->subtype = MPIDI_NEM_IB_PKT_LMT_GET_DONE;\
_done_pkt->req_id = (rreq)->ch.lmt_req_id; \
+ _done_pkt->receiver_req_id = (rreq)->handle; \
/* embed SR occupancy information */ \
_done_pkt->seq_num_tail = VC_FIELD(vc, ibcom->rsr_seq_num_tail); \
\
@@ -902,6 +932,33 @@ int pkt_DONE_handler(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt, MPIDI_msg_sz_t * bu
} \
} while (0)
+#define MPID_nem_ib_lmt_send_RTS(vc, _req_id, _addr, _rkey, _seg_seq_num) do { \
+ MPID_PKT_DECL_CAST(_upkt, MPID_nem_ib_pkt_lmt_rts_t, _rts_pkt); \
+ MPID_Request *_rts_req; \
+ \
+ MPIU_DBG_MSG(CH3_OTHER,VERBOSE,"sending rndv RTS segment packet"); \
+ MPIDI_Pkt_init(_rts_pkt, MPIDI_NEM_PKT_NETMOD); \
+ _rts_pkt->subtype = MPIDI_NEM_IB_PKT_LMT_RTS;\
+ _rts_pkt->req_id = _req_id; \
+ _rts_pkt->addr = _addr; \
+ _rts_pkt->rkey = _rkey; \
+ _rts_pkt->seg_seq_num = _seg_seq_num; \
+ /* embed SR occupancy information */ \
+ _rts_pkt->seq_num_tail = VC_FIELD(vc, ibcom->rsr_seq_num_tail); \
+ \
+ /* remember the last one sent */ \
+ VC_FIELD(vc, ibcom->rsr_seq_num_tail_last_sent) = VC_FIELD(vc, ibcom->rsr_seq_num_tail); \
+ \
+ mpi_errno = MPIDI_CH3_iStartMsg((vc), _rts_pkt, sizeof(*_rts_pkt), &_rts_req); \
+ MPIU_ERR_CHKANDJUMP(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_lmt_send_RTS"); \
+ if (_rts_req != NULL) \
+ { \
+ MPIU_ERR_CHKANDJUMP(_rts_req->status.MPI_ERROR, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_lmt_send_RTS"); \
+ MPID_Request_release(_rts_req); \
+ dprintf("send_rts,release,req=%p\n", _rts_req); \
+ } \
+ } while (0)
+
#define MPID_nem_ib_lmt_send_PKT_LMT_DONE(vc, rreq) do { \
MPID_PKT_DECL_CAST(_upkt, MPID_nem_ib_pkt_lmt_get_done_t, _done_pkt); \
MPID_Request *_done_req; \
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_init.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_init.c
index 4f8b5bc..a8382fa 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_init.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_init.c
@@ -959,6 +959,7 @@ int MPID_nem_ib_vc_init(MPIDI_VC_t * vc)
MPID_nem_ib_pkt_handler[MPIDI_NEM_IB_PKT_GET_RESP] = MPID_nem_ib_PktHandler_GetResp;
MPID_nem_ib_pkt_handler[MPIDI_NEM_IB_PKT_ACCUMULATE] = MPID_nem_ib_PktHandler_Accumulate;
MPID_nem_ib_pkt_handler[MPIDI_NEM_IB_PKT_LMT_GET_DONE] = MPID_nem_ib_pkt_GET_DONE_handler;
+ MPID_nem_ib_pkt_handler[MPIDI_NEM_IB_PKT_LMT_RTS] = MPID_nem_ib_pkt_RTS_handler;
MPID_nem_ib_pkt_handler[MPIDI_NEM_IB_PKT_REQ_SEQ_NUM] = MPID_nem_ib_PktHandler_req_seq_num;
MPID_nem_ib_pkt_handler[MPIDI_NEM_IB_PKT_REPLY_SEQ_NUM] = MPID_nem_ib_PktHandler_reply_seq_num;
MPID_nem_ib_pkt_handler[MPIDI_NEM_IB_PKT_CHG_RDMABUF_OCC_NOTIFY_STATE] =
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
index ed40e64..8f878fb 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
@@ -110,9 +110,35 @@ int MPID_nem_ib_lmt_initiate_lmt(struct MPIDI_VC *vc, union MPIDI_CH3_Pkt *rts_p
vc_ib->ibcom->rsr_seq_num_tail_last_sent = vc_ib->ibcom->rsr_seq_num_tail;
#endif
+ int post_num;
+ uint32_t max_msg_sz;
+ MPID_nem_ib_vc_area *vc_ib = VC_IB(vc);
+ MPID_nem_ib_com_get_info_conn(vc_ib->sc->fd, MPID_NEM_IB_COM_INFOKEY_PATTR_MAX_MSG_SZ,
+ &max_msg_sz, sizeof(uint32_t));
+
+ /* Type of max_msg_sz is uint32_t. */
+ post_num = (data_sz + (long) max_msg_sz - 1) / (long) max_msg_sz;
+
+ s_cookie_buf->max_msg_sz = max_msg_sz;
+ s_cookie_buf->seg_seq_num = 1;
+ s_cookie_buf->seg_num = post_num;
+
+ REQ_FIELD(req, buf.from) = write_from_buf;
+ REQ_FIELD(req, data_sz) = data_sz;
+ REQ_FIELD(req, seg_seq_num) = 1; // only send 1st-segment, even if there are some segments.
+ REQ_FIELD(req, seg_num) = post_num;
+ REQ_FIELD(req, max_msg_sz) = max_msg_sz;
+
+ long length;
+ if (post_num > 1) {
+ length = max_msg_sz;
+ }
+ else {
+ length = data_sz;
+ }
/* put IB rkey */
struct ibv_mr *mr =
- MPID_nem_ib_com_reg_mr_fetch(write_from_buf, data_sz, 0, MPID_NEM_IB_COM_REG_MR_GLOBAL);
+ MPID_nem_ib_com_reg_mr_fetch(write_from_buf, length, 0, MPID_NEM_IB_COM_REG_MR_GLOBAL);
MPIU_ERR_CHKANDJUMP(!mr, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_reg_mr_fetch");
#ifdef HAVE_LIBDCFA
s_cookie_buf->addr = (void *) mr->host_addr;
@@ -139,32 +165,73 @@ int MPID_nem_ib_lmt_initiate_lmt(struct MPIDI_VC *vc, union MPIDI_CH3_Pkt *rts_p
#define FUNCNAME MPID_nem_ib_lmt_start_recv_core
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
-int MPID_nem_ib_lmt_start_recv_core(struct MPID_Request *req, void *raddr, uint32_t rkey,
- void *write_to_buf)
+int MPID_nem_ib_lmt_start_recv_core(struct MPID_Request *req, void *raddr, uint32_t rkey, long len,
+ void *write_to_buf, uint32_t max_msg_sz, int end)
{
int mpi_errno = MPI_SUCCESS;
int ibcom_errno;
struct MPIDI_VC *vc = req->ch.vc;
MPID_nem_ib_vc_area *vc_ib = VC_IB(vc);
+ int i;
+ int divide;
+ int posted_num;
+ int last;
+ uint32_t r_max_msg_sz; /* responder's max_msg_sz */
+ void *write_pos;
+ void *addr;
+ long data_sz;
+ MPIDI_msg_sz_t rest_data_sz;
MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_IB_LMT_START_RECV_CORE);
MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_IB_LMT_START_RECV_CORE);
-#if 1
- int post_num = 1;
+ MPID_nem_ib_com_get_info_conn(vc_ib->sc->fd, MPID_NEM_IB_COM_INFOKEY_PATTR_MAX_MSG_SZ,
+ &r_max_msg_sz, sizeof(uint32_t));
- ibcom_errno =
- MPID_nem_ib_com_lrecv(vc_ib->sc->fd, (uint64_t) req, raddr, req->ch.lmt_data_sz, rkey,
- write_to_buf, &post_num);
- MPID_nem_ib_ncqe += post_num;
-#else
- ibcom_errno =
- MPID_nem_ib_com_lrecv(vc_ib->sc->fd, (uint64_t) req, raddr, req->ch.lmt_data_sz, rkey,
- write_to_buf);
- MPID_nem_ib_ncqe += 1;
-#endif
+ divide = (max_msg_sz + r_max_msg_sz - 1) / r_max_msg_sz;
+
+ write_pos = write_to_buf;
+ posted_num = 0;
+ last = MPID_NEM_IB_LMT_PART_OF_SEGMENT;
+ rest_data_sz = len;
+ addr = raddr;
+
+ for (i = 0; i < divide; i++) {
+ if (i == divide - 1)
+ data_sz = max_msg_sz - i * r_max_msg_sz;
+ else
+ data_sz = r_max_msg_sz;
+
+ if (i == divide - 1) {
+ if (end)
+ last = MPID_NEM_IB_LMT_LAST_PKT; /* last part of last segment packet */
+ else
+ last = MPID_NEM_IB_LMT_SEGMENT_LAST; /* last part of this segment */
+
+ /* last data may be smaller than initiator's max_msg_sz */
+ if (rest_data_sz < max_msg_sz)
+ data_sz = rest_data_sz;
+ }
+
+ ibcom_errno =
+ MPID_nem_ib_com_lrecv(vc_ib->sc->fd, (uint64_t) req, addr, data_sz, rkey,
+ write_pos, last);
+ MPIU_ERR_CHKANDJUMP(ibcom_errno, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_lrecv");
+
+ /* update position */
+ write_pos = (void *) ((char *) write_pos + data_sz);
+ addr = (void *) ((char *) addr + data_sz);
+
+ /* update rest data size */
+ rest_data_sz -= data_sz;
+
+ /* count request number */
+ posted_num++;
+ }
+
+ MPIU_Assert(rest_data_sz == 0);
+ MPID_nem_ib_ncqe += posted_num;
//dprintf("start_recv,ncqe=%d\n", MPID_nem_ib_ncqe);
- MPIU_ERR_CHKANDJUMP(ibcom_errno, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_lrecv");
dprintf("lmt_start_recv_core,MPID_nem_ib_ncqe=%d\n", MPID_nem_ib_ncqe);
dprintf
("lmt_start_recv_core,req=%p,sz=%ld,write_to_buf=%p,lmt_pack_buf=%p,user_buf=%p,raddr=%p,rkey=%08x,tail=%p=%02x\n",
@@ -174,11 +241,7 @@ int MPID_nem_ib_lmt_start_recv_core(struct MPID_Request *req, void *raddr, uint3
//fflush(stdout);
#ifdef MPID_NEM_IB_LMT_GET_CQE
-#if 1
- MPID_nem_ib_ncqe_to_drain += post_num; /* use CQE instead of polling */
-#else
- MPID_nem_ib_ncqe_to_drain += 1; /* use CQE instead of polling */
-#endif
+ MPID_nem_ib_ncqe_to_drain += posted_num; /* use CQE instead of polling */
#else
/* drain_scq and ib_poll is not ordered, so both can decrement ref_count */
MPIR_Request_add_ref(req);
@@ -242,6 +305,8 @@ int MPID_nem_ib_lmt_start_recv(struct MPIDI_VC *vc, struct MPID_Request *req, MP
write_to_buf = REQ_FIELD(req, lmt_pack_buf);
}
+ REQ_FIELD(req, buf.to) = write_to_buf;
+
#ifdef MPID_NEM_IB_LMT_GET_CQE
#else
/* unmark magic */
@@ -260,12 +325,25 @@ int MPID_nem_ib_lmt_start_recv(struct MPIDI_VC *vc, struct MPID_Request *req, MP
//dprintf("lmt_start_recv,sendq_empty=%d,ncom=%d,ncqe=%d\n", MPID_nem_ib_sendq_empty(vc_ib->sendq), vc_ib->ibcom->ncom < MPID_NEM_IB_COM_MAX_SQ_CAPACITY, MPID_nem_ib_ncqe < MPID_NEM_IB_COM_MAX_CQ_CAPACITY);
+ int last = 1;
+ long length = req->ch.lmt_data_sz;
+
+ if (s_cookie_buf->seg_seq_num != s_cookie_buf->seg_num) {
+ last = 0;
+ length = s_cookie_buf->max_msg_sz;
+ }
+
+ REQ_FIELD(req, max_msg_sz) = s_cookie_buf->max_msg_sz; /* store initiator's max_msg_sz */
+ REQ_FIELD(req, seg_num) = s_cookie_buf->seg_num; /* store number of segments */
+
/* try to issue RDMA-read command */
int slack = 1; /* slack for control packet bringing sequence number */
if (MPID_nem_ib_sendq_empty(vc_ib->sendq) &&
vc_ib->ibcom->ncom < MPID_NEM_IB_COM_MAX_SQ_CAPACITY - slack &&
MPID_nem_ib_ncqe < MPID_NEM_IB_COM_MAX_CQ_CAPACITY - slack) {
- mpi_errno = MPID_nem_ib_lmt_start_recv_core(req, s_cookie_buf->addr, s_cookie_buf->rkey, write_to_buf); /* fast path not storing raddr and rkey */
+ mpi_errno =
+ MPID_nem_ib_lmt_start_recv_core(req, s_cookie_buf->addr, s_cookie_buf->rkey, length,
+ write_to_buf, s_cookie_buf->max_msg_sz, last);
if (mpi_errno) {
MPIU_ERR_POP(mpi_errno);
}
@@ -281,6 +359,8 @@ int MPID_nem_ib_lmt_start_recv(struct MPIDI_VC *vc, struct MPID_Request *req, MP
REQ_FIELD(req, lmt_raddr) = s_cookie_buf->addr;
REQ_FIELD(req, lmt_rkey) = s_cookie_buf->rkey;
REQ_FIELD(req, lmt_write_to_buf) = write_to_buf;
+ REQ_FIELD(req, lmt_szsend) = length;
+ REQ_FIELD(req, last) = last;
MPID_nem_ib_sendq_enqueue(&vc_ib->sendq, req);
}
@@ -322,6 +402,7 @@ int MPID_nem_ib_lmt_start_recv(struct MPIDI_VC *vc, struct MPID_Request *req, MP
goto fn_exit;
}
+#if 0 /* unused function */
/* fall-back to lmt-get if end-flag of send-buf has the same value as the end-flag of recv-buf */
#undef FUNCNAME
#define FUNCNAME MPID_nem_ib_lmt_switch_send
@@ -396,6 +477,7 @@ int MPID_nem_ib_lmt_switch_send(struct MPIDI_VC *vc, struct MPID_Request *req)
fn_fail:
goto fn_exit;
}
+#endif
/* when cookie is received in the middle of the lmt */
#undef FUNCNAME
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
index 25b9d57..050aefd 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
@@ -332,7 +332,7 @@ int MPID_nem_ib_drain_scq(int dont_call_progress)
#if defined(MPID_NEM_IB_LMT_GET_CQE)
/* end of packet */
- if (req_wrap->mf == 0) {
+ if (req_wrap->mf == MPID_NEM_IB_LMT_LAST_PKT) {
/* unpack non-contiguous dt */
int is_contig;
MPID_Datatype_is_contig(req->dev.datatype, &is_contig);
@@ -370,6 +370,9 @@ int MPID_nem_ib_drain_scq(int dont_call_progress)
/* send done to sender. vc is stashed in MPID_nem_ib_lmt_start_recv (in ib_lmt.c) */
MPID_nem_ib_lmt_send_GET_DONE(req->ch.vc, req);
}
+ else if (req_wrap->mf == MPID_NEM_IB_LMT_SEGMENT_LAST) {
+ MPID_nem_ib_lmt_send_GET_DONE(req->ch.vc, req);
+ }
#endif
/* unmark "lmt is going on" */
@@ -381,7 +384,7 @@ int MPID_nem_ib_drain_scq(int dont_call_progress)
dprintf("drain_scq,rdma-read,ncqe=%d\n", MPID_nem_ib_ncqe);
#ifdef MPID_NEM_IB_LMT_GET_CQE
- if (req_wrap->mf == 0) {
+ if (req_wrap->mf == MPID_NEM_IB_LMT_LAST_PKT) {
dprintf("drain_scq,GET_CQE,Request_complete\n");
/* mark completion on rreq */
MPIDI_CH3U_Request_complete(req);
@@ -437,7 +440,7 @@ int MPID_nem_ib_drain_scq(int dont_call_progress)
MPID_nem_ib_vc_area *vc_ib = VC_IB(req->ch.vc);
/* end of packet */
- if (req_wrap->mf == 0) {
+ if (req_wrap->mf == MPID_NEM_IB_LMT_LAST_PKT) {
MPIDI_msg_sz_t data_len = req->ch.lmt_data_sz;
MPI_Aint type_size;
@@ -468,7 +471,7 @@ int MPID_nem_ib_drain_scq(int dont_call_progress)
MPID_nem_ib_vc_area *vc_ib = VC_IB(req->ch.vc);
/* end of packet */
- if (req_wrap->mf == 0) {
+ if (req_wrap->mf == MPID_NEM_IB_LMT_LAST_PKT) {
MPIDI_msg_sz_t data_len = req->ch.lmt_data_sz;
int complete = 0;
mpi_errno =
@@ -500,7 +503,7 @@ int MPID_nem_ib_drain_scq(int dont_call_progress)
cqe[i].opcode == IBV_WC_RDMA_READ) {
MPID_nem_ib_vc_area *vc_ib = VC_IB(req->ch.vc);
/* end of packet */
- if (req_wrap->mf == 0) {
+ if (req_wrap->mf == MPID_NEM_IB_LMT_LAST_PKT) {
MPIDI_msg_sz_t buflen = req->ch.lmt_data_sz;
char *buf = (char *) REQ_FIELD(req, lmt_pack_buf);
int complete = 0;
@@ -541,7 +544,7 @@ int MPID_nem_ib_drain_scq(int dont_call_progress)
MPID_nem_ib_vc_area *vc_ib = VC_IB(req->ch.vc);
/* end of packet */
- if (req_wrap->mf == 0) {
+ if (req_wrap->mf == MPID_NEM_IB_LMT_LAST_PKT) {
MPIDI_msg_sz_t data_len = req->ch.lmt_data_sz;
int complete = 0;
mpi_errno =
@@ -573,7 +576,7 @@ int MPID_nem_ib_drain_scq(int dont_call_progress)
cqe[i].opcode == IBV_WC_RDMA_READ) {
MPID_nem_ib_vc_area *vc_ib = VC_IB(req->ch.vc);
/* end of packet */
- if (req_wrap->mf == 0) {
+ if (req_wrap->mf == MPID_NEM_IB_LMT_LAST_PKT) {
MPIDI_msg_sz_t buflen = req->ch.lmt_data_sz;
char *buf = (char *) REQ_FIELD(req, lmt_pack_buf);
int complete = 0;
@@ -1856,7 +1859,10 @@ int MPID_nem_ib_PktHandler_Put(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
if (MPID_nem_ib_sendq_empty(vc_ib->sendq) &&
vc_ib->ibcom->ncom < MPID_NEM_IB_COM_MAX_SQ_CAPACITY - slack &&
MPID_nem_ib_ncqe < MPID_NEM_IB_COM_MAX_CQ_CAPACITY - slack) {
- mpi_errno = MPID_nem_ib_lmt_start_recv_core(req, s_cookie_buf->addr, s_cookie_buf->rkey, write_to_buf); /* fast path not storing raddr and rkey */
+ mpi_errno =
+ MPID_nem_ib_lmt_start_recv_core(req, s_cookie_buf->addr, s_cookie_buf->rkey,
+ s_cookie_buf->len, write_to_buf,
+ s_cookie_buf->max_msg_sz, 1);
if (mpi_errno) {
MPIU_ERR_POP(mpi_errno);
}
@@ -1872,6 +1878,9 @@ int MPID_nem_ib_PktHandler_Put(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
REQ_FIELD(req, lmt_raddr) = s_cookie_buf->addr;
REQ_FIELD(req, lmt_rkey) = s_cookie_buf->rkey;
REQ_FIELD(req, lmt_write_to_buf) = write_to_buf;
+ REQ_FIELD(req, lmt_szsend) = s_cookie_buf->len;
+ REQ_FIELD(req, max_msg_sz) = s_cookie_buf->max_msg_sz;
+ REQ_FIELD(req, last) = 1; /* not support segmentation */
/* set for send_progress */
MPIDI_Request_set_msg_type(req, MPIDI_REQUEST_RNDV_MSG);
@@ -1992,7 +2001,10 @@ int MPID_nem_ib_PktHandler_Accumulate(MPIDI_VC_t * vc,
if (MPID_nem_ib_sendq_empty(vc_ib->sendq) &&
vc_ib->ibcom->ncom < MPID_NEM_IB_COM_MAX_SQ_CAPACITY - slack &&
MPID_nem_ib_ncqe < MPID_NEM_IB_COM_MAX_CQ_CAPACITY - slack) {
- mpi_errno = MPID_nem_ib_lmt_start_recv_core(req, s_cookie_buf->addr, s_cookie_buf->rkey, write_to_buf); /* fast path not storing raddr and rkey */
+ mpi_errno =
+ MPID_nem_ib_lmt_start_recv_core(req, s_cookie_buf->addr, s_cookie_buf->rkey,
+ s_cookie_buf->len, write_to_buf,
+ s_cookie_buf->max_msg_sz, 1);
if (mpi_errno) {
MPIU_ERR_POP(mpi_errno);
}
@@ -2008,6 +2020,9 @@ int MPID_nem_ib_PktHandler_Accumulate(MPIDI_VC_t * vc,
REQ_FIELD(req, lmt_raddr) = s_cookie_buf->addr;
REQ_FIELD(req, lmt_rkey) = s_cookie_buf->rkey;
REQ_FIELD(req, lmt_write_to_buf) = write_to_buf;
+ REQ_FIELD(req, lmt_szsend) = s_cookie_buf->len;
+ REQ_FIELD(req, max_msg_sz) = s_cookie_buf->max_msg_sz;
+ REQ_FIELD(req, last) = 1; /* not support segmentation */
/* set for send_progress */
MPIDI_Request_set_msg_type(req, MPIDI_REQUEST_RNDV_MSG);
@@ -2129,7 +2144,10 @@ int MPID_nem_ib_PktHandler_GetResp(MPIDI_VC_t * vc,
if (MPID_nem_ib_sendq_empty(vc_ib->sendq) &&
vc_ib->ibcom->ncom < MPID_NEM_IB_COM_MAX_SQ_CAPACITY - slack &&
MPID_nem_ib_ncqe < MPID_NEM_IB_COM_MAX_CQ_CAPACITY - slack) {
- mpi_errno = MPID_nem_ib_lmt_start_recv_core(req, s_cookie_buf->addr, s_cookie_buf->rkey, write_to_buf); /* fast path not storing raddr and rkey */
+ mpi_errno =
+ MPID_nem_ib_lmt_start_recv_core(req, s_cookie_buf->addr, s_cookie_buf->rkey,
+ s_cookie_buf->len, write_to_buf,
+ s_cookie_buf->max_msg_sz, 1);
if (mpi_errno) {
MPIU_ERR_POP(mpi_errno);
}
@@ -2145,6 +2163,9 @@ int MPID_nem_ib_PktHandler_GetResp(MPIDI_VC_t * vc,
REQ_FIELD(req, lmt_raddr) = s_cookie_buf->addr;
REQ_FIELD(req, lmt_rkey) = s_cookie_buf->rkey;
REQ_FIELD(req, lmt_write_to_buf) = write_to_buf;
+ REQ_FIELD(req, lmt_szsend) = s_cookie_buf->len;
+ REQ_FIELD(req, max_msg_sz) = s_cookie_buf->max_msg_sz;
+ REQ_FIELD(req, last) = 1; /* not support segmentation */
MPID_nem_ib_sendq_enqueue(&vc_ib->sendq, req);
}
@@ -2219,9 +2240,39 @@ int MPID_nem_ib_pkt_GET_DONE_handler(MPIDI_VC_t * vc,
}
dprintf("get_done_handler,send_progress\n");
fflush(stdout);
- MPID_NEM_IB_CHECK_AND_SEND_PROGRESS mpi_errno = vc->ch.lmt_done_send(vc, req);
- if (mpi_errno)
- MPIU_ERR_POP(mpi_errno);
+
+ if (REQ_FIELD(req, seg_seq_num) == REQ_FIELD(req, seg_num)) {
+ /* last packet of segments */
+ MPID_NEM_IB_CHECK_AND_SEND_PROGRESS mpi_errno = vc->ch.lmt_done_send(vc, req);
+ if (mpi_errno)
+ MPIU_ERR_POP(mpi_errno);
+ }
+ else {
+ /* Send RTS for next segment */
+ REQ_FIELD(req, seg_seq_num) += 1; /* next segment number */
+ int next_seg_seq_num = REQ_FIELD(req, seg_seq_num);
+
+ uint32_t length;
+ if (next_seg_seq_num == REQ_FIELD(req, seg_num))
+ length = REQ_FIELD(req, data_sz) - (long) (next_seg_seq_num - 1) * REQ_FIELD(req, max_msg_sz); //length of last segment
+ else
+ length = REQ_FIELD(req, max_msg_sz);
+
+ void *addr =
+ (void *) ((char *) REQ_FIELD(req, buf.from) +
+ (long) (next_seg_seq_num - 1) * REQ_FIELD(req, max_msg_sz));
+ struct ibv_mr *mr =
+ MPID_nem_ib_com_reg_mr_fetch(addr, length, 0, MPID_NEM_IB_COM_REG_MR_GLOBAL);
+ MPIU_ERR_CHKANDJUMP(!mr, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_reg_mr_fetch");
+
+#ifdef HAVE_LIBDCFA
+ void *_addr = mr->host_addr;
+#else
+ void *_addr = addr;
+#endif
+ MPID_nem_ib_lmt_send_RTS(vc, done_pkt->receiver_req_id, _addr, mr->rkey,
+ next_seg_seq_num);
+ }
break;
default:
MPIU_ERR_INTERNALANDJUMP(mpi_errno, "unexpected request type");
@@ -2238,6 +2289,78 @@ int MPID_nem_ib_pkt_GET_DONE_handler(MPIDI_VC_t * vc,
}
#undef FUNCNAME
+#define FUNCNAME MPID_nem_ib_pkt_RTS_handler
+#undef FCNAME
+#define FCNAME MPIDI_QUOTE(FUNCNAME)
+int MPID_nem_ib_pkt_RTS_handler(MPIDI_VC_t * vc,
+ MPIDI_CH3_Pkt_t * pkt,
+ MPIDI_msg_sz_t * buflen, MPID_Request ** rreqp)
+{
+ int mpi_errno = MPI_SUCCESS;
+ MPID_nem_ib_pkt_lmt_rts_t *const rts_pkt = (MPID_nem_ib_pkt_lmt_rts_t *) pkt;
+ MPID_Request *req;
+ MPID_nem_ib_vc_area *vc_ib = VC_IB(vc);
+ dprintf("ib_pkt_RTS_handler,enter\n");
+ *buflen = sizeof(MPIDI_CH3_Pkt_t);
+ MPID_Request_get_ptr(rts_pkt->req_id, req);
+ MPIU_THREAD_CS_ENTER(LMT,);
+
+ void *write_to_buf =
+ (void *) ((char *) REQ_FIELD(req, buf.to) +
+ (long) (rts_pkt->seg_seq_num - 1) * REQ_FIELD(req, max_msg_sz));
+
+ int last;
+ long length;
+
+ /* last segment */
+ if (rts_pkt->seg_seq_num == REQ_FIELD(req, seg_num)) {
+ last = 1;
+ length =
+ req->ch.lmt_data_sz - (long) (rts_pkt->seg_seq_num - 1) * REQ_FIELD(req, max_msg_sz);
+ }
+ else {
+ last = 0;
+ length = REQ_FIELD(req, max_msg_sz);
+ }
+ /* try to issue RDMA-read command */
+ int slack = 1; /* slack for control packet bringing sequence number */
+ if (MPID_nem_ib_sendq_empty(vc_ib->sendq) &&
+ vc_ib->ibcom->ncom < MPID_NEM_IB_COM_MAX_SQ_CAPACITY - slack &&
+ MPID_nem_ib_ncqe < MPID_NEM_IB_COM_MAX_CQ_CAPACITY - slack) {
+ mpi_errno =
+ MPID_nem_ib_lmt_start_recv_core(req, rts_pkt->addr, rts_pkt->rkey, length,
+ write_to_buf, REQ_FIELD(req, max_msg_sz),
+ last);
+ if (mpi_errno) {
+ MPIU_ERR_POP(mpi_errno);
+ }
+ }
+ else {
+ /* enqueue command into send_queue */
+ dprintf("ib_pkt_RTS_handler, enqueuing,sendq_empty=%d,ncom=%d,ncqe=%d\n",
+ MPID_nem_ib_sendq_empty(vc_ib->sendq),
+ vc_ib->ibcom->ncom < MPID_NEM_IB_COM_MAX_SQ_CAPACITY,
+ MPID_nem_ib_ncqe < MPID_NEM_IB_COM_MAX_CQ_CAPACITY);
+
+ /* make raddr, (sz is in rreq->ch.lmt_data_sz), rkey, (user_buf is in req->dev.user_buf) survive enqueue, free cookie, dequeue */
+ REQ_FIELD(req, lmt_raddr) = rts_pkt->addr;
+ REQ_FIELD(req, lmt_rkey) = rts_pkt->rkey;
+ REQ_FIELD(req, lmt_write_to_buf) = write_to_buf;
+ REQ_FIELD(req, lmt_szsend) = length;
+ REQ_FIELD(req, last) = last;
+
+ MPID_nem_ib_sendq_enqueue(&vc_ib->sendq, req);
+ }
+
+ *rreqp = NULL;
+ fn_exit:
+ MPIU_THREAD_CS_EXIT(LMT,);
+ return mpi_errno;
+ fn_fail:
+ goto fn_exit;
+}
+
+#undef FUNCNAME
#define FUNCNAME MPID_nem_ib_PktHandler_req_seq_num
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
index 1ab307b..69615c1 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
@@ -241,12 +241,19 @@ static int MPID_nem_ib_iSendContig_core(MPIDI_VC_t * vc, MPID_Request * sreq, vo
void *write_from_buf = data;
+ uint32_t max_msg_sz;
+ MPID_nem_ib_com_get_info_conn(vc_ib->sc->fd, MPID_NEM_IB_COM_INFOKEY_PATTR_MAX_MSG_SZ,
+ &max_msg_sz, sizeof(uint32_t));
+
+ /* RMA : Netmod IB supports only smaller size than max_msg_sz. */
+ MPIU_Assert(data_sz <= max_msg_sz);
+
MPID_nem_ib_rma_lmt_cookie_t *s_cookie_buf = (MPID_nem_ib_rma_lmt_cookie_t *) MPIU_Malloc(sizeof(MPID_nem_ib_rma_lmt_cookie_t));
sreq->ch.s_cookie = s_cookie_buf;
s_cookie_buf->tail = *((uint8_t *) ((uint8_t *) write_from_buf + data_sz - sizeof(uint8_t)));
- /* put IB rkey */
+
struct ibv_mr *mr =
MPID_nem_ib_com_reg_mr_fetch(write_from_buf, data_sz, 0, MPID_NEM_IB_COM_REG_MR_GLOBAL);
MPIU_ERR_CHKANDJUMP(!mr, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_reg_mr_fetch");
@@ -258,6 +265,7 @@ static int MPID_nem_ib_iSendContig_core(MPIDI_VC_t * vc, MPID_Request * sreq, vo
s_cookie_buf->rkey = mr->rkey;
s_cookie_buf->len = data_sz;
s_cookie_buf->sender_req_id = sreq->handle;
+ s_cookie_buf->max_msg_sz = max_msg_sz;
/* set for ib_com_isend */
prefix = (void *)&pkt_netmod;
@@ -796,14 +804,20 @@ static int MPID_nem_ib_SendNoncontig_core(MPIDI_VC_t * vc, MPID_Request * sreq,
void *write_from_buf = REQ_FIELD(sreq, lmt_pack_buf);
+ uint32_t max_msg_sz;
+ MPID_nem_ib_com_get_info_conn(vc_ib->sc->fd, MPID_NEM_IB_COM_INFOKEY_PATTR_MAX_MSG_SZ,
+ &max_msg_sz, sizeof(uint32_t));
+
+ /* RMA : Netmod IB supports only smaller size than max_msg_sz. */
+ MPIU_Assert(data_sz <= max_msg_sz);
+
MPID_nem_ib_rma_lmt_cookie_t *s_cookie_buf = (MPID_nem_ib_rma_lmt_cookie_t *) MPIU_Malloc(sizeof(MPID_nem_ib_rma_lmt_cookie_t));
sreq->ch.s_cookie = s_cookie_buf;
s_cookie_buf->tail = *((uint8_t *) ((uint8_t *) write_from_buf + last - sizeof(uint8_t)));
- /* put IB rkey */
- struct ibv_mr *mr =
- MPID_nem_ib_com_reg_mr_fetch(write_from_buf, last, 0, MPID_NEM_IB_COM_REG_MR_GLOBAL);
+
+ struct ibv_mr *mr = MPID_nem_ib_com_reg_mr_fetch(write_from_buf, last, 0, MPID_NEM_IB_COM_REG_MR_GLOBAL);
MPIU_ERR_CHKANDJUMP(!mr, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_reg_mr_fetch");
#ifdef HAVE_LIBDCFA
s_cookie_buf->addr = (void *) mr->host_addr;
@@ -813,6 +827,7 @@ static int MPID_nem_ib_SendNoncontig_core(MPIDI_VC_t * vc, MPID_Request * sreq,
s_cookie_buf->rkey = mr->rkey;
s_cookie_buf->len = last;
s_cookie_buf->sender_req_id = sreq->handle;
+ s_cookie_buf->max_msg_sz = max_msg_sz;
/* set for ib_com_isend */
prefix = (void *)&pkt_netmod;
@@ -1321,7 +1336,10 @@ int MPID_nem_ib_send_progress(MPIDI_VC_t * vc)
mpi_errno =
MPID_nem_ib_lmt_start_recv_core(sreq, REQ_FIELD(sreq, lmt_raddr),
REQ_FIELD(sreq, lmt_rkey), REQ_FIELD(sreq,
- lmt_write_to_buf));
+ lmt_szsend),
+ REQ_FIELD(sreq, lmt_write_to_buf),
+ REQ_FIELD(sreq, max_msg_sz), REQ_FIELD(sreq,
+ last));
if (mpi_errno) {
MPIU_ERR_POP(mpi_errno);
}
-----------------------------------------------------------------------
Summary of changes:
.../ch3/channels/nemesis/netmod/ib/errnames.txt | 1 +
src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c | 105 +++----------
src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h | 30 +++-
src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h | 63 +++++++-
src/mpid/ch3/channels/nemesis/netmod/ib/ib_init.c | 1 +
src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c | 132 +++++++++++++---
src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c | 167 ++++++++++++++++++--
.../ch3/channels/nemesis/netmod/ib/ib_reg_mr.c | 85 ++++++++---
src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c | 41 ++++-
9 files changed, 469 insertions(+), 156 deletions(-)
hooks/post-receive
--
MPICH primary repository
1
0