From e453e4227997ebf96fe67a9ccfc3ed8e64629ca4 Mon Sep 17 00:00:00 2001 From: KAWASHIMA Takahiro Date: Mon, 8 May 2017 20:28:51 +0900 Subject: [PATCH] group: Fix `ompi_group_have_remote_peers` `ompi_group_t::grp_proc_pointers[i]` may have sentinel values even for processes which reside in the local node because the array for `MPI_COMM_WORLD` is set up before `ompi_proc_complete_init`, which allocates `ompi_proc_t` objects for processes reside in the local node, is called in `MPI_INIT`. So using `ompi_proc_is_sentinel` against `ompi_group_t::grp_proc_pointers[i]` in order to determine whether the process resides in a remote node is not appropriate. This bug sometimes causes an `MPI_ERR_RMA_SHARED` error when `MPI_WIN_ALLOCATE_SHARED` is called, where sm OSC uses `ompi_group_have_remote_peers`. Signed-off-by: KAWASHIMA Takahiro --- ompi/group/group.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ompi/group/group.c b/ompi/group/group.c index dc8c4d49e6..f5cc88be98 100644 --- a/ompi/group/group.c +++ b/ompi/group/group.c @@ -563,10 +563,13 @@ bool ompi_group_have_remote_peers (ompi_group_t *group) #if OMPI_GROUP_SPARSE proc = ompi_group_peer_lookup (group, i); #else - if (ompi_proc_is_sentinel (group->grp_proc_pointers[i])) { + proc = ompi_group_get_proc_ptr_raw (group, i); + if (ompi_proc_is_sentinel (proc)) { + /* the proc must be stored in the group or cached in the proc + * hash table if the process resides in the local node + * (see ompi_proc_complete_init) */ return true; } - proc = group->grp_proc_pointers[i]; #endif if (!OPAL_PROC_ON_LOCAL_NODE(proc->super.proc_flags)) { return true;