[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1rc2-30-gce893cc
mysql vizuser
noreply at mpich.org
Wed Dec 4 13:32:13 CST 2013
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 ce893cc0e57cc21fe36e83cb4b8e1c1d92aa9eb2 (commit)
via 2f73f9b688ac23c6840f316e51bd4c0313803c14 (commit)
via 7473a3b38d572f3f8ba25222a957e32c40526f91 (commit)
from 4a2209907bfa636ada5aa7ef62c0605b17f09c9c (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/ce893cc0e57cc21fe36e83cb4b8e1c1d92aa9eb2
commit ce893cc0e57cc21fe36e83cb4b8e1c1d92aa9eb2
Author: Su Huang <suhuang at us.ibm.com>
Date: Tue Dec 3 14:40:31 2013 -0500
PAMID: Support MPI_PROC_NULL in MPI_Win_lock and MPI_Win_unlock
MPI Standard states:
MPI_PROC_NULL is a valid target rank in all MPI RMA communication calls. The effect
is the same as for MPI_PROC_NULL in MPI point-to-point communication. After any RMA
operation with rank MPI_PROC_NULL, it is still necessary to finish the RMA epoch with the
synchronization method that started the epoch.
In the current design, both MPI_Win_lock and MPI_Win_unlock do not comply with the standard, e.g.
if MPI_PROC_NULL is passed in as the target_rank of MPI_Win_lock or MPI_Win_unlock, without the
fix, the job will be terminated with segfault.
(ibm) D194295
Signed-off-by: Michael Blocksome <blocksom at us.ibm.com>
diff --git a/src/mpid/pamid/src/onesided/mpid_win_lock.c b/src/mpid/pamid/src/onesided/mpid_win_lock.c
index 4afd456..92c6b47 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_lock.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_lock.c
@@ -174,6 +174,7 @@ MPID_Win_lock(int lock_type,
MPIU_ERR_SETANDSTMT(mpi_errno, MPI_ERR_RMA_SYNC,
return mpi_errno, "**rmasync");
}
+ if (rank == MPI_PROC_NULL) goto fn_exit;
struct MPIDI_Win_sync* sync = &win->mpid.sync;
MPIDI_WinLock_info info = {
@@ -185,7 +186,7 @@ MPID_Win_lock(int lock_type,
MPIDI_Context_post(MPIDI_Context[0], &info.work, MPIDI_WinLockReq_post, &info);
MPID_PROGRESS_WAIT_WHILE(!slock->remote.locked);
-
+fn_exit:
win->mpid.sync.origin_epoch_type = MPID_EPOTYPE_LOCK;
return mpi_errno;
@@ -203,7 +204,7 @@ MPID_Win_unlock(int rank,
MPIU_ERR_SETANDSTMT(mpi_errno, MPI_ERR_RMA_SYNC,
return mpi_errno, "**rmasync");
}
-
+ if (rank == MPI_PROC_NULL) goto fn_exit;
struct MPIDI_Win_sync* sync = &win->mpid.sync;
MPID_PROGRESS_WAIT_WHILE(win->mpid.origin[rank].nStarted != win->mpid.origin[rank].nCompleted);
win->mpid.origin[rank].nCompleted=0;
@@ -216,7 +217,7 @@ MPID_Win_unlock(int rank,
};
MPIDI_Context_post(MPIDI_Context[0], &info.work, MPIDI_WinUnlock_post, &info);
MPID_PROGRESS_WAIT_WHILE(sync->lock.remote.locked);
-
+fn_exit:
if(win->mpid.sync.target_epoch_type == MPID_EPOTYPE_REFENCE)
{
win->mpid.sync.origin_epoch_type = MPID_EPOTYPE_REFENCE;
http://git.mpich.org/mpich.git/commitdiff/2f73f9b688ac23c6840f316e51bd4c0313803c14
commit 2f73f9b688ac23c6840f316e51bd4c0313803c14
Author: Michael Blocksome <blocksom at us.ibm.com>
Date: Fri Nov 22 09:57:06 2013 -0600
PAMId: added some mpi 3.0 RMA function support
The following functions are added:
- MPI_Win_allocate
- MPI_Win_allocate_dynamic
- MPI_Win_attach
- MPI_Win_deatch
- MPI_Win_lock_all
- MPI_Win_unlock_all
- MPI_Win_sync
- MPI_Win_flush
(ibm) F189033
Signed-off-by: Michael Blocksome <blocksom at us.ibm.com>
diff --git a/src/mpid/pamid/include/mpidi_constants.h b/src/mpid/pamid/include/mpidi_constants.h
index 42d4bd8..649af8f 100644
--- a/src/mpid/pamid/include/mpidi_constants.h
+++ b/src/mpid/pamid/include/mpidi_constants.h
@@ -93,6 +93,7 @@ MPID_EPOTYPE_START = 2, /**< MPI_Win_start access epoch */
MPID_EPOTYPE_POST = 3, /**< MPI_Win_post exposure epoch */
MPID_EPOTYPE_FENCE = 4, /**< MPI_Win_fence access/exposure epoch */
MPID_EPOTYPE_REFENCE = 5, /**< MPI_Win_fence possible access/exposure epoch */
+MPID_EPOTYPE_LOCK_ALL = 6, /**< MPI_Win_lock_all access epoch */
};
enum
diff --git a/src/mpid/pamid/src/misc/mpid_unimpl.c b/src/mpid/pamid/src/misc/mpid_unimpl.c
index d390ea3..cef7096 100644
--- a/src/mpid/pamid/src/misc/mpid_unimpl.c
+++ b/src/mpid/pamid/src/misc/mpid_unimpl.c
@@ -91,11 +91,6 @@ int MPID_Comm_group_failed(MPID_Comm *comm_ptr, MPID_Group **failed_group_ptr)
return 0;
}
-int MPID_Win_attach(MPID_Win *win, void *base, MPI_Aint size)
-{
- MPID_abort();
- return 0;
-}
int MPID_Win_allocate_shared(MPI_Aint size, int disp_unit, MPID_Info *info_ptr, MPID_Comm *comm_ptr,
void **base_ptr, MPID_Win **win_ptr)
@@ -113,17 +108,6 @@ int MPID_Rput(const void *origin_addr, int origin_count,
return 0;
}
-int MPID_Win_flush_local(int rank, MPID_Win *win)
-{
- MPID_abort();
- return 0;
-}
-
-int MPID_Win_detach(MPID_Win *win, const void *base)
-{
- MPID_abort();
- return 0;
-}
int MPID_Compare_and_swap(const void *origin_addr, const void *compare_addr,
void *result_addr, MPI_Datatype datatype, int target_rank,
@@ -167,36 +151,6 @@ int MPID_Win_shared_query(MPID_Win *win, int rank, MPI_Aint *size, int *disp_uni
return 0;
}
-int MPID_Win_allocate(MPI_Aint size, int disp_unit, MPID_Info *info,
- MPID_Comm *comm, void *baseptr, MPID_Win **win)
-{
- MPID_abort();
- return 0;
-}
-
-int MPID_Win_flush(int rank, MPID_Win *win)
-{
- MPID_abort();
- return 0;
-}
-
-int MPID_Win_flush_local_all(MPID_Win *win)
-{
- MPID_abort();
- return 0;
-}
-
-int MPID_Win_unlock_all(MPID_Win *win)
-{
- MPID_abort();
- return 0;
-}
-
-int MPID_Win_create_dynamic(MPID_Info *info, MPID_Comm *comm, MPID_Win **win)
-{
- MPID_abort();
- return 0;
-}
int MPID_Rget(void *origin_addr, int origin_count,
MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp,
@@ -207,18 +161,6 @@ int MPID_Rget(void *origin_addr, int origin_count,
return 0;
}
-int MPID_Win_sync(MPID_Win *win)
-{
- MPID_abort();
- return 0;
-}
-
-int MPID_Win_flush_all(MPID_Win *win)
-{
- MPID_abort();
- return 0;
-}
-
int MPID_Get_accumulate(const void *origin_addr, int origin_count,
MPI_Datatype origin_datatype, void *result_addr, int result_count,
MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp,
@@ -228,8 +170,3 @@ int MPID_Get_accumulate(const void *origin_addr, int origin_count,
return 0;
}
-int MPID_Win_lock_all(int assert, MPID_Win *win)
-{
- MPID_abort();
- return 0;
-}
diff --git a/src/mpid/pamid/src/onesided/Makefile.mk b/src/mpid/pamid/src/onesided/Makefile.mk
index 00fc82c..843f06d 100644
--- a/src/mpid/pamid/src/onesided/Makefile.mk
+++ b/src/mpid/pamid/src/onesided/Makefile.mk
@@ -33,11 +33,18 @@ lib_lib at MPILIBNAME@_la_SOURCES += \
src/mpid/pamid/src/onesided/mpid_win_free.c \
src/mpid/pamid/src/onesided/mpid_win_get.c \
src/mpid/pamid/src/onesided/mpid_win_lock.c \
+ src/mpid/pamid/src/onesided/mpid_win_lock_all.c \
src/mpid/pamid/src/onesided/mpid_win_pscw.c \
src/mpid/pamid/src/onesided/mpid_win_put.c \
- src/mpid/pamid/src/onesided/mpidi_win_control.c \
+ src/mpid/pamid/src/onesided/mpid_win_allocate.c \
+ src/mpid/pamid/src/onesided/mpid_win_create_dynamic.c \
+ src/mpid/pamid/src/onesided/mpid_win_flush.c \
+ src/mpid/pamid/src/onesided/mpid_win_attach.c \
+ src/mpid/pamid/src/onesided/mpid_win_detach.c \
+ src/mpid/pamid/src/onesided/mpid_win_sync.c \
src/mpid/pamid/src/onesided/mpid_win_get_info.c \
- src/mpid/pamid/src/onesided/mpid_win_set_info.c
+ src/mpid/pamid/src/onesided/mpid_win_set_info.c \
+ src/mpid/pamid/src/onesided/mpidi_win_control.c
endif BUILD_PAMID
diff --git a/src/mpid/pamid/src/onesided/mpid_1s.c b/src/mpid/pamid/src/onesided/mpid_1s.c
index 2b00c12..ca9f8dc 100644
--- a/src/mpid/pamid/src/onesided/mpid_1s.c
+++ b/src/mpid/pamid/src/onesided/mpid_1s.c
@@ -45,6 +45,7 @@ MPIDI_Win_DoneCB(pami_context_t context,
req->origin.count,
req->origin.datatype);
MPID_assert(mpi_errno == MPI_SUCCESS);
+ MPIDI_Win_datatype_unmap(&req->target.dt);
MPID_Datatype_release(req->origin.dt.pointer);
MPIU_Free(req->buffer);
MPIU_Free(req->user_buffer);
@@ -52,7 +53,6 @@ MPIDI_Win_DoneCB(pami_context_t context,
}
}
- //if (req->win->mpid.sync.total == req->win->mpid.sync.complete)
if (req->origin.completed == req->target.dt.num_contig)
{
req->win->mpid.origin[target_rank].nCompleted++;
diff --git a/src/mpid/pamid/src/onesided/mpid_win_accumulate.c b/src/mpid/pamid/src/onesided/mpid_win_accumulate.c
index 287c7eb..c2878d8 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_accumulate.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_accumulate.c
@@ -37,6 +37,9 @@ MPIDI_WinAccumCB(pami_context_t context,
MPID_assert(msginfo_size == sizeof(MPIDI_Win_MsgInfo));
MPID_assert(_msginfo != NULL);
const MPIDI_Win_MsgInfo * msginfo = (const MPIDI_Win_MsgInfo*)_msginfo;
+ const MPIDI_Win_request * req = (const MPIDI_Win_request*)(msginfo->req);
+ char *tmpbuf;
+ int mpi_errno, rc;
int null=0;
pami_type_t pami_type;
@@ -51,6 +54,8 @@ MPIDI_WinAccumCB(pami_context_t context,
TRACE_ERR(" PAMI: type=%p op=%p\n", pami_type, pami_op);
#endif
+ MPID_assert(recv != NULL);
+ *recv = zero_recv_parms;
recv->cookie = NULL;
recv->local_fn = NULL;
recv->addr = msginfo->addr;
@@ -68,20 +73,14 @@ MPIDI_Accumulate(pami_context_t context,
MPIDI_Win_request *req = (MPIDI_Win_request*)_req;
pami_result_t rc;
void *map;
+ pami_send_t params;
- pami_send_t params = {
- .send = {
- .header = {
- .iov_len = sizeof(MPIDI_Win_MsgInfo),
- },
- .dispatch = MPIDI_Protocols_WinAccum,
- .dest = req->dest,
- },
- .events = {
- .cookie = req,
- .remote_fn = MPIDI_Win_DoneCB,
- },
- };
+ params = zero_send_parms;
+ params.send.header.iov_len = sizeof(MPIDI_Win_MsgInfo);
+ params.send.dispatch = MPIDI_Protocols_WinAccum;
+ params.send.dest = req->dest;
+ params.events.cookie = req;
+ params.events.remote_fn = MPIDI_Win_DoneCB;
struct MPIDI_Win_sync* sync = &req->win->mpid.sync;
TRACE_ERR("Start index=%u/%d l-addr=%p r-base=%p r-offset=%zu (sync->started=%u sync->complete=%u)\n",
@@ -107,12 +106,10 @@ MPIDI_Accumulate(pami_context_t context,
TRACE_ERR(" Sub index=%u bytes=%zu l-offset=%zu r-addr=%p l-buf=%p *(int*)buf=0x%08x *(double*)buf=%g\n",
req->state.index, params.send.data.iov_len, req->state.local_offset, req->accum_headers[req->state.index].addr, buf, *ibuf, *dbuf);
#endif
-
/** sync->total will be updated with every RMA and the complete
will not change till that RMA has completed. In the meanwhile
the rest of the RMAs will have memory leaks */
if (req->target.dt.num_contig - req->state.index == 1) {
- //if (sync->total - sync->complete == 1) {
map=NULL;
if (req->target.dt.map != &req->target.dt.__map) {
map=(void *) req->target.dt.map;
@@ -174,6 +171,7 @@ MPID_Accumulate(void *origin_addr,
{
int mpi_errno = MPI_SUCCESS;
MPIDI_Win_request *req = MPIU_Calloc0(1, MPIDI_Win_request);
+ *req = zero_req;
req->win = win;
req->type = MPIDI_WIN_REQUEST_ACCUMULATE;
@@ -190,6 +188,7 @@ MPID_Accumulate(void *origin_addr,
}
req->offset = target_disp * win->mpid.info[target_rank].disp_unit;
+ win->mpid.origin[target_rank].nStarted++;
if (origin_datatype == MPI_DOUBLE_INT)
{
@@ -242,6 +241,7 @@ MPID_Accumulate(void *origin_addr,
if ( (req->origin.dt.size == 0) ||
(target_rank == MPI_PROC_NULL))
{
+ win->mpid.origin[target_rank].nCompleted++;
MPIU_Free(req);
return MPI_SUCCESS;
}
@@ -259,7 +259,7 @@ MPID_Accumulate(void *origin_addr,
req->buffer_free = 1;
req->buffer = MPIU_Malloc(req->origin.dt.size);
MPID_assert(req->buffer != NULL);
-
+ MPID_Datatype_add_ref(req->origin.dt.pointer);
int mpi_errno = 0;
mpi_errno = MPIR_Localcopy(origin_addr,
origin_count,
diff --git a/src/mpid/pamid/src/onesided/mpid_win_allocate.c b/src/mpid/pamid/src/onesided/mpid_win_allocate.c
new file mode 100644
index 0000000..227d75d
--- /dev/null
+++ b/src/mpid/pamid/src/onesided/mpid_win_allocate.c
@@ -0,0 +1,98 @@
+/* begin_generated_IBM_copyright_prolog */
+/* */
+/* This is an automatically generated copyright prolog. */
+/* After initializing, DO NOT MODIFY OR MOVE */
+/* --------------------------------------------------------------- */
+/* Licensed Materials - Property of IBM */
+/* Blue Gene/Q 5765-PER 5765-PRP */
+/* */
+/* (C) Copyright IBM Corp. 2011, 2012 All Rights Reserved */
+/* US Government Users Restricted Rights - */
+/* Use, duplication, or disclosure restricted */
+/* by GSA ADP Schedule Contract with IBM Corp. */
+/* */
+/* --------------------------------------------------------------- */
+/* */
+/* end_generated_IBM_copyright_prolog */
+/* (C)Copyright IBM Corp. 2007, 2011 */
+/**
+ * \file src/onesided/mpid_win_create.c
+ * \brief ???
+ */
+#include "mpidi_onesided.h"
+
+/**
+ * \brief MPI-PAMI glue for MPI_Win_allocate function
+ *
+ * Create a window object. Allocates a MPID_Win object and initializes it,
+ * then allocates the collective info array, initalizes our entry, and
+ * performs an Allgather to distribute/collect the rest of the array entries.
+ * On each process, it allocates memory of at least size bytes, returns a
+ * pointer to it, and returns a window object that can be used by all processes
+ * in comm to * perform RMA operations. The returned memory consists of size
+ * bytes local to each process, starting at address base_ptr and is associated
+ * with the window as if the user called 'MPI_Win_create' on existing memory.
+ * The size argument may be different at each process and size = 0 is valid;
+ * however, a library might allocate and expose more memory in order to create
+ * a fast, globally symmetric allocation.
+ * Input Parameters:
+ * \param[in] size size of window in bytes (nonnegative integer)
+ * \param[in] disp_unit local unit size for displacements, in bytes (positive integer)
+ * \param[in] info info argument (handle))
+ * \param[in] comm_ptr Communicator (handle)
+ * \param[out] base_ptr - base address of the window in local memory
+ * \param[out] win_ptr window object returned by the call (handle)
+ * \return MPI_SUCCESS, MPI_ERR_ARG, MPI_ERR_COMM, MPI_ERR_INFO. MPI_ERR_OTHER,
+ * MPI_ERR_SIZE
+ */
+int
+MPID_Win_allocate(MPI_Aint size,
+ int disp_unit,
+ MPID_Info * info,
+ MPID_Comm * comm_ptr,
+ void *base_ptr,
+ MPID_Win ** win_ptr)
+{
+ int mpi_errno = MPI_SUCCESS;
+ int rc = MPI_SUCCESS;
+ void *baseP;
+ static char FCNAME[] = "MPID_Win_allocate";
+ MPIDI_Win_info *winfo;
+ MPID_Win *win;
+ int rank;
+
+ rc=MPIDI_Win_init(size,disp_unit,win_ptr, info, comm_ptr, MPI_WIN_FLAVOR_ALLOCATE, MPI_WIN_SEPARATE);
+ win = *win_ptr;
+
+ if (size > 0) {
+ baseP = MPIU_Malloc(size);
+ #ifndef MPIDI_NO_ASSERT
+ MPID_assert(baseP != NULL);
+ #else
+ MPIU_ERR_CHKANDJUMP((baseP == NULL), mpi_errno, MPI_ERR_BUFFER, "**bufnull");
+ #endif
+
+ } else if (size == 0) {
+ baseP = NULL;
+ } else {
+ MPIU_ERR_CHKANDSTMT(size >=0 , mpi_errno, MPI_ERR_SIZE,
+ return mpi_errno, "**rmasize");
+ }
+
+ win->base = baseP;
+ rank = comm_ptr->rank;
+ winfo = &win->mpid.info[rank];
+ winfo->base_addr = baseP;
+ winfo->win = win;
+ winfo->disp_unit = disp_unit;
+
+ rc= MPIDI_Win_allgather(baseP,size,win_ptr);
+ if (rc != MPI_SUCCESS)
+ return rc;
+ *(void**) base_ptr = (void *) win->base;
+ mpi_errno = MPIR_Barrier_impl(comm_ptr, &mpi_errno);
+
+ fn_fail:
+ return mpi_errno;
+}
+
diff --git a/src/mpid/pamid/src/onesided/mpid_win_attach.c b/src/mpid/pamid/src/onesided/mpid_win_attach.c
new file mode 100644
index 0000000..233c12b
--- /dev/null
+++ b/src/mpid/pamid/src/onesided/mpid_win_attach.c
@@ -0,0 +1,58 @@
+/* begin_generated_IBM_copyright_prolog */
+/* */
+/* This is an automatically generated copyright prolog. */
+/* After initializing, DO NOT MODIFY OR MOVE */
+/* --------------------------------------------------------------- */
+/* Licensed Materials - Property of IBM */
+/* Blue Gene/Q 5765-PER 5765-PRP */
+/* */
+/* (C) Copyright IBM Corp. 2011, 2012 All Rights Reserved */
+/* US Government Users Restricted Rights - */
+/* Use, duplication, or disclosure restricted */
+/* by GSA ADP Schedule Contract with IBM Corp. */
+/* */
+/* --------------------------------------------------------------- */
+/* */
+/* end_generated_IBM_copyright_prolog */
+/* (C)Copyright IBM Corp. 2007, 2011 */
+/**
+ * \file src/onesided/mpid_win_attach.c
+ * \brief attaches a local memory region beginning at base for remote
+ * access within the given window.
+ */
+#include "mpidi_onesided.h"
+
+/**
+ * \brief MPI-PAMI glue for MPI_Win_attach function
+ *
+ * Attaches a local memory region beginning at base for remote access
+ * within the given window.
+ *
+ * \param[in] win shared memory window object
+ * \param[in] base initial address of memory to be attached
+ * \param[in] length length of memory to be attached in bytes
+ * \return MPI_SUCCESS, MPI_ERR_RMA_FLAVOR
+ *
+ */
+
+int
+MPID_Win_attach(MPID_Win *win, void *base, MPI_Aint size)
+{
+ int mpi_errno = MPI_SUCCESS;
+ static char FCNAME[] = "MPID_Win_attach";
+ MPIU_ERR_CHKANDSTMT((win->create_flavor != MPI_WIN_FLAVOR_DYNAMIC), mpi_errno,
+ MPI_ERR_RMA_FLAVOR, return mpi_errno, "**rmaflavor");
+
+
+ /* no op, all memory is exposed, the user is responsible for */
+ /* ensuring that MPI_WIN_ATTACH at the target has returned */
+ /* before a process attempts to target that memory with an */
+ /* RMA call */
+
+
+fn_exit:
+ return mpi_errno;
+fn_fail:
+ goto fn_exit;
+}
+
diff --git a/src/mpid/pamid/src/onesided/mpid_win_create_dynamic.c b/src/mpid/pamid/src/onesided/mpid_win_create_dynamic.c
new file mode 100644
index 0000000..1f30513
--- /dev/null
+++ b/src/mpid/pamid/src/onesided/mpid_win_create_dynamic.c
@@ -0,0 +1,67 @@
+/* begin_generated_IBM_copyright_prolog */
+/* */
+/* This is an automatically generated copyright prolog. */
+/* After initializing, DO NOT MODIFY OR MOVE */
+/* --------------------------------------------------------------- */
+/* Licensed Materials - Property of IBM */
+/* Blue Gene/Q 5765-PER 5765-PRP */
+/* */
+/* (C) Copyright IBM Corp. 2011, 2012 All Rights Reserved */
+/* US Government Users Restricted Rights - */
+/* Use, duplication, or disclosure restricted */
+/* by GSA ADP Schedule Contract with IBM Corp. */
+/* */
+/* --------------------------------------------------------------- */
+/* */
+/* end_generated_IBM_copyright_prolog */
+/* (C)Copyright IBM Corp. 2007, 2011 */
+/**
+ * \file src/onesided/mpid_win_create.c
+ * \brief ???
+ */
+#include "mpidi_onesided.h"
+
+/**
+ * \brief MPI-PAMI glue for MPI_Win_create_dynamic function
+ *
+ * Create a window object. Allocates a MPID_Win object and initializes it,
+ * then allocates the collective info array, initalizes our entry, and
+ * performs an Allgather to distribute/collect the rest of the array entries.
+ * The function returns a window win without memory attached.
+ *
+ * Input Parameters:
+ * \param[in] info info argument
+ * \param[in] comm intra-Communicator (handle)
+ * \param[out] win_ptr window object returned by the call (handle)
+ * \return MPI_SUCCESS, MPI_ERR_ARG, MPI_ERR_COMM, MPI_ERR_INFO. MPI_ERR_OTHER,
+ * MPI_ERR_SIZE
+ */
+
+int
+MPID_Win_create_dynamic( MPID_Info * info,
+ MPID_Comm * comm_ptr,
+ MPID_Win ** win_ptr)
+{
+ int mpi_errno = MPI_SUCCESS;
+ int rc = MPI_SUCCESS;
+ static char FCNAME[] = "MPID_Win_allocate_dynamic";
+ MPIDI_Win_info *winfo;
+ MPID_Win *win;
+ int rank,i;
+
+ rc=MPIDI_Win_init(0,1,win_ptr, info, comm_ptr, MPI_WIN_FLAVOR_DYNAMIC, MPI_WIN_SEPARATE);
+ win = *win_ptr;
+
+ win->base = MPI_BOTTOM;
+ rank = comm_ptr->rank;
+ winfo = &win->mpid.info[rank];
+ winfo->win = win;
+
+ rc= MPIDI_Win_allgather(MPI_BOTTOM,0,win_ptr);
+ if (rc != MPI_SUCCESS)
+ return rc;
+
+ mpi_errno = MPIR_Barrier_impl(comm_ptr, &mpi_errno);
+
+ return mpi_errno;
+}
diff --git a/src/mpid/pamid/src/onesided/mpid_win_detach.c b/src/mpid/pamid/src/onesided/mpid_win_detach.c
new file mode 100644
index 0000000..c4fc618
--- /dev/null
+++ b/src/mpid/pamid/src/onesided/mpid_win_detach.c
@@ -0,0 +1,53 @@
+/* begin_generated_IBM_copyright_prolog */
+/* */
+/* This is an automatically generated copyright prolog. */
+/* After initializing, DO NOT MODIFY OR MOVE */
+/* --------------------------------------------------------------- */
+/* Licensed Materials - Property of IBM */
+/* Blue Gene/Q 5765-PER 5765-PRP */
+/* */
+/* (C) Copyright IBM Corp. 2011, 2012 All Rights Reserved */
+/* US Government Users Restricted Rights - */
+/* Use, duplication, or disclosure restricted */
+/* by GSA ADP Schedule Contract with IBM Corp. */
+/* */
+/* --------------------------------------------------------------- */
+/* */
+/* end_generated_IBM_copyright_prolog */
+/* (C)Copyright IBM Corp. 2007, 2011 */
+/**
+ * \file src/onesided/mpid_win_detach.c
+ * \brief detaches a previously attached memory region beginning at
+ * base
+ */
+#include "mpidi_onesided.h"
+
+/**
+ * \brief MPI-PAMI glue for MPI_Win_detach function
+ *
+ * Detaches a previously attached memory beginning at base.
+ * The arguments base and win must match the arguments passed
+ * to a previous call to MPI_Win_attach.
+ * \param[in] win window object
+ * \param[in] base initial address of emmory to be detached
+ * \return MPI_SUCCESS, MPI_ERR_RMA_FLAVOR
+ *
+ */
+
+int
+MPID_Win_detach(MPID_Win *win, const void *base)
+{
+ int mpi_errno = MPI_SUCCESS;
+ static char FCNAME[] = "MPID_Win_detach";
+ MPIU_ERR_CHKANDSTMT((win->create_flavor != MPI_WIN_FLAVOR_DYNAMIC), mpi_errno,
+ MPI_ERR_RMA_FLAVOR, return mpi_errno, "**rmaflavor");
+
+
+ /* no op, all memory is exposed */
+
+fn_exit:
+ return mpi_errno;
+fn_fail:
+ goto fn_exit;
+}
+
diff --git a/src/mpid/pamid/src/onesided/mpid_win_flush.c b/src/mpid/pamid/src/onesided/mpid_win_flush.c
new file mode 100644
index 0000000..4fb3dde
--- /dev/null
+++ b/src/mpid/pamid/src/onesided/mpid_win_flush.c
@@ -0,0 +1,182 @@
+/* begin_generated_IBM_copyright_prolog */
+/* */
+/* This is an automatically generated copyright prolog. */
+/* After initializing, DO NOT MODIFY OR MOVE */
+/* --------------------------------------------------------------- */
+/* Licensed Materials - Property of IBM */
+/* Blue Gene/Q 5765-PER 5765-PRP */
+/* */
+/* (C) Copyright IBM Corp. 2011, 2012 All Rights Reserved */
+/* US Government Users Restricted Rights - */
+/* Use, duplication, or disclosure restricted */
+/* by GSA ADP Schedule Contract with IBM Corp. */
+/* */
+/* --------------------------------------------------------------- */
+/* */
+/* end_generated_IBM_copyright_prolog */
+/* (C)Copyright IBM Corp. 2007, 2011 */
+/**
+ * \file src/onesided/mpid_win_flush.c
+ * \brief returns a new info object containing the hints of the window
+ * associated with win.
+ */
+#include "mpidi_onesided.h"
+
+/**
+ * \brief MPI-PAMI glue for MPI_Win_flush function
+ *
+ * The funcion can be called only within passive target epochs such as
+ * MPI_Win_lock, MPI_Win_unlock, MPI_Win_lock_all and MPI_Win_unlock_all.
+ *
+ * The function completes all outstanding RMA operations initialized by
+ * the calling process to a specified target rank on the given window.
+ * The operations are completed both at the origin and the target.
+ *
+ * \param[in] rank rank of target window
+ * \param[in] win window object
+ * \return MPI_SUCCESS, MPI_ERR_OTHER
+ */
+
+
+int
+MPID_Win_flush(int rank,
+ MPID_Win *win)
+{
+ int mpi_errno = MPI_SUCCESS;
+ struct MPIDI_Win_sync* sync;
+ static char FCNAME[] = "MPID_Win_flush";
+
+ if((win->mpid.sync.origin_epoch_type != MPID_EPOTYPE_LOCK) &&
+ (win->mpid.sync.origin_epoch_type != MPID_EPOTYPE_LOCK_ALL))
+ {
+ MPIU_ERR_SETANDSTMT(mpi_errno, MPI_ERR_RMA_SYNC,
+ return mpi_errno, "**rmasync");
+ }
+ MPID_PROGRESS_WAIT_WHILE(win->mpid.origin[rank].nStarted != win->mpid.origin[rank].nCompleted);
+
+ sync = &win->mpid.sync;
+ win->mpid.origin[rank].nStarted=0;
+ win->mpid.origin[rank].nCompleted=0;
+
+
+ return mpi_errno;
+}
+/**
+ * \brief MPI-PAMI glue for MPI_Win_flush_all function
+ *
+ * The funcion can be called only within passive target epochs such as
+ * MPI_Win_lock, MPI_Win_unlock, MPI_Win_lock_all and MPI_Win_unlock_all.
+ *
+ * All RMA opertions issued by the calling process to any target on the
+ * given window prior to this call and in the given window will have
+ * completed both at the origin and the target when the call returns.
+ *
+ * \param[in] win window object
+ * \return MPI_SUCCESS, MPI_ERR_OTHER
+ */
+
+
+int
+MPID_Win_flush_all(MPID_Win *win)
+{
+ int mpi_errno = MPI_SUCCESS;
+ int nTasks,i;
+ struct MPIDI_Win_sync* sync;
+ static char FCNAME[] = "MPID_Win_flush_all";
+
+ if((win->mpid.sync.origin_epoch_type != MPID_EPOTYPE_LOCK) &&
+ (win->mpid.sync.origin_epoch_type != MPID_EPOTYPE_LOCK_ALL))
+ {
+ MPIU_ERR_SETANDSTMT(mpi_errno, MPI_ERR_RMA_SYNC,
+ return mpi_errno, "**rmasync");
+ }
+
+ sync = &win->mpid.sync;
+ MPID_PROGRESS_WAIT_WHILE(sync->total != sync->complete);
+ sync->total = 0;
+ sync->started = 0;
+ sync->complete = 0;
+ for (i = 0; i < MPIR_Comm_size(win->comm_ptr); i++) {
+ win->mpid.origin[i].nStarted=0;
+ win->mpid.origin[i].nCompleted=0;
+ }
+ return mpi_errno;
+
+}
+
+/**
+ * \brief MPI-PAMI glue for MPI_Win_flush_local function
+ *
+ * The funcion can be called only within passive target epochs such as
+ * MPI_Win_lock, MPI_Win_unlock, MPI_Win_lock_all and MPI_Win_unlock_all.
+ *
+ * Locally completes at the origin all outstanding RMA operations initiated
+ * the cng process to the target rank on the given window. The user may
+ * reuse any buffers after this routine returns.
+ *
+ * \param[in] rank rank of target window
+ * \param[in] win window object
+ * \return MPI_SUCCESS, MPI_ERR_OTHER
+ */
+
+int
+MPID_Win_flush_local(int rank, MPID_Win *win)
+{
+ int mpi_errno = MPI_SUCCESS;
+ static char FCNAME[] = "MPID_Win_flush_local";
+
+ if((win->mpid.sync.origin_epoch_type != MPID_EPOTYPE_LOCK) &&
+ (win->mpid.sync.origin_epoch_type != MPID_EPOTYPE_LOCK_ALL))
+ {
+ MPIU_ERR_SETANDSTMT(mpi_errno, MPI_ERR_RMA_SYNC,
+ return mpi_errno, "**rmasync");
+ }
+ MPID_PROGRESS_WAIT_WHILE(win->mpid.origin[rank].nStarted != win->mpid.origin[rank].nCompleted);
+ win->mpid.origin[rank].nStarted=0;
+ win->mpid.origin[rank].nCompleted=0;
+
+ return mpi_errno;
+}
+
+/**
+ * \brief MPI-PAMI glue for MPI_Win_flush_local_all function
+ *
+ * The funcion can be called only within passive target epochs such as
+ * MPI_Win_lock, MPI_Win_unlock, MPI_Win_lock_all and MPI_Win_unlock_all.
+ *
+ * All RMA operations issued to any target prior to this call in this window
+ * will have copleted at the origin when this function returns.
+ *
+ * \param[in] win window object
+ * \return MPI_SUCCESS, MPI_ERR_OTHER
+ */
+
+int
+MPID_Win_flush_local_all(MPID_Win *win)
+{
+ int mpi_errno = MPI_SUCCESS;
+ static char FCNAME[] = "MPID_Win_flush";
+ int size,i;
+
+ if((win->mpid.sync.origin_epoch_type != MPID_EPOTYPE_LOCK) &&
+ (win->mpid.sync.origin_epoch_type != MPID_EPOTYPE_LOCK_ALL))
+ {
+ MPIU_ERR_SETANDSTMT(mpi_errno, MPI_ERR_RMA_SYNC,
+ return mpi_errno, "**rmasync");
+ }
+ size = MPIR_Comm_size(win->comm_ptr);
+ for (i=0; i < size; i++) {
+ MPID_PROGRESS_WAIT_WHILE(win->mpid.origin[i].nStarted != win->mpid.origin[i].nCompleted);
+ }
+ for (i=0; i < size; i++) {
+ win->mpid.origin[i].nStarted=0;
+ win->mpid.origin[i].nCompleted=0;
+ }
+
+ return mpi_errno;
+}
+
+
+
+
+
diff --git a/src/mpid/pamid/src/onesided/mpid_win_get.c b/src/mpid/pamid/src/onesided/mpid_win_get.c
index 7d3c4e5..ce40242 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_get.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_get.c
@@ -53,9 +53,6 @@ MPIDI_Get(pami_context_t context,
if(rc == PAMI_EAGAIN)
return rc;
- if (!freed)
- MPIDI_Win_datatype_unmap(&req->target.dt);
-
return PAMI_SUCCESS;
}
@@ -104,7 +101,6 @@ MPIDI_Get_use_pami_rget(pami_context_t context, MPIDI_Win_request * req, int *fr
will not change till that RMA has completed. In the meanwhile
the rest of the RMAs will have memory leaks */
if (req->target.dt.num_contig - req->state.index == 1) {
- //if (sync->total - sync->complete == 1) {
map=NULL;
if (req->target.dt.map != &req->target.dt.__map) {
map=(void *) req->target.dt.map;
@@ -174,16 +170,8 @@ MPIDI_Get_use_pami_get(pami_context_t context, MPIDI_Win_request * req, int *fre
will not change till that RMA has completed. In the meanwhile
the rest of the RMAs will have memory leaks */
if (req->target.dt.num_contig - req->state.index == 1) {
- //if (sync->total - sync->complete == 1) {
- map=NULL;
- if (req->target.dt.map != &req->target.dt.__map) {
- map=(void *) req->target.dt.map;
- }
rc = PAMI_Get(context, ¶ms);
MPID_assert(rc == PAMI_SUCCESS);
- if (map)
- MPIU_Free(map);
- *freed=1;
return PAMI_SUCCESS;
} else {
rc = PAMI_Get(context, ¶ms);
@@ -226,6 +214,7 @@ MPID_Get(void *origin_addr,
{
int mpi_errno = MPI_SUCCESS;
MPIDI_Win_request *req = MPIU_Calloc0(1, MPIDI_Win_request);
+ *req = zero_req;
req->win = win;
req->type = MPIDI_WIN_REQUEST_GET;
@@ -242,6 +231,7 @@ MPID_Get(void *origin_addr,
}
req->offset = target_disp * win->mpid.info[target_rank].disp_unit;
+ win->mpid.origin[target_rank].nStarted++;
MPIDI_Win_datatype_basic(origin_count,
origin_datatype,
@@ -252,11 +242,7 @@ MPID_Get(void *origin_addr,
#ifndef MPIDI_NO_ASSERT
MPID_assert(req->origin.dt.size == req->target.dt.size);
#else
- /* temp fix, should be fixed as part of error injection for one sided comm.*/
- /* by 10/12 */
- if (req->origin.dt.size != req->target.dt.size) {
- exit(1);
- }
+ MPIU_ERR_CHKANDJUMP((req->origin.dt.size != req->target.dt.size), mpi_errno, MPI_ERR_SIZE, "**rmasize");
#endif
if ( (req->origin.dt.size == 0) ||
@@ -270,6 +256,7 @@ MPID_Get(void *origin_addr,
if (target_rank == win->comm_ptr->rank)
{
size_t offset = req->offset;
+ req->win->mpid.origin[target_rank].nCompleted++;
MPIU_Free(req);
return MPIR_Localcopy(win->base + offset,
target_count,
diff --git a/src/mpid/pamid/src/onesided/mpid_win_lock.c b/src/mpid/pamid/src/onesided/mpid_win_lock.c
index c5be921..4afd456 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_lock.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_lock.c
@@ -51,8 +51,12 @@ MPIDI_WinLockAdvance(pami_context_t context,
++slock->local.count;
slock->local.type = lock->type;
-
- MPIDI_WinLockAck_post(context, lock->rank, win);
+ if (lock->mtype == MPIDI_REQUEST_LOCK)
+ MPIDI_WinLockAck_post(context, lock->rank, win);
+ else if (lock->mtype == MPIDI_REQUEST_LOCKALL)
+ MPIDI_WinLockAllAck_post(context, lock->rank, win);
+ else
+ MPID_assert_always(0);
MPIU_Free(lock);
MPIDI_WinLockAdvance(context, win);
}
@@ -85,7 +89,11 @@ MPIDI_WinLockReq_proc(pami_context_t context,
{
MPID_Win * win = info->win;
struct MPIDI_Win_lock* lock = MPIU_Calloc0(1, struct MPIDI_Win_lock);
- lock->rank = peer;
+ if (info->type == MPIDI_WIN_MSGTYPE_LOCKREQ)
+ lock->mtype = MPIDI_REQUEST_LOCK;
+ else if (info->type == MPIDI_WIN_MSGTYPE_LOCKALLREQ)
+ lock->mtype = MPIDI_REQUEST_LOCKALL;
+ lock->rank = info->rank;
lock->type = info->data.lock.type;
struct MPIDI_Win_queue* q = &win->mpid.sync.lock.local.requested;
@@ -117,7 +125,11 @@ MPIDI_WinLockAck_proc(pami_context_t context,
const MPIDI_Win_control_t * info,
unsigned peer)
{
- info->win->mpid.sync.lock.remote.locked = 1;
+ if (info->type == MPIDI_WIN_MSGTYPE_LOCKACK)
+ info->win->mpid.sync.lock.remote.locked = 1;
+ else if (info->type == MPIDI_WIN_MSGTYPE_LOCKALLACK)
+ info->win->mpid.sync.lock.remote.allLocked += 1;
+
}
@@ -162,6 +174,7 @@ MPID_Win_lock(int lock_type,
MPIU_ERR_SETANDSTMT(mpi_errno, MPI_ERR_RMA_SYNC,
return mpi_errno, "**rmasync");
}
+ struct MPIDI_Win_sync* sync = &win->mpid.sync;
MPIDI_WinLock_info info = {
.done = 0,
@@ -192,10 +205,9 @@ MPID_Win_unlock(int rank,
}
struct MPIDI_Win_sync* sync = &win->mpid.sync;
- MPID_PROGRESS_WAIT_WHILE(sync->total != sync->complete);
- sync->total = 0;
- sync->started = 0;
- sync->complete = 0;
+ MPID_PROGRESS_WAIT_WHILE(win->mpid.origin[rank].nStarted != win->mpid.origin[rank].nCompleted);
+ win->mpid.origin[rank].nCompleted=0;
+ win->mpid.origin[rank].nStarted=0;
MPIDI_WinLock_info info = {
.done = 0,
diff --git a/src/mpid/pamid/src/onesided/mpid_win_lock_all.c b/src/mpid/pamid/src/onesided/mpid_win_lock_all.c
new file mode 100644
index 0000000..74248e4
--- /dev/null
+++ b/src/mpid/pamid/src/onesided/mpid_win_lock_all.c
@@ -0,0 +1,163 @@
+/* begin_generated_IBM_copyright_prolog */
+/* */
+/* This is an automatically generated copyright prolog. */
+/* After initializing, DO NOT MODIFY OR MOVE */
+/* --------------------------------------------------------------- */
+/* Licensed Materials - Property of IBM */
+/* Blue Gene/Q 5765-PER 5765-PRP */
+/* */
+/* (C) Copyright IBM Corp. 2011, 2012 All Rights Reserved */
+/* US Government Users Restricted Rights - */
+/* Use, duplication, or disclosure restricted */
+/* by GSA ADP Schedule Contract with IBM Corp. */
+/* */
+/* --------------------------------------------------------------- */
+/* */
+/* end_generated_IBM_copyright_prolog */
+/* (C)Copyright IBM Corp. 2007, 2011 */
+/**
+ * \file src/onesided/mpid_win_lock_all.c
+ * \brief ???
+ */
+#include "mpidi_onesided.h"
+
+
+static pami_result_t
+MPIDI_WinLockAllReq_post(pami_context_t context,
+ void * _info)
+{
+ MPIDI_WinLock_info* info = (MPIDI_WinLock_info*)_info;
+ MPIDI_Win_control_t msg = {
+ .type = MPIDI_WIN_MSGTYPE_LOCKALLREQ,
+ .data = {
+ .lock = {
+ .type = info->lock_type,
+ },
+ },
+ };
+
+ MPIDI_WinCtrlSend(context, &msg, info->peer, info->win);
+ return PAMI_SUCCESS;
+}
+
+
+static pami_result_t
+MPIDI_WinUnlockAll_post(pami_context_t context,
+ void * _info)
+{
+ MPID_Win *win;
+ MPIDI_WinLock_info* info = (MPIDI_WinLock_info*)_info;
+ MPIDI_Win_control_t msg = {
+ .type = MPIDI_WIN_MSGTYPE_UNLOCKALL,
+ };
+ win=info->win;
+ MPIDI_WinCtrlSend(context, &msg, info->peer, info->win);
+ /* current request is the last one in the group */
+ if (win->mpid.sync.lock.remote.allLocked == 1)
+ info->done = 1;
+ return PAMI_SUCCESS;
+}
+
+void
+MPIDI_WinUnlockAll_proc(pami_context_t context,
+ const MPIDI_Win_control_t * info,
+ unsigned peer)
+{
+ MPID_Win *win = info->win;
+ --win->mpid.sync.lock.local.count;
+ MPID_assert((int)win->mpid.sync.lock.local.count >= 0);
+ MPIDI_WinLockAdvance(context, win);
+}
+
+void
+MPIDI_WinLockAllAck_post(pami_context_t context,
+ unsigned peer,
+ MPID_Win * win)
+{
+ MPIDI_Win_control_t info = {
+ .type = MPIDI_WIN_MSGTYPE_LOCKALLACK,
+ };
+ MPIDI_WinCtrlSend(context, &info, peer, win);
+}
+
+
+int
+MPID_Win_lock_all(int assert,
+ MPID_Win *win)
+{
+ int mpi_errno = MPI_SUCCESS;
+ int i,size;
+ MPIDI_WinLock_info *lockQ;
+ struct MPIDI_Win_sync_lock* slock = &win->mpid.sync.lock;
+ static char FCNAME[] = "MPID_Win_lock_all";
+
+ if(win->mpid.sync.origin_epoch_type != MPID_EPOTYPE_NONE &&
+ win->mpid.sync.origin_epoch_type != MPID_EPOTYPE_REFENCE){
+ MPIU_ERR_SETANDSTMT(mpi_errno, MPI_ERR_RMA_SYNC,
+ return mpi_errno, "**rmasync");
+ }
+ size = (MPIR_Comm_size(win->comm_ptr));
+ if (!win->mpid.work.msgQ) {
+ win->mpid.work.msgQ = (void *) MPIU_Calloc0(size, MPIDI_WinLock_info);
+ MPID_assert(win->mpid.work.msgQ != NULL);
+ win->mpid.work.count=0;
+ }
+ lockQ = (MPIDI_WinLock_info *) win->mpid.work.msgQ;
+ for (i = 0; i < size; i++) {
+ lockQ[i].done=0;
+ lockQ[i].peer=i;
+ lockQ[i].win=win;
+ lockQ[i].lock_type=MPI_LOCK_SHARED;
+ MPIDI_Context_post(MPIDI_Context[0], &lockQ[i].work, MPIDI_WinLockAllReq_post, &lockQ[i]);
+ }
+ /* wait for the lock is granted for all tasks in the window */
+ MPID_PROGRESS_WAIT_WHILE(size != slock->remote.allLocked);
+
+ win->mpid.sync.origin_epoch_type = MPID_EPOTYPE_LOCK_ALL;
+
+ return mpi_errno;
+}
+
+
+int
+MPID_Win_unlock_all(MPID_Win *win)
+{
+ int mpi_errno = MPI_SUCCESS;
+ int i;
+ MPIDI_WinLock_info *lockQ;
+ struct MPIDI_Win_sync* sync;
+ static char FCNAME[] = "MPID_Win_unlock_all";
+
+ if (win->mpid.sync.origin_epoch_type != MPID_EPOTYPE_LOCK_ALL) {
+ MPIU_ERR_SETANDSTMT(mpi_errno, MPI_ERR_RMA_SYNC,
+ return mpi_errno, "**rmasync");
+ }
+
+ sync = &win->mpid.sync;
+ MPID_PROGRESS_WAIT_WHILE(sync->total != sync->complete);
+ sync->total = 0;
+ sync->started = 0;
+ sync->complete = 0;
+ for (i = 0; i < MPIR_Comm_size(win->comm_ptr); i++) {
+ win->mpid.origin[i].nStarted=0;
+ win->mpid.origin[i].nCompleted=0;
+ }
+ MPID_assert(win->mpid.work.msgQ != NULL);
+ lockQ = (MPIDI_WinLock_info *) win->mpid.work.msgQ;
+ for (i = 0; i < MPIR_Comm_size(win->comm_ptr); i++) {
+ lockQ[i].done=0;
+ lockQ[i].peer=i;
+ lockQ[i].win=win;
+ MPIDI_Context_post(MPIDI_Context[0], &lockQ[i].work, MPIDI_WinUnlockAll_post, &lockQ[i]);
+ }
+
+ MPID_PROGRESS_WAIT_WHILE(sync->lock.remote.allLocked);
+
+ if(win->mpid.sync.target_epoch_type == MPID_EPOTYPE_REFENCE)
+ {
+ win->mpid.sync.origin_epoch_type = MPID_EPOTYPE_REFENCE;
+ }else{
+ win->mpid.sync.origin_epoch_type = MPID_EPOTYPE_NONE;
+ }
+ return mpi_errno;
+}
diff --git a/src/mpid/pamid/src/onesided/mpid_win_put.c b/src/mpid/pamid/src/onesided/mpid_win_put.c
index 9995386..70564fb 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_put.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_put.c
@@ -106,7 +106,6 @@ MPIDI_Put_use_pami_rput(pami_context_t context, MPIDI_Win_request * req,int *fre
will not change till that RMA has completed. In the meanwhile
the rest of the RMAs will have memory leaks */
if (req->target.dt.num_contig - req->state.index == 1) {
- //if (sync->total - sync->complete == 1) {
map=NULL;
if (req->target.dt.map != &req->target.dt.__map) {
map=(void *) req->target.dt.map;
@@ -228,6 +227,7 @@ MPID_Put(void *origin_addr,
{
int mpi_errno = MPI_SUCCESS;
MPIDI_Win_request *req = MPIU_Calloc0(1, MPIDI_Win_request);
+ *req = zero_req;
req->win = win;
req->type = MPIDI_WIN_REQUEST_PUT;
@@ -254,14 +254,11 @@ MPID_Put(void *origin_addr,
#ifndef MPIDI_NO_ASSERT
MPID_assert(req->origin.dt.size == req->target.dt.size);
#else
- /* temp fix, should be fixed as part of error injection for one sided comm.*/
- /* in 10/12 */
- if (req->origin.dt.size != req->target.dt.size) {
- exit(1);
- }
+ MPIU_ERR_CHKANDJUMP((req->origin.dt.size != req->target.dt.size), mpi_errno, MPI_ERR_SIZE, "**rmasize");
#endif
+
if ( (req->origin.dt.size == 0) ||
(target_rank == MPI_PROC_NULL))
{
@@ -269,10 +266,13 @@ MPID_Put(void *origin_addr,
return MPI_SUCCESS;
}
+ win->mpid.origin[target_rank].nStarted++;
+
/* If the get is a local operation, do it here */
if (target_rank == win->comm_ptr->rank)
{
size_t offset = req->offset;
+ win->mpid.origin[target_rank].nCompleted++;
MPIU_Free(req);
return MPIR_Localcopy(origin_addr,
origin_count,
@@ -360,7 +360,6 @@ MPID_Put(void *origin_addr,
* better latency for one-sided operations.
*/
PAMI_Context_post(MPIDI_Context[0], &req->post_request, MPIDI_Put, req);
- //MPIDI_Put(MPIDI_Context[0], req);
fn_fail:
return mpi_errno;
diff --git a/src/mpid/pamid/src/onesided/mpid_win_sync.c b/src/mpid/pamid/src/onesided/mpid_win_sync.c
new file mode 100644
index 0000000..9c1b877
--- /dev/null
+++ b/src/mpid/pamid/src/onesided/mpid_win_sync.c
@@ -0,0 +1,54 @@
+/* begin_generated_IBM_copyright_prolog */
+/* */
+/* This is an automatically generated copyright prolog. */
+/* After initializing, DO NOT MODIFY OR MOVE */
+/* --------------------------------------------------------------- */
+/* Licensed Materials - Property of IBM */
+/* Blue Gene/Q 5765-PER 5765-PRP */
+/* */
+/* (C) Copyright IBM Corp. 2011, 2012 All Rights Reserved */
+/* US Government Users Restricted Rights - */
+/* Use, duplication, or disclosure restricted */
+/* by GSA ADP Schedule Contract with IBM Corp. */
+/* */
+/* --------------------------------------------------------------- */
+/* */
+/* end_generated_IBM_copyright_prolog */
+/* (C)Copyright IBM Corp. 2007, 2011 */
+/**
+ * \file src/onesided/mpid_win_sync.c
+ * \brief returns a new info object containing the hints of the window
+ * associated with win.
+ */
+#include "mpidi_onesided.h"
+
+/**
+ * \brief MPI-PAMI glue for MPI_Win_sync function
+ *
+ * The funcion synchronizes the private and public window copies of win.
+ * For the purpose of synchronizing the private and public window,
+ * MPI_Win_sync has the effect of ending and reopening an access and
+ * exposure epoch on the window. (note that it does not actually end an
+ * epoch or complete any pending MPI RMA operations).
+ *
+ * \param[in] win window object
+ * \return MPI_SUCCESS, MPI_ERR_RMA_SYNC
+ */
+
+
+int
+MPID_Win_sync(MPID_Win *win)
+{
+ int mpi_errno = MPI_SUCCESS;
+ static char FCNAME[] = "MPID_Win_flush";
+
+ if((win->mpid.sync.origin_epoch_type != MPID_EPOTYPE_LOCK) &&
+ (win->mpid.sync.origin_epoch_type != MPID_EPOTYPE_LOCK_ALL))
+ {
+ MPIU_ERR_SETANDSTMT(mpi_errno, MPI_ERR_RMA_SYNC,
+ return mpi_errno, "**rmasync");
+ }
+ OPA_read_write_barrier();
+ return mpi_errno;
+}
+
diff --git a/src/mpid/pamid/src/onesided/mpidi_win_control.c b/src/mpid/pamid/src/onesided/mpidi_win_control.c
index 9c7d1e4..8c537ff 100644
--- a/src/mpid/pamid/src/onesided/mpidi_win_control.c
+++ b/src/mpid/pamid/src/onesided/mpidi_win_control.c
@@ -39,7 +39,8 @@ MPIDI_WinCtrlSend(pami_context_t context,
rc = PAMI_Endpoint_create(MPIDI_Client,taskid, 0, &dest);
MPID_assert(rc == PAMI_SUCCESS);
- if(control->type == MPIDI_WIN_MSGTYPE_UNLOCK) {
+ if ((control->type == MPIDI_WIN_MSGTYPE_UNLOCK) ||
+ (control->type == MPIDI_WIN_MSGTYPE_UNLOCKALL)) {
pami_send_t params = {
.send = {
.dispatch = MPIDI_Protocols_WinCtrl,
@@ -81,7 +82,16 @@ MPIDI_WinUnlockDoneCB(pami_context_t context,
pami_result_t result)
{
MPID_Win *win = (MPID_Win *)cookie;
- win->mpid.sync.lock.remote.locked = 0;
+ if (win->mpid.sync.origin_epoch_type == MPID_EPOTYPE_LOCK) {
+ win->mpid.sync.lock.remote.locked = 0;
+ }
+ else if (win->mpid.sync.origin_epoch_type == MPID_EPOTYPE_LOCK_ALL)
+ {
+ MPID_assert((int)win->mpid.sync.lock.remote.allLocked > 0);
+ win->mpid.sync.lock.remote.allLocked -= 1;
+ }
+ else
+ MPID_assert_always(0);
}
@@ -105,15 +115,17 @@ MPIDI_WinControlCB(pami_context_t context,
switch (control->type)
{
case MPIDI_WIN_MSGTYPE_LOCKREQ:
+ case MPIDI_WIN_MSGTYPE_LOCKALLREQ:
MPIDI_WinLockReq_proc(context, control, senderrank);
break;
case MPIDI_WIN_MSGTYPE_LOCKACK:
+ case MPIDI_WIN_MSGTYPE_LOCKALLACK:
MPIDI_WinLockAck_proc(context, control, senderrank);
break;
case MPIDI_WIN_MSGTYPE_UNLOCK:
+ case MPIDI_WIN_MSGTYPE_UNLOCKALL:
MPIDI_WinUnlock_proc(context, control, senderrank);
break;
-
case MPIDI_WIN_MSGTYPE_COMPLETE:
MPIDI_WinComplete_proc(context, control, senderrank);
break;
http://git.mpich.org/mpich.git/commitdiff/7473a3b38d572f3f8ba25222a957e32c40526f91
commit 7473a3b38d572f3f8ba25222a957e32c40526f91
Author: Su Huang <suhuang at us.ibm.com>
Date: Wed Sep 25 11:09:35 2013 -0400
PAMId: MPI_Win_set_info, MPI_Win_get_info and the frame work for window creation
The following changes apply only to the PAMId layer
- provided MPID_Win_set_info and MPID_Win_get_info functions
- redesigned the window creation.The change is to support new window creation
functions introduced in MPI 3.0.
- updated pscw, MPIDI_WinCtrlSend etc. to reflect the change made in
MPI_Group_incl().
The following changes were made after a code review
- added a comment for zero_req in mpidi_onesided.h
- replaced "pami_task_t peer" "int rank" in MPIDI_WinCtrlSen()
(ibm) F189041
Signed-off-by: Michael Blocksome <blocksom at us.ibm.com>
diff --git a/src/mpid/pamid/include/mpidi_datatypes.h b/src/mpid/pamid/include/mpidi_datatypes.h
index fb56e3c..053f98c 100644
--- a/src/mpid/pamid/include/mpidi_datatypes.h
+++ b/src/mpid/pamid/include/mpidi_datatypes.h
@@ -370,10 +370,28 @@ struct MPID_Win;
struct MPID_Group;
+/**
+ * \brief Collective information related to a window
+ *
+ * This structure is used to share information about a local window with
+ * all nodes in the window communicator. Part of that information includes
+ * statistics about RMA operations during access/exposure epochs.
+ *
+ * The structure is allocated as an array sized for the window communicator.
+ * Each entry in the array corresponds directly to the node of the same rank.
+ */
+typedef enum
+ {
+ MPIDI_REQUEST_LOCK,
+ MPIDI_REQUEST_LOCKALL,
+ } MPIDI_LOCK_TYPE_t;
+
+
struct MPIDI_Win_lock
{
struct MPIDI_Win_lock *next;
unsigned rank;
+ MPIDI_LOCK_TYPE_t mtype; /* MPIDI_REQUEST_LOCK or MPIDI_REQUEST_LOCKALL */
int type;
};
struct MPIDI_Win_queue
@@ -381,32 +399,56 @@ struct MPIDI_Win_queue
struct MPIDI_Win_lock *head;
struct MPIDI_Win_lock *tail;
};
-/**
- * \brief Collective information related to a window
- *
- * This structure is used to share information about a local window with
- * all nodes in the window communicator. Part of that information includes
- * statistics about RMA operations during access/exposure epochs.
- *
- * The structure is allocated as an array sized for the window communicator.
- * Each entry in the array corresponds directly to the node of the same rank.
- */
-struct MPIDI_Win_info
+
+typedef enum {
+ MPIDI_ACCU_ORDER_RAR = 1,
+ MPIDI_ACCU_ORDER_RAW = 2,
+ MPIDI_ACCU_ORDER_WAR = 4,
+ MPIDI_ACCU_ORDER_WAW = 8
+} MPIDI_Win_info_accumulate_ordering;
+
+typedef enum {
+ MPIDI_ACCU_SAME_OP,
+ MPIDI_ACCU_SAME_OP_NO_OP
+} MPIDI_Win_info_accumulate_ops;
+
+typedef struct MPIDI_Win_info_args {
+ int no_locks;
+ MPIDI_Win_info_accumulate_ordering accumulate_ordering;
+ MPIDI_Win_info_accumulate_ops accumulate_ops; /* default is same_op_no_op */
+ int same_size;
+ int alloc_shared_noncontig;
+} MPIDI_Win_info_args;
+
+
+typedef struct {
+ int nStarted;
+ int nCompleted;
+} RMA_nOps_t;
+
+typedef struct workQ_t {
+ void *msgQ;
+ int count;
+} workQ_t;
+
+typedef struct MPIDI_Win_info
{
void * base_addr; /**< Node's exposure window base address */
struct MPID_Win * win;
uint32_t disp_unit; /**< Node's exposure window displacement units */
pami_memregion_t memregion; /**< Memory region descriptor for each node */
-#ifdef RDMA_FAILOVER
uint32_t memregion_used;
-#endif
-};
+} MPIDI_Win_info;
/**
* \brief Structure of PAMI extensions to MPID_Win structure
*/
struct MPIDI_Win
{
struct MPIDI_Win_info * info; /**< allocated array of collective info */
+ MPIDI_Win_info_args info_args;
+ void ** shm_base_addrs; /* base address shared by all process in comm */
+ workQ_t work;
+ RMA_nOps_t *origin;
struct MPIDI_Win_sync
{
#if 0
@@ -432,6 +474,7 @@ struct MPIDI_Win
struct
{
volatile unsigned locked;
+ volatile unsigned allLocked;
} remote;
struct
{
diff --git a/src/mpid/pamid/src/onesided/Makefile.mk b/src/mpid/pamid/src/onesided/Makefile.mk
index f068454..00fc82c 100644
--- a/src/mpid/pamid/src/onesided/Makefile.mk
+++ b/src/mpid/pamid/src/onesided/Makefile.mk
@@ -35,9 +35,9 @@ lib_lib at MPILIBNAME@_la_SOURCES += \
src/mpid/pamid/src/onesided/mpid_win_lock.c \
src/mpid/pamid/src/onesided/mpid_win_pscw.c \
src/mpid/pamid/src/onesided/mpid_win_put.c \
+ src/mpid/pamid/src/onesided/mpidi_win_control.c \
src/mpid/pamid/src/onesided/mpid_win_get_info.c \
- src/mpid/pamid/src/onesided/mpid_win_set_info.c \
- src/mpid/pamid/src/onesided/mpidi_win_control.c
+ src/mpid/pamid/src/onesided/mpid_win_set_info.c
endif BUILD_PAMID
diff --git a/src/mpid/pamid/src/onesided/mpid_1s.c b/src/mpid/pamid/src/onesided/mpid_1s.c
index 1353662..2b00c12 100644
--- a/src/mpid/pamid/src/onesided/mpid_1s.c
+++ b/src/mpid/pamid/src/onesided/mpid_1s.c
@@ -27,7 +27,9 @@ MPIDI_Win_DoneCB(pami_context_t context,
void * cookie,
pami_result_t result)
{
+ int target_rank;
MPIDI_Win_request *req = (MPIDI_Win_request*)cookie;
+ target_rank = req->target.rank;
++req->win->mpid.sync.complete;
++req->origin.completed;
@@ -45,6 +47,7 @@ MPIDI_Win_DoneCB(pami_context_t context,
MPID_assert(mpi_errno == MPI_SUCCESS);
MPID_Datatype_release(req->origin.dt.pointer);
MPIU_Free(req->buffer);
+ MPIU_Free(req->user_buffer);
req->buffer_free = 0;
}
}
@@ -52,8 +55,12 @@ MPIDI_Win_DoneCB(pami_context_t context,
//if (req->win->mpid.sync.total == req->win->mpid.sync.complete)
if (req->origin.completed == req->target.dt.num_contig)
{
- if (req->buffer_free)
- MPIU_Free(req->buffer);
+ req->win->mpid.origin[target_rank].nCompleted++;
+ if (req->buffer_free) {
+ MPIU_Free(req->buffer);
+ MPIU_Free(req->user_buffer);
+ req->buffer_free = 0;
+ }
if (req->accum_headers)
MPIU_Free(req->accum_headers);
MPIU_Free(req);
diff --git a/src/mpid/pamid/src/onesided/mpid_win_create.c b/src/mpid/pamid/src/onesided/mpid_win_create.c
index 3ac73e6..7becc3e 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_create.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_create.c
@@ -21,6 +21,145 @@
*/
#include "mpidi_onesided.h"
+/***************************************************************************/
+/* */
+/* allocate win_ptr (MPIDI_Win) */
+/* update win structure except for base address */
+/* */
+/***************************************************************************/
+
+int
+MPIDI_Win_init( MPI_Aint length,
+ int disp_unit,
+ MPID_Win **win_ptr,
+ MPID_Info *info,
+ MPID_Comm *comm_ptr,
+ int create_flavor,
+ int model)
+{
+ int mpi_errno=MPI_SUCCESS;
+ size_t length_out = 0;
+ pami_result_t rc;
+ size_t rank, size;
+ MPIDI_Win_info *winfo;
+ int i;
+ static char FCNAME[] = "MPIDI_Win_init";
+
+ /* ----------------------------------------- */
+ /* Setup the common sections of the window */
+ /* ----------------------------------------- */
+ MPID_Win *win = (MPID_Win*)MPIU_Handle_obj_alloc(&MPID_Win_mem);
+
+ MPIU_ERR_CHKANDSTMT(win == NULL, mpi_errno, MPI_ERR_NO_MEM,
+ return mpi_errno, "**nomem");
+
+ *win_ptr = win;
+ memset(&win->mpid, 0, sizeof(struct MPIDI_Win));
+ win->comm_ptr = comm_ptr; MPIR_Comm_add_ref(comm_ptr);
+ size = comm_ptr->local_size;
+ rank = comm_ptr->rank;
+
+ win->mpid.info = MPIU_Malloc(size * sizeof(struct MPIDI_Win_info));
+ MPID_assert(win->mpid.info != NULL);
+ memset((void *) win->mpid.info,0,(size * sizeof(struct MPIDI_Win_info)));
+ winfo = &win->mpid.info[rank];
+ win->errhandler = NULL;
+ win->base = NULL;
+ win->size = length;
+ win->disp_unit = disp_unit;
+ win->create_flavor = create_flavor;
+ win->model = model;
+ win->copyCreateFlavor = 0;
+ win->copyModel = 0;
+ win->attributes = NULL;
+ win->comm_ptr = comm_ptr;
+ if ((info != NULL) && ((int *)info != (int *) MPI_INFO_NULL)) {
+ mpi_errno= MPIDI_Win_set_info(win, info);
+ MPID_assert(mpi_errno == 0);
+ }
+ MPID_assert(mpi_errno == 0);
+ win->mpid.origin = MPIU_Calloc0(size, RMA_nOps_t);
+
+
+ /* Initialize the info (hint) flags per window */
+ win->mpid.info_args.no_locks = 0;
+ win->mpid.info_args.accumulate_ordering =
+ (MPIDI_ACCU_ORDER_RAR | MPIDI_ACCU_ORDER_RAW | MPIDI_ACCU_ORDER_WAR | MPIDI_ACCU_ORDER_WAW);
+ win->mpid.info_args.accumulate_ops = MPIDI_ACCU_OPS_SAME_OP_NO_OP; /*default */
+ win->mpid.info_args.same_size = 0;
+ win->mpid.info_args.alloc_shared_noncontig = 0;
+
+ win->copyDispUnit=0;
+ win->copySize=0;
+ winfo->memregion_used = 0;
+ winfo->disp_unit = disp_unit;
+
+ return mpi_errno;
+}
+
+/***************************************************************************/
+/* */
+/* MPIDI_Win_allgather */
+/* */
+/* registers memory with PAMI if possible */
+/* calls Allgather to gather the information from all members in win. */
+/* */
+/***************************************************************************/
+int
+MPIDI_Win_allgather(void *base, MPI_Aint size, MPID_Win **win_ptr )
+{
+ int mpi_errno = MPI_SUCCESS;
+ MPID_Win *win;
+ int i, k, comm_size, rank;;
+ MPI_Aint temp;
+ int nErrors=0;
+ MPID_Comm *comm_ptr;
+ size_t length_out = 0;
+ pami_result_t rc;
+ MPIDI_Win_info *winfo;
+ pami_task_t task_id;
+ static char FCNAME[] = "MPIDI_Win_allgather";
+
+ win = *win_ptr;
+ comm_ptr = win->comm_ptr;
+ rank = comm_ptr->rank;
+ winfo = &win->mpid.info[rank];
+ /* --------------------------------------- */
+ /* Setup the PAMI sections of the window */
+ /* --------------------------------------- */
+#ifdef USE_PAMI_RDMA
+ if (size != 0)
+ {
+ rc = PAMI_Memregion_create(MPIDI_Context[0], win->base, win->size, &length_out, &winfo->memregion);
+
+ 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");
+ }
+#else
+ if ( (!MPIDI_Process.mp_s_use_pami_get) && (size != 0) )
+ {
+ rc = PAMI_Memregion_create(MPIDI_Context[0], win->base, win->size, &length_out, &winfo->memregion);
+ if(rc == PAMI_SUCCESS)
+ {
+ winfo->memregion_used = 1;
+ MPID_assert(win->size == length_out);
+ }
+ }
+#endif
+ mpi_errno = MPIR_Allgather_impl(MPI_IN_PLACE,
+ 0,
+ MPI_DATATYPE_NULL,
+ win->mpid.info,
+ sizeof(struct MPIDI_Win_info),
+ MPI_BYTE,
+ comm_ptr,
+ &mpi_errno);
+
+fn_fail:
+ return mpi_errno;
+}
+
+
/**
* \brief MPI-PAMI glue for MPI_Win_create function
@@ -45,84 +184,36 @@
*/
int
MPID_Win_create(void * base,
- MPI_Aint length,
+ MPI_Aint size,
int disp_unit,
MPID_Info * info,
MPID_Comm * comm_ptr,
MPID_Win ** win_ptr)
{
int mpi_errno = MPI_SUCCESS;
+ int rc = MPI_SUCCESS,i;
+ static char FCNAME[] = "MPID_Win_create";
+ MPID_Win *win;
+ MPID_Win *sub_win;
+ size_t rank,rk;
+ pami_task_t taskid;
+ MPIDI_Win_info *winfo;
-
- /* ----------------------------------------- */
- /* Setup the common sections of the window */
- /* ----------------------------------------- */
- MPID_Win *win = (MPID_Win*)MPIU_Handle_obj_alloc(&MPID_Win_mem);
- if (win == NULL)
- return mpi_errno;
- *win_ptr = win;
-
+ rc=MPIDI_Win_init(size,disp_unit,win_ptr, info, comm_ptr, MPI_WIN_FLAVOR_CREATE, MPI_WIN_SEPARATE);
+ win = *win_ptr;
win->base = base;
- win->size = length;
- win->disp_unit = disp_unit;
-
- /* --------------------------------------- */
- /* Setup the PAMI sections of the window */
- /* --------------------------------------- */
- memset(&win->mpid, 0, sizeof(struct MPIDI_Win));
-
- win->comm_ptr = comm_ptr; MPIR_Comm_add_ref(comm_ptr);
+ rank = comm_ptr->rank;
+ winfo = &win->mpid.info[rank];
+ winfo->base_addr = base;
+ winfo->win = win;
+ winfo->disp_unit = disp_unit;
- size_t size = comm_ptr->local_size;
- size_t rank = comm_ptr->rank;
+ rc= MPIDI_Win_allgather(base,size,win_ptr);
+ if (rc != MPI_SUCCESS)
+ return rc;
- win->mpid.info = MPIU_Calloc0(size, struct MPIDI_Win_info);
-
- struct MPIDI_Win_info *winfo = &win->mpid.info[rank];
-
- MPID_assert((base != NULL) || (length == 0));
-#ifdef USE_PAMI_RDMA
- if (length != 0)
- {
- size_t length_out = 0;
- pami_result_t rc;
- rc = PAMI_Memregion_create(MPIDI_Context[0], base, length, &length_out, &winfo->memregion);
- MPID_assert(rc == PAMI_SUCCESS);
- MPID_assert(length == length_out);
- }
-#else
- if ( (!MPIDI_Process.mp_s_use_pami_get) && (length != 0) )
- {
- size_t length_out = 0;
- pami_result_t rc;
- rc = PAMI_Memregion_create(MPIDI_Context[0], base, length, &length_out, &winfo->memregion);
- if(rc == PAMI_SUCCESS)
- {
- winfo->memregion_used = 1;
- MPID_assert(length == length_out);
- }
- }
-#endif
-
- winfo->base_addr = base;
- /* winfo->win_handle = win->handle; */
- winfo->win = win;
- winfo->disp_unit = disp_unit;
-
- mpi_errno = MPIR_Allgather_impl(MPI_IN_PLACE,
- 0,
- MPI_DATATYPE_NULL,
- win->mpid.info,
- sizeof(struct MPIDI_Win_info),
- MPI_BYTE,
- comm_ptr,
- &mpi_errno);
- if (mpi_errno != MPI_SUCCESS)
- return mpi_errno;
mpi_errno = MPIR_Barrier_impl(comm_ptr, &mpi_errno);
- if (mpi_errno != MPI_SUCCESS)
- return mpi_errno;
return mpi_errno;
}
diff --git a/src/mpid/pamid/src/onesided/mpid_win_free.c b/src/mpid/pamid/src/onesided/mpid_win_free.c
index 69e082b..5155ce8 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_free.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_free.c
@@ -70,6 +70,7 @@ MPID_Win_free(MPID_Win **win_ptr)
#endif
MPIU_Free(win->mpid.info);
+ MPIU_Free(win->mpid.origin);
MPIR_Comm_release(win->comm_ptr, 0);
diff --git a/src/mpid/pamid/src/onesided/mpid_win_get_info.c b/src/mpid/pamid/src/onesided/mpid_win_get_info.c
index ba16658..88d083b 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_get_info.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_get_info.c
@@ -17,7 +17,8 @@
/* (C)Copyright IBM Corp. 2007, 2011 */
/**
* \file src/onesided/mpid_win_get_info.c
- * \brief ???
+ * \brief returns a new info object containing the hints of the window
+ * associated with win.
*/
#include "mpidi_onesided.h"
@@ -28,23 +29,75 @@
* \param[in] info_p_p Info hint
* \return MPI_SUCCESS
*/
-#undef FUNCNAME
-#define FUNCNAME MPID_Win_get_info
-#undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+int MPIDI_Win_get_info(MPID_Win *win, MPID_Info **info_used)
+{
+ int mpi_errno = MPI_SUCCESS;
+
+
+ /* Populate the predefined info keys */
+ if (win->mpid.info_args.no_locks)
+ mpi_errno = MPIR_Info_set_impl(*info_used, "no_locks", "true");
+ else
+ mpi_errno = MPIR_Info_set_impl(*info_used, "no_locks", "false");
+ MPID_assert(mpi_errno == MPI_SUCCESS);
+
+ {
+#define BUFSIZE 32
+ char buf[BUFSIZE];
+ int c = 0;
+ if (win->mpid.info_args.accumulate_ordering & MPIDI_ACCU_ORDER_RAR)
+ c += snprintf(buf+c, BUFSIZE-c, "%srar", (c > 0) ? "," : "");
+ if (win->mpid.info_args.accumulate_ordering & MPIDI_ACCU_ORDER_RAW)
+ c += snprintf(buf+c, BUFSIZE-c, "%sraw", (c > 0) ? "," : "");
+ if (win->mpid.info_args.accumulate_ordering & MPIDI_ACCU_ORDER_WAR)
+ c += snprintf(buf+c, BUFSIZE-c, "%swar", (c > 0) ? "," : "");
+ if (win->mpid.info_args.accumulate_ordering & MPIDI_ACCU_ORDER_WAW)
+ c += snprintf(buf+c, BUFSIZE-c, "%swaw", (c > 0) ? "," : "");
+
+ if (c == 0) {
+ memcpy(&buf[0],"not set ",10);
+ }
+ MPIR_Info_set_impl(*info_used, "accumulate_ordering", buf);
+ MPID_assert(mpi_errno == MPI_SUCCESS);
+#undef BUFSIZE
+ }
+ if (win->mpid.info_args.accumulate_ops == MPIDI_ACCU_OPS_SAME_OP)
+ mpi_errno = MPIR_Info_set_impl(*info_used, "accumulate_ops", "same_op");
+ else
+ mpi_errno = MPIR_Info_set_impl(*info_used, "accumulate_ops", "same_op_no_op");
+
+ MPID_assert(mpi_errno == MPI_SUCCESS);
+
+ if (win->create_flavor == MPI_WIN_FLAVOR_SHARED) {
+ if (win->mpid.info_args.alloc_shared_noncontig)
+ mpi_errno = MPIR_Info_set_impl(*info_used, "alloc_shared_noncontig", "true");
+ else
+ mpi_errno = MPIR_Info_set_impl(*info_used, "alloc_shared_noncontig", "false");
+
+ MPID_assert(mpi_errno == MPI_SUCCESS);
+ }
+ else if (win->create_flavor == MPI_WIN_FLAVOR_ALLOCATE) {
+ if (win->mpid.info_args.same_size)
+ mpi_errno = MPIR_Info_set_impl(*info_used, "same_size", "true");
+ else
+ mpi_errno = MPIR_Info_set_impl(*info_used, "same_size", "false");
+
+ MPID_assert(mpi_errno == MPI_SUCCESS);
+ }
+ return mpi_errno;
+}
+
+
int
MPID_Win_get_info(MPID_Win *win,
- MPID_Info **info_p_p)
+ MPID_Info **info_p)
{
int mpi_errno = MPI_SUCCESS;
/* Allocate an empty info object */
- mpi_errno = MPIU_Info_alloc(info_p_p);
- if (mpi_errno != MPI_SUCCESS)
- goto fn_fail;
-
-fn_exit:
- return mpi_errno;
-fn_fail:
- goto fn_exit;
+ mpi_errno = MPIU_Info_alloc(info_p);
+ MPID_assert(mpi_errno == MPI_SUCCESS);
+ mpi_errno = MPIDI_Win_get_info(win, info_p);
+ MPID_assert(mpi_errno == MPI_SUCCESS);
+ return MPI_SUCCESS;
}
diff --git a/src/mpid/pamid/src/onesided/mpid_win_lock.c b/src/mpid/pamid/src/onesided/mpid_win_lock.c
index f2a9c5f..c5be921 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_lock.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_lock.c
@@ -21,25 +21,13 @@
*/
#include "mpidi_onesided.h"
-
-typedef struct
-{
- unsigned peer;
- int lock_type;
- MPID_Win * win;
-
- volatile unsigned done;
- pami_work_t work;
-} MPIDI_WinLock_info;
-
-
-static inline void
+void
MPIDI_WinLockAck_post(pami_context_t context,
unsigned peer,
MPID_Win * win);
-static inline void
+void
MPIDI_WinLockAdvance(pami_context_t context,
MPID_Win * win)
{
@@ -112,7 +100,7 @@ MPIDI_WinLockReq_proc(pami_context_t context,
}
-static inline void
+void
MPIDI_WinLockAck_post(pami_context_t context,
unsigned peer,
MPID_Win * win)
diff --git a/src/mpid/pamid/src/onesided/mpid_win_pscw.c b/src/mpid/pamid/src/onesided/mpid_win_pscw.c
index 7dc2cef..1ee4b4a 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_pscw.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_pscw.c
@@ -44,7 +44,7 @@ MPIDI_WinPost_post(pami_context_t context,
};
for (index=0; index < group->size; ++index) {
- peer = group->lrank_to_lpid[index].lpid;
+ peer = group->lrank_to_lpid[index].lrank;
MPIDI_WinCtrlSend(context, &msg, peer, info->win);
}
@@ -75,7 +75,7 @@ MPIDI_WinComplete_post(pami_context_t context,
};
for (index=0; index < group->size; ++index) {
- peer = group->lrank_to_lpid[index].lpid;
+ peer = group->lrank_to_lpid[index].lrank;
MPIDI_WinCtrlSend(context, &msg, peer, info->win);
}
diff --git a/src/mpid/pamid/src/onesided/mpid_win_set_info.c b/src/mpid/pamid/src/onesided/mpid_win_set_info.c
index b56a43a..6719150 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_set_info.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_set_info.c
@@ -17,7 +17,8 @@
/* (C)Copyright IBM Corp. 2007, 2011 */
/**
* \file src/onesided/mpid_win_set_info.c
- * \brief ???
+ * \brief sets new values for the hints of the window of the window
+ * associated with win.
*/
#include "mpidi_onesided.h"
@@ -28,13 +29,76 @@
* \param[in] info Info hint
* \return MPI_SUCCESS
*/
-#undef FUNCNAME
-#define FUNCNAME MPID_Win_set_info
-#undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+
+int MPIDI_Win_set_info(MPID_Win *win, MPID_Info *info)
+{
+
+ int mpi_errno = MPI_SUCCESS;
+ MPID_Info *curr_ptr, *prev_ptr;
+ MPID_Info *c_ptr, *p_ptr;
+ char *value, *token;
+ char *savePtr;
+ prev_ptr = info;
+ curr_ptr = info->next;
+ uint save_ordering;
+
+ while (curr_ptr) {
+ if (!strcmp(curr_ptr->key,"no_locks")) {
+ if (!strcmp(curr_ptr->value,"true")) {
+ win->mpid.info_args.no_locks=1;
+ } else
+ win->mpid.info_args.no_locks=0;
+ } else if (!strcmp(curr_ptr->key,"accumulate_ordering"))
+ {
+ save_ordering=(uint) win->mpid.info_args.accumulate_ordering;
+ win->mpid.info_args.accumulate_ordering=0;
+ value = curr_ptr->value;
+ token = (char *) strtok_r(value,"," , &savePtr);
+ while (token) {
+ if (!memcmp(token,"rar",3))
+ {
+ win->mpid.info_args.accumulate_ordering =
+ (win->mpid.info_args.accumulate_ordering | MPIDI_ACCU_ORDER_RAR);
+ } else if (!memcmp(token,"raw",3))
+ {
+ win->mpid.info_args.accumulate_ordering =
+ (win->mpid.info_args.accumulate_ordering | MPIDI_ACCU_ORDER_RAW);
+ } else if (!memcmp(token,"war",3))
+ {
+ win->mpid.info_args.accumulate_ordering =
+ (win->mpid.info_args.accumulate_ordering | MPIDI_ACCU_ORDER_WAR);
+ } else if (!memcmp(token,"waw",3))
+ {
+ win->mpid.info_args.accumulate_ordering =
+ (win->mpid.info_args.accumulate_ordering | MPIDI_ACCU_ORDER_WAW);
+ } else
+ MPID_assert_always(0);
+ token = (char *) strtok_r(NULL,"," , &savePtr);
+ }
+ if (win->mpid.info_args.accumulate_ordering == 0) {
+ win->mpid.info_args.accumulate_ordering=
+ (MPIDI_Win_info_accumulate_ordering) save_ordering;
+ }
+ } else if (!strcmp(curr_ptr->key,"accumulate_ops"))
+ {
+ /* the default setting is MPIDI_ACCU_SAME_OP_NO_OP */
+ if (!strcmp(curr_ptr->value,"same_op"))
+ win->mpid.info_args.accumulate_ops = MPIDI_ACCU_SAME_OP;
+ }
+ prev_ptr = curr_ptr;
+ curr_ptr = curr_ptr->next;
+ }
+
+ return mpi_errno;
+}
+
int
-MPID_Win_set_info(MPID_Win *win,
- MPID_Info *info)
+MPID_Win_set_info(MPID_Win *win, MPID_Info *info)
{
- return MPI_SUCCESS;
+ int mpi_errno = MPI_SUCCESS;
+
+ mpi_errno = MPIDI_Win_set_info(win, info);
+ MPID_assert(mpi_errno == MPI_SUCCESS);
+ mpi_errno = MPIR_Barrier_impl(win->comm_ptr, &mpi_errno);
+ return mpi_errno;
}
diff --git a/src/mpid/pamid/src/onesided/mpidi_onesided.h b/src/mpid/pamid/src/onesided/mpidi_onesided.h
index af888bd..8fa896b 100644
--- a/src/mpid/pamid/src/onesided/mpidi_onesided.h
+++ b/src/mpid/pamid/src/onesided/mpidi_onesided.h
@@ -28,18 +28,23 @@ pami_rget_simple_t zero_rget_parms;
pami_get_simple_t zero_get_parms;
pami_rput_simple_t zero_rput_parms;
pami_put_simple_t zero_put_parms;
+pami_send_t zero_send_parms;
+pami_recv_t zero_recv_parms;
/**
* \brief One-sided Message Types
*/
typedef enum
{
- MPIDI_WIN_MSGTYPE_LOCKACK, /**< Lock acknowledge */
- MPIDI_WIN_MSGTYPE_LOCKREQ, /**< Lock window */
- MPIDI_WIN_MSGTYPE_UNLOCK, /**< Unlock window */
-
- MPIDI_WIN_MSGTYPE_COMPLETE, /**< End a START epoch */
- MPIDI_WIN_MSGTYPE_POST, /**< Begin POST epoch */
+ MPIDI_WIN_MSGTYPE_LOCKACK, /**< Lock acknowledge */
+ MPIDI_WIN_MSGTYPE_LOCKALLACK, /**< Lock all acknowledge */
+ MPIDI_WIN_MSGTYPE_LOCKREQ, /**< Lock window */
+ MPIDI_WIN_MSGTYPE_LOCKALLREQ, /**< Lock all window */
+ MPIDI_WIN_MSGTYPE_UNLOCK, /**< Unlock window */
+ MPIDI_WIN_MSGTYPE_UNLOCKALL, /**< Unlock window */
+
+ MPIDI_WIN_MSGTYPE_COMPLETE, /**< End a START epoch */
+ MPIDI_WIN_MSGTYPE_POST, /**< Begin POST epoch */
} MPIDI_Win_msgtype_t;
typedef enum
@@ -49,11 +54,18 @@ typedef enum
MPIDI_WIN_REQUEST_PUT,
} MPIDI_Win_requesttype_t;
+typedef enum
+ {
+ MPIDI_ACCU_OPS_SAME_OP,
+ MPIDI_ACCU_OPS_SAME_OP_NO_OP
+ } MPIDI_Win_info_arg_vals_accumulate_ops;
+
typedef struct
{
MPIDI_Win_msgtype_t type;
MPID_Win *win;
+ int rank; /* MPI rank */
union
{
struct
@@ -64,6 +76,17 @@ typedef struct
} MPIDI_Win_control_t;
+typedef struct MPIDI_WinLock_info
+{
+ unsigned peer;
+ int lock_type;
+ struct MPID_Win * win;
+ volatile unsigned done;
+ pami_work_t work;
+} MPIDI_WinLock_info;
+
+
+
typedef struct
{
MPID_Datatype * pointer;
@@ -82,10 +105,14 @@ typedef struct
typedef struct
{
void * addr;
+ void * result_addr; /* anchor the result buffer address*/
void * req;
MPID_Win * win;
MPI_Datatype type;
MPI_Op op;
+ pami_endpoint_t origin_endpoint; /* needed for returning the result */
+ /* for MPI_Get_accumulate */
+ size_t len; /* length of the send data */
} MPIDI_Win_MsgInfo;
@@ -113,6 +140,7 @@ typedef struct
uint32_t memregion_used; /**< memory region registered or not */
#endif
void *addr;
+ void *result_addr; /** result buffer that holds target buffer data */
int count;
MPI_Datatype datatype;
MPIDI_Datatype dt;
@@ -126,10 +154,11 @@ typedef struct
} target;
void *buffer;
+ void *user_buffer;
uint32_t buffer_free;
} MPIDI_Win_request;
-
+MPIDI_Win_request zero_req; /* used for init. request structure to 0 */
void
MPIDI_Win_datatype_basic(int count,
@@ -143,7 +172,7 @@ MPIDI_Win_datatype_unmap(MPIDI_Datatype * dt);
void
MPIDI_WinCtrlSend(pami_context_t context,
MPIDI_Win_control_t *control,
- pami_task_t peer,
+ int rank,
MPID_Win *win);
void
@@ -186,5 +215,29 @@ MPIDI_WinAccumCB(pami_context_t context,
size_t sndlen,
pami_endpoint_t sender,
pami_recv_t * recv);
+int
+MPIDI_Win_init( MPI_Aint length,
+ int disp_unit,
+ MPID_Win **win_ptr,
+ MPID_Info *info,
+ MPID_Comm *comm_ptr,
+ int create_flavor,
+ int model);
+int
+MPIDI_Win_allgather(void *base,
+ MPI_Aint size,
+ MPID_Win **win_ptr);
+
+void
+MPIDI_WinLockAdvance(pami_context_t context,
+ MPID_Win * win);
+void
+MPIDI_WinLockAck_post(pami_context_t context,
+ unsigned peer,
+ MPID_Win *win);
+void
+MPIDI_WinLockReq_proc(pami_context_t context,
+ const MPIDI_Win_control_t * info,
+ unsigned peer);
#endif
diff --git a/src/mpid/pamid/src/onesided/mpidi_win_control.c b/src/mpid/pamid/src/onesided/mpidi_win_control.c
index 2e3984b..9c7d1e4 100644
--- a/src/mpid/pamid/src/onesided/mpidi_win_control.c
+++ b/src/mpid/pamid/src/onesided/mpidi_win_control.c
@@ -25,14 +25,18 @@
void
MPIDI_WinCtrlSend(pami_context_t context,
MPIDI_Win_control_t *control,
- pami_task_t peer,
+ int rank,
MPID_Win *win)
{
- control->win = win->mpid.info[peer].win;
+ pami_task_t taskid;
+ control->win = win->mpid.info[rank].win;
+ control->rank = win->comm_ptr->rank;
+ taskid=MPID_VCR_GET_LPID(win->comm_ptr->vcr,rank);
pami_endpoint_t dest;
pami_result_t rc;
- rc = PAMI_Endpoint_create(MPIDI_Client, peer, 0, &dest);
+ taskid=MPID_VCR_GET_LPID(win->comm_ptr->vcr,rank);
+ rc = PAMI_Endpoint_create(MPIDI_Client,taskid, 0, &dest);
MPID_assert(rc == PAMI_SUCCESS);
if(control->type == MPIDI_WIN_MSGTYPE_UNLOCK) {
-----------------------------------------------------------------------
Summary of changes:
src/mpid/pamid/include/mpidi_constants.h | 1 +
src/mpid/pamid/include/mpidi_datatypes.h | 71 +++++--
src/mpid/pamid/src/misc/mpid_unimpl.c | 63 ------
src/mpid/pamid/src/onesided/Makefile.mk | 7 +
src/mpid/pamid/src/onesided/mpid_1s.c | 13 +-
src/mpid/pamid/src/onesided/mpid_win_accumulate.c | 32 ++--
src/mpid/pamid/src/onesided/mpid_win_allocate.c | 98 +++++++++
.../{mpid_win_get_info.c => mpid_win_attach.c} | 42 +++--
src/mpid/pamid/src/onesided/mpid_win_create.c | 223 ++++++++++++++------
.../pamid/src/onesided/mpid_win_create_dynamic.c | 67 ++++++
.../{mpid_win_get_info.c => mpid_win_detach.c} | 35 ++--
src/mpid/pamid/src/onesided/mpid_win_flush.c | 182 ++++++++++++++++
src/mpid/pamid/src/onesided/mpid_win_free.c | 1 +
src/mpid/pamid/src/onesided/mpid_win_get.c | 21 +--
src/mpid/pamid/src/onesided/mpid_win_get_info.c | 81 ++++++--
src/mpid/pamid/src/onesided/mpid_win_lock.c | 53 +++---
src/mpid/pamid/src/onesided/mpid_win_lock_all.c | 163 ++++++++++++++
src/mpid/pamid/src/onesided/mpid_win_pscw.c | 4 +-
src/mpid/pamid/src/onesided/mpid_win_put.c | 13 +-
src/mpid/pamid/src/onesided/mpid_win_set_info.c | 80 +++++++-
.../{mpid_win_get_info.c => mpid_win_sync.c} | 48 +++--
src/mpid/pamid/src/onesided/mpidi_onesided.h | 69 ++++++-
src/mpid/pamid/src/onesided/mpidi_win_control.c | 28 ++-
23 files changed, 1090 insertions(+), 305 deletions(-)
create mode 100644 src/mpid/pamid/src/onesided/mpid_win_allocate.c
copy src/mpid/pamid/src/onesided/{mpid_win_get_info.c => mpid_win_attach.c} (54%)
create mode 100644 src/mpid/pamid/src/onesided/mpid_win_create_dynamic.c
copy src/mpid/pamid/src/onesided/{mpid_win_get_info.c => mpid_win_detach.c} (62%)
create mode 100644 src/mpid/pamid/src/onesided/mpid_win_flush.c
create mode 100644 src/mpid/pamid/src/onesided/mpid_win_lock_all.c
copy src/mpid/pamid/src/onesided/{mpid_win_get_info.c => mpid_win_sync.c} (53%)
hooks/post-receive
--
MPICH primary repository
More information about the commits
mailing list