Commit 1d873639 authored by Xin Zhao's avatar Xin Zhao
Browse files

Add global window list.



Add a list of created windows on this process,
so that we can make progress on all windows in
the progress engine.
Signed-off-by: Pavan Balaji's avatarPavan Balaji <balaji@anl.gov>
parent 079a516b
......@@ -124,6 +124,13 @@ typedef struct MPIDI_RMA_Slot {
struct MPIDI_RMA_Target *target_list_tail;
} MPIDI_RMA_Slot_t;
typedef struct MPIDI_RMA_Win_list {
MPID_Win *win_ptr;
struct MPIDI_RMA_Win_list *next;
} MPIDI_RMA_Win_list_t;
extern MPIDI_RMA_Win_list_t *MPIDI_RMA_Win_list, *MPIDI_RMA_Win_list_tail;
typedef struct MPIDI_PT_single_op {
MPIDI_CH3_Pkt_type_t type; /* put, get, or accum. */
void *addr;
......
......@@ -29,6 +29,8 @@ cvars:
MPIU_THREADSAFE_INIT_DECL(initRMAoptions);
MPIDI_RMA_Win_list_t *MPIDI_RMA_Win_list = NULL, *MPIDI_RMA_Win_list_tail = NULL;
static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
MPID_Comm * comm_ptr, MPID_Win ** win_ptr);
......@@ -277,7 +279,8 @@ static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
int i;
MPID_Comm *win_comm_ptr;
int win_target_pool_size;
MPIU_CHKPMEM_DECL(4);
MPIDI_RMA_Win_list_t *win_elem;
MPIU_CHKPMEM_DECL(5);
MPIDI_STATE_DECL(MPID_STATE_WIN_INIT);
MPIDI_FUNC_ENTER(MPID_STATE_WIN_INIT);
......@@ -378,6 +381,12 @@ static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
MPID_WIN_FTABLE_SET_DEFAULTS(win_ptr);
/* enqueue window into the global list */
MPIU_CHKPMEM_MALLOC(win_elem, MPIDI_RMA_Win_list_t *, sizeof(MPIDI_RMA_Win_list_t), mpi_errno,
"Window list element");
win_elem->win_ptr = *win_ptr;
MPL_LL_APPEND(MPIDI_RMA_Win_list, MPIDI_RMA_Win_list_tail, win_elem);
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_WIN_INIT);
return mpi_errno;
......
......@@ -133,6 +133,7 @@ int MPIDI_Win_free(MPID_Win ** win_ptr)
int in_use;
MPID_Comm *comm_ptr;
int errflag = FALSE;
MPIDI_RMA_Win_list_t *win_elem;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_WIN_FREE);
MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_WIN_FREE);
......@@ -148,6 +149,13 @@ int MPIDI_Win_free(MPID_Win ** win_ptr)
MPIU_ERR_POP(mpi_errno);
}
/* dequeue window from the global list */
for (win_elem = MPIDI_RMA_Win_list; win_elem && win_elem->win_ptr != *win_ptr;
win_elem = win_elem->next);
MPIU_ERR_CHKANDJUMP(win_elem == NULL, mpi_errno, MPI_ERR_RMA_SYNC, "**rmasync");
MPL_LL_DELETE(MPIDI_RMA_Win_list, MPIDI_RMA_Win_list_tail, win_elem);
MPIU_Free(win_elem);
comm_ptr = (*win_ptr)->comm_ptr;
mpi_errno = MPIR_Comm_free_impl(comm_ptr);
if (mpi_errno)
......
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