Skip to content

Commit

Permalink
Merge pull request #6899 from hzhou/2402_win_query
Browse files Browse the repository at this point in the history
ch4: fix MPI_Win_shared_query when it is not shared

Approved-by: Ken Raffenetti
  • Loading branch information
hzhou authored Feb 9, 2024
2 parents 8af3921 + f5b4d31 commit 7953471
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions src/mpid/ch4/src/mpidig_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -593,28 +593,14 @@ MPL_STATIC_INLINE_PREFIX int MPIDIG_mpi_win_shared_query(MPIR_Win * win, int ran

MPIR_FUNC_ENTER;

bool whole_shared = false;
if (win->comm_ptr->node_comm == NULL) {
whole_shared = (win->comm_ptr->local_size == 1);
} else {
whole_shared = (win->comm_ptr->local_size == win->comm_ptr->node_comm->local_size);
}

if (!whole_shared) {
if (win->comm_ptr->node_comm == NULL) {
mpi_errno = MPIDIG_win_shared_query_self(win, rank, size, disp_unit, baseptr);
} else {
mpi_errno = MPIDIG_win_shared_query_part(win, rank, size, disp_unit, baseptr);
}
if (!shared_table || win->comm_ptr->node_comm == NULL) {
mpi_errno = MPIDIG_win_shared_query_self(win, rank, size, disp_unit, baseptr);
goto fn_exit;
}

/* When only single process exists on the node or shared memory allocation fails,
* should only query MPI_PROC_NULL or local process. Thus, return local window's info. */
if (win->comm_ptr->node_comm == NULL || !shared_table) {
*size = win->size;
*disp_unit = win->disp_unit;
*((void **) baseptr) = win->base;
bool whole_shared = (win->comm_ptr->local_size == win->comm_ptr->node_comm->local_size);
if (!whole_shared) {
mpi_errno = MPIDIG_win_shared_query_part(win, rank, size, disp_unit, baseptr);
goto fn_exit;
}

Expand Down

0 comments on commit 7953471

Please sign in to comment.