Commit ea9d14fb authored by Min Si's avatar Min Si
Browse files

Add info check to avoid unnecessary SHM detection.



If user does not explicitly set alloc_shm to TRUE in win_create, we
should never detect SHM windows because of expensive overhead. However,
current code does not check this info flag. This patch fixed it.

Closes #2161
Signed-off-by: default avatarXin Zhao <xinzhao3@illinois.edu>
parent 722d85a4
......@@ -127,7 +127,8 @@ int MPIDI_CH3U_Win_create(void *base, MPI_Aint size, int disp_unit, MPID_Info *i
mpi_errno = MPIDI_CH3U_Win_create_gather(base, size, disp_unit, info, comm_ptr, win_ptr);
if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_POP(mpi_errno); }
if (MPIDI_CH3U_Win_fns.detect_shm != NULL) {
if ((*win_ptr)->info_args.alloc_shm == TRUE
&& MPIDI_CH3U_Win_fns.detect_shm != NULL) {
/* Detect if shared buffers are specified for the processes in the
* current node. If so, enable shm RMA.*/
mpi_errno = MPIDI_CH3U_Win_fns.detect_shm(win_ptr);
......
......@@ -104,6 +104,16 @@ int MPID_Win_create(void *base, MPI_Aint size, int disp_unit, MPID_Info * info,
(*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);
......
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