From e11f014c6e5d967e4f31218a6a7a9259c720ad61 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Wed, 14 Oct 2015 12:40:52 -0600 Subject: [PATCH] osc/rdma: fix segmentation fault when running 1 ppn This commit fixes an issue identified by @rolfv. The local peer was not being correctly initialized when running with a single process on a node. This fixes open-mpi/ompi#1010 Signed-off-by: Nathan Hjelm --- ompi/mca/osc/rdma/osc_rdma_component.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ompi/mca/osc/rdma/osc_rdma_component.c b/ompi/mca/osc/rdma/osc_rdma_component.c index 7c35ef70c3..1f89629cb1 100644 --- a/ompi/mca/osc/rdma/osc_rdma_component.c +++ b/ompi/mca/osc/rdma/osc_rdma_component.c @@ -407,7 +407,15 @@ static int allocate_state_single (ompi_osc_rdma_module_t *module, void **base, s module->free_after = module->rank_array; my_peer->flags |= OMPI_OSC_RDMA_PEER_LOCAL_BASE; my_peer->state = (uint64_t) (uintptr_t) module->state; - my_peer->state_handle = module->state_handle; + + if (module->selected_btl->btl_flags & MCA_BTL_ATOMIC_SUPPORTS_GLOB) { + /* all peers are local or it is safe to mix cpu and nic atomics */ + my_peer->flags |= OMPI_OSC_RDMA_PEER_LOCAL_STATE; + } else { + /* use my endpoint handle to modify the peer's state */ + my_peer->state_handle = module->state_handle; + my_peer->state_endpoint = ompi_osc_rdma_peer_btl_endpoint (module, my_rank); + } if (MPI_WIN_FLAVOR_DYNAMIC != module->flavor) { ompi_osc_rdma_peer_extended_t *ex_peer = (ompi_osc_rdma_peer_extended_t *) my_peer;