Commit 7b537b01 authored by Xin Zhao's avatar Xin Zhao
Browse files

Setting infos in win_init function.

No reviewer.
parent 8098f89c
......@@ -279,24 +279,6 @@ static int MPIDI_CH3I_Win_allocate_shm(MPI_Aint size, int disp_unit, MPID_Info *
goto fn_exit;
}
/* If create flavor is MPI_WIN_FLAVOR_ALLOCATE, alloc_shared_noncontig is set to 1 by default. */
if ((*win_ptr)->create_flavor == MPI_WIN_FLAVOR_ALLOCATE)
(*win_ptr)->info_args.alloc_shared_noncontig = 1;
/* Check if we are allowed to allocate space non-contiguously */
if (info != NULL) {
int alloc_shared_nctg_flag = 0;
char alloc_shared_nctg_value[MPI_MAX_INFO_VAL+1];
MPIR_Info_get_impl(info, "alloc_shared_noncontig", MPI_MAX_INFO_VAL,
alloc_shared_nctg_value, &alloc_shared_nctg_flag);
if (alloc_shared_nctg_flag == 1) {
if (!strncmp(alloc_shared_nctg_value, "true", strlen("true")))
(*win_ptr)->info_args.alloc_shared_noncontig = 1;
if (!strncmp(alloc_shared_nctg_value, "false", strlen("false")))
(*win_ptr)->info_args.alloc_shared_noncontig = 0;
}
}
/* see if we can allocate all windows contiguously */
noncontig = (*win_ptr)->info_args.alloc_shared_noncontig;
......
......@@ -51,9 +51,6 @@ int MPIDI_CH3U_Win_create_gather( void *base, MPI_Aint size, int disp_unit,
comm_size = (*win_ptr)->comm_ptr->local_size;
rank = (*win_ptr)->comm_ptr->rank;
/* RMA handlers should be set before calling this function */
mpi_errno = (*win_ptr)->RMAFns.Win_set_info(*win_ptr, info);
MPIR_T_PVAR_TIMER_START(RMA, rma_wincreate_allgather);
/* allocate memory for the base addresses, disp_units, and
completion counters of all processes */
......@@ -296,7 +293,50 @@ int MPIDI_Win_set_info(MPID_Win *win, MPID_Info *info)
MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_WIN_SET_INFO);
/* No op, info arguments are ignored by default */
/********************************************************/
/*************** check for info alloc_shm ***************/
/********************************************************/
if (win->create_flavor == MPI_WIN_FLAVOR_CREATE)
win->info_args.alloc_shm = FALSE;
if (win->create_flavor == MPI_WIN_FLAVOR_ALLOCATE ||
win->create_flavor == MPI_WIN_FLAVOR_SHARED)
win->info_args.alloc_shm = TRUE;
if (info != NULL) {
int info_flag = 0;
char info_value[MPI_MAX_INFO_VAL+1];
MPIR_Info_get_impl(info, "alloc_shm", MPI_MAX_INFO_VAL,
info_value, &info_flag);
if (info_flag) {
if (!strncmp(info_value, "true", sizeof("true")))
win->info_args.alloc_shm = TRUE;
if (!strncmp(info_value, "false", sizeof("false")))
win->info_args.alloc_shm = FALSE;
}
}
if (win->create_flavor == MPI_WIN_FLAVOR_DYNAMIC)
win->info_args.alloc_shm = FALSE;
/********************************************************/
/******* check for info alloc_shared_noncontig **********/
/********************************************************/
if (win->create_flavor == MPI_WIN_FLAVOR_ALLOCATE)
win->info_args.alloc_shared_noncontig = 1;
if (info != NULL) {
int info_flag = 0;
char info_value[MPI_MAX_INFO_VAL+1];
MPIR_Info_get_impl(info, "alloc_shared_noncontig", MPI_MAX_INFO_VAL,
info_value, &info_flag);
if (info_flag) {
if (!strncmp(info_value, "true", strlen("true")))
win->info_args.alloc_shared_noncontig = 1;
if (!strncmp(info_value, "false", strlen("false")))
win->info_args.alloc_shared_noncontig = 0;
}
}
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_WIN_SET_INFO);
......
......@@ -43,7 +43,7 @@ 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,
static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model, MPID_Info *info,
MPID_Comm * comm_ptr, MPID_Win ** win_ptr);
......@@ -110,22 +110,12 @@ int MPID_Win_create(void *base, MPI_Aint size, int disp_unit, MPID_Info * info,
}
mpi_errno =
win_init(size, disp_unit, MPI_WIN_FLAVOR_CREATE, MPI_WIN_UNIFIED, comm_ptr, win_ptr);
win_init(size, disp_unit, MPI_WIN_FLAVOR_CREATE, MPI_WIN_UNIFIED, info, comm_ptr, win_ptr);
if (mpi_errno)
MPIU_ERR_POP(mpi_errno);
(*win_ptr)->base = base;
/* FOR CREATE, alloc_shm info is default to set to FALSE */
(*win_ptr)->info_args.alloc_shm = FALSE;
if (info != NULL) {
int alloc_shm_flag = 0;
char shm_alloc_value[MPI_MAX_INFO_VAL+1];
MPIR_Info_get_impl(info, "alloc_shm", MPI_MAX_INFO_VAL, shm_alloc_value, &alloc_shm_flag);
if ((alloc_shm_flag == 1) && (!strncmp(shm_alloc_value, "true", sizeof("true"))))
(*win_ptr)->info_args.alloc_shm = TRUE;
}
mpi_errno = MPIDI_CH3U_Win_fns.create(base, size, disp_unit, info, comm_ptr, win_ptr);
if (mpi_errno)
MPIU_ERR_POP(mpi_errno);
......@@ -149,22 +139,11 @@ int MPID_Win_allocate(MPI_Aint size, int disp_unit, MPID_Info * info,
MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPID_WIN_ALLOCATE);
mpi_errno =
win_init(size, disp_unit, MPI_WIN_FLAVOR_ALLOCATE, MPI_WIN_UNIFIED, comm_ptr, win_ptr);
win_init(size, disp_unit, MPI_WIN_FLAVOR_ALLOCATE, MPI_WIN_UNIFIED, info, comm_ptr, win_ptr);
if (mpi_errno != MPI_SUCCESS) {
MPIU_ERR_POP(mpi_errno);
}
/* FOR ALLOCATE, alloc_shm info is default to set to TRUE */
(*win_ptr)->info_args.alloc_shm = TRUE;
if (info != NULL) {
int alloc_shm_flag = 0;
char shm_alloc_value[MPI_MAX_INFO_VAL + 1];
MPIR_Info_get_impl(info, "alloc_shm", MPI_MAX_INFO_VAL, shm_alloc_value, &alloc_shm_flag);
if ((alloc_shm_flag == 1) && (!strncmp(shm_alloc_value, "false", sizeof("false"))))
(*win_ptr)->info_args.alloc_shm = FALSE;
}
mpi_errno = MPIDI_CH3U_Win_fns.allocate(size, disp_unit, info, comm_ptr, baseptr, win_ptr);
if (mpi_errno != MPI_SUCCESS) {
MPIU_ERR_POP(mpi_errno);
......@@ -190,7 +169,7 @@ int MPID_Win_create_dynamic(MPID_Info * info, MPID_Comm * comm_ptr, MPID_Win **
mpi_errno = win_init(0 /* spec defines size to be 0 */ ,
1 /* spec defines disp_unit to be 1 */ ,
MPI_WIN_FLAVOR_DYNAMIC, MPI_WIN_UNIFIED, comm_ptr, win_ptr);
MPI_WIN_FLAVOR_DYNAMIC, MPI_WIN_UNIFIED, info, comm_ptr, win_ptr);
if (mpi_errno)
MPIU_ERR_POP(mpi_errno);
......@@ -263,22 +242,10 @@ int MPID_Win_allocate_shared(MPI_Aint size, int disp_unit, MPID_Info * info, MPI
MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPID_WIN_ALLOCATE_SHARED);
mpi_errno =
win_init(size, disp_unit, MPI_WIN_FLAVOR_SHARED, MPI_WIN_UNIFIED, comm_ptr, win_ptr);
win_init(size, disp_unit, MPI_WIN_FLAVOR_SHARED, MPI_WIN_UNIFIED, info, comm_ptr, win_ptr);
if (mpi_errno)
MPIU_ERR_POP(mpi_errno);
/* FOR ALLOCATE_SHARED, alloc_shm info is default to set to TRUE */
(*win_ptr)->info_args.alloc_shm = TRUE;
if (info != NULL) {
int alloc_shm_flag = 0;
char shm_alloc_value[MPI_MAX_INFO_VAL + 1];
MPIR_Info_get_impl(info, "alloc_shm", MPI_MAX_INFO_VAL, shm_alloc_value, &alloc_shm_flag);
/* if value of 'alloc_shm' info is not set to true, throw an error */
if (alloc_shm_flag == 1 && strncmp(shm_alloc_value, "true", sizeof("true")))
MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**infoval");
}
mpi_errno =
MPIDI_CH3U_Win_fns.allocate_shared(size, disp_unit, info, comm_ptr, base_ptr, win_ptr);
if (mpi_errno != MPI_SUCCESS)
......@@ -294,7 +261,7 @@ int MPID_Win_allocate_shared(MPI_Aint size, int disp_unit, MPID_Info * info, MPI
#define FUNCNAME win_init
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model, MPID_Info *info,
MPID_Comm * comm_ptr, MPID_Win ** win_ptr)
{
int mpi_errno = MPI_SUCCESS;
......@@ -369,6 +336,13 @@ static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
(*win_ptr)->info_args.alloc_shared_noncontig = 0;
(*win_ptr)->info_args.alloc_shm = FALSE;
/* Set function pointers on window */
MPID_WIN_FTABLE_SET_DEFAULTS(win_ptr);
/* Set info_args on window based on info provided by user */
mpi_errno = (*win_ptr)->RMAFns.Win_set_info((*win_ptr), info);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
MPIU_CHKPMEM_MALLOC((*win_ptr)->op_pool_start, MPIDI_RMA_Op_t *,
sizeof(MPIDI_RMA_Op_t) * MPIR_CVAR_CH3_RMA_OP_WIN_POOL_SIZE, mpi_errno,
"RMA op pool");
......@@ -410,8 +384,6 @@ static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
&((*win_ptr)->lock_entry_pool_start[i]));
}
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");
......
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