Commit ab97edb7 authored by James Dinan's avatar James Dinan
Browse files

[svn-r10513] Support for one RMA op list per target

The use of a dense array is a temporary measure to support the reference
implementation.  This will be much improved by ticket #1735.

Reviewer: goodell
parent 08ea9366
......@@ -209,6 +209,10 @@ struct MPIDI_Win_info_args_s {
int alloc_shared_noncontig; /* valid flavor = allocate shared */
};
struct MPIDI_Win_target_state_s {
struct MPIDI_RMA_ops *rma_ops_list; /* list of outstanding RMA operations */
};
#define MPIDI_DEV_WIN_DECL \
volatile int my_counter; /* completion counter for operations \
targeting this window */ \
......@@ -217,8 +221,6 @@ struct MPIDI_Win_info_args_s {
int *disp_units; /* array of displacement units of all windows */\
MPI_Win *all_win_handles; /* array of handles to the window objects\
of all processes */ \
struct MPIDI_RMA_ops *rma_ops_list; /* list of outstanding RMA \
operations */ \
volatile enum MPIDI_CH3_Lock_states_e remote_lock_state; \
/* Indicates the state of the target \
process' "lock" for passive target \
......@@ -241,6 +243,7 @@ struct MPIDI_Win_info_args_s {
completed as target */ \
MPI_Aint *sizes; /* array of sizes of all windows */ \
struct MPIDI_Win_info_args_s info_args; \
struct MPIDI_Win_target_state_s *targets; \
#ifdef MPIDI_CH3_WIN_DECL
#define MPID_DEV_WIN_DECL \
......
......@@ -278,6 +278,40 @@ static inline void MPIDI_CH3I_RMA_Ops_free(MPIDI_RMA_Ops_list_t *list)
}
/* Concatenate RMA ops to all targets into a single list.
*/
#undef FUNCNAME
#define FUNCNAME MPIDI_CH3I_RMA_Ops_concat_all
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static inline MPIDI_RMA_ops * MPIDI_CH3I_RMA_Ops_concat_all(MPID_Win *win_ptr)
{
int i;
MPIDI_RMA_ops *root = NULL;
for (i = 0; i < MPIR_Comm_size(win_ptr->comm_ptr); i++) {
MPIDI_RMA_ops *head = win_ptr->targets[i].rma_ops_list;
/* Attach this list to the end of the aggregate list */
if (head != NULL) {
if (root == NULL)
root = head;
else {
MPIDI_RMA_ops *old_tail = root->prev;
old_tail->next = head;
root->prev = head; /* new tail pointer */
head->prev = old_tail;
}
win_ptr->targets[i].rma_ops_list = NULL;
}
}
return root;
}
#undef FUNCNAME
#undef FCNAME
......
......@@ -156,7 +156,7 @@ int MPIDI_Get_accumulate(const void *origin_addr, int origin_count,
/* Append the operation to the window's RMA ops queue */
MPIU_INSTR_DURATION_START(rmaqueue_alloc);
mpi_errno = MPIDI_CH3I_RMA_Ops_alloc_tail(&win_ptr->rma_ops_list, &new_ptr);
mpi_errno = MPIDI_CH3I_RMA_Ops_alloc_tail(&win_ptr->targets[target_rank].rma_ops_list, &new_ptr);
MPIU_INSTR_DURATION_END(rmaqueue_alloc);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
......@@ -249,7 +249,7 @@ int MPIDI_Compare_and_swap(const void *origin_addr, const void *compare_addr,
/* Append this operation to the RMA ops queue */
MPIU_INSTR_DURATION_START(rmaqueue_alloc);
mpi_errno = MPIDI_CH3I_RMA_Ops_alloc_tail(&win_ptr->rma_ops_list, &new_ptr);
mpi_errno = MPIDI_CH3I_RMA_Ops_alloc_tail(&win_ptr->targets[target_rank].rma_ops_list, &new_ptr);
MPIU_INSTR_DURATION_END(rmaqueue_alloc);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
......@@ -324,7 +324,7 @@ int MPIDI_Fetch_and_op(const void *origin_addr, void *result_addr,
/* Append this operation to the RMA ops queue */
MPIU_INSTR_DURATION_START(rmaqueue_alloc);
mpi_errno = MPIDI_CH3I_RMA_Ops_alloc_tail(&win_ptr->rma_ops_list, &new_ptr);
mpi_errno = MPIDI_CH3I_RMA_Ops_alloc_tail(&win_ptr->targets[target_rank].rma_ops_list, &new_ptr);
MPIU_INSTR_DURATION_END(rmaqueue_alloc);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
......
......@@ -86,6 +86,7 @@ int MPIDI_Win_free(MPID_Win **win_ptr)
mpi_errno = MPIR_Comm_free_impl(comm_ptr);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIU_Free((*win_ptr)->targets);
MPIU_Free((*win_ptr)->base_addrs);
MPIU_Free((*win_ptr)->sizes);
MPIU_Free((*win_ptr)->disp_units);
......@@ -152,7 +153,7 @@ int MPIDI_Put(const void *origin_addr, int origin_count, MPI_Datatype
/* queue it up */
MPIU_INSTR_DURATION_START(rmaqueue_alloc);
mpi_errno = MPIDI_CH3I_RMA_Ops_alloc_tail(&win_ptr->rma_ops_list, &new_ptr);
mpi_errno = MPIDI_CH3I_RMA_Ops_alloc_tail(&win_ptr->targets[target_rank].rma_ops_list, &new_ptr);
MPIU_INSTR_DURATION_END(rmaqueue_alloc);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
......@@ -242,7 +243,7 @@ int MPIDI_Get(void *origin_addr, int origin_count, MPI_Datatype
/* queue it up */
MPIU_INSTR_DURATION_START(rmaqueue_alloc);
mpi_errno = MPIDI_CH3I_RMA_Ops_alloc_tail(&win_ptr->rma_ops_list, &new_ptr);
mpi_errno = MPIDI_CH3I_RMA_Ops_alloc_tail(&win_ptr->targets[target_rank].rma_ops_list, &new_ptr);
MPIU_INSTR_DURATION_END(rmaqueue_alloc);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
......@@ -428,7 +429,7 @@ int MPIDI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype
/* queue it up */
MPIU_INSTR_DURATION_START(rmaqueue_alloc);
mpi_errno = MPIDI_CH3I_RMA_Ops_alloc_tail(&win_ptr->rma_ops_list, &new_ptr);
mpi_errno = MPIDI_CH3I_RMA_Ops_alloc_tail(&win_ptr->targets[target_rank].rma_ops_list, &new_ptr);
MPIU_INSTR_DURATION_END(rmaqueue_alloc);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
......
This diff is collapsed.
......@@ -223,7 +223,9 @@ static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
MPID_Comm *comm_ptr, MPID_Win **win_ptr)
{
int mpi_errno = MPI_SUCCESS;
int i;
MPID_Comm *win_comm_ptr;
MPIU_CHKPMEM_DECL(1);
MPIDI_STATE_DECL(MPID_STATE_WIN_INIT);
MPIDI_FUNC_ENTER(MPID_STATE_WIN_INIT);
......@@ -271,7 +273,6 @@ static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
/* (*win_ptr)->sizes[] is set by caller; */
/* (*win_ptr)->disp_units[] is set by caller; */
/* (*win_ptr)->all_win_handles[] is set by caller; */
(*win_ptr)->rma_ops_list = NULL;
(*win_ptr)->remote_lock_state = MPIDI_CH3_WIN_LOCK_NONE;
(*win_ptr)->current_lock_type = MPID_LOCK_NONE;
(*win_ptr)->shared_lock_ref_cnt = 0;
......@@ -279,6 +280,15 @@ static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
(*win_ptr)->pt_rma_puts_accs = NULL;
(*win_ptr)->my_pt_rma_puts_accs = 0;
/* Initialize the passive target lock state */
MPIU_CHKPMEM_MALLOC((*win_ptr)->targets, struct MPIDI_Win_target_state_s *,
sizeof(struct MPIDI_Win_target_state_s)*MPIR_Comm_size(win_comm_ptr),
mpi_errno, "RMA target states array");
for (i = 0; i < MPIR_Comm_size(win_comm_ptr); i++) {
(*win_ptr)->targets[i].rma_ops_list = NULL;
}
/* Initialize the info flags */
(*win_ptr)->info_args.no_locks = 0;
(*win_ptr)->info_args.accumulate_ordering = MPIDI_ACC_ORDER_RAR | MPIDI_ACC_ORDER_RAW |
......@@ -293,6 +303,7 @@ fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_WIN_INIT);
return mpi_errno;
fn_fail:
MPIU_CHKPMEM_REAP();
goto fn_exit;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment