From 4f435e81699d8bd3ad3db92e9779c387e172c5e0 Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Tue, 16 Oct 2018 14:25:56 -0400 Subject: [PATCH] RDMA OSC: initialize segment memory before registering the segment Signed-off-by: Joseph Schuchart (cherry picked from commit d9dcdfdfbaf12884e785edd8d98559cf2cdfaace) Signed-off-by: Nathan Hjelm --- ompi/mca/osc/rdma/osc_rdma_component.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ompi/mca/osc/rdma/osc_rdma_component.c b/ompi/mca/osc/rdma/osc_rdma_component.c index 52938389c8b..fc79bae8529 100644 --- a/ompi/mca/osc/rdma/osc_rdma_component.c +++ b/ompi/mca/osc/rdma/osc_rdma_component.c @@ -586,6 +586,7 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s if (size && MPI_WIN_FLAVOR_ALLOCATE == module->flavor) { *base = (void *)((intptr_t) module->segment_base + my_base_offset); + memset (*base, 0, size); } module->rank_array = (ompi_osc_rdma_rank_data_t *) module->segment_base; @@ -599,7 +600,12 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s /* initialize my state */ memset (module->state, 0, module->state_size); + /* barrier to make sure all ranks have attached and initialized */ + shared_comm->c_coll->coll_barrier(shared_comm, shared_comm->c_coll->coll_barrier_module); + if (0 == local_rank) { + /* unlink the shared memory backing file */ + opal_shmem_unlink (&module->seg_ds); /* just go ahead and register the whole segment */ ret = ompi_osc_rdma_register (module, MCA_BTL_ENDPOINT_ANY, module->segment_base, total_size, MCA_BTL_REG_FLAG_ACCESS_ANY, &module->state_handle); @@ -620,14 +626,6 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s } } - /* barrier to make sure all ranks have attached */ - shared_comm->c_coll->coll_barrier(shared_comm, shared_comm->c_coll->coll_barrier_module); - - /* unlink the shared memory backing file */ - if (0 == local_rank) { - opal_shmem_unlink (&module->seg_ds); - } - if (MPI_WIN_FLAVOR_ALLOCATE == module->flavor) { ompi_osc_rdma_region_t *region = (ompi_osc_rdma_region_t *) module->state->regions; module->state->disp_unit = module->disp_unit;