@@ -586,6 +586,7 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s
586586
587587        if  (size  &&  MPI_WIN_FLAVOR_ALLOCATE  ==  module -> flavor ) {
588588            * base  =  (void  * )((intptr_t ) module -> segment_base  +  my_base_offset );
589+             memset  (* base , 0 , size );
589590        }
590591
591592        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
599600        /* initialize my state */ 
600601        memset  (module -> state , 0 , module -> state_size );
601602
603+         /* barrier to make sure all ranks have attached and initialized */ 
604+         shared_comm -> c_coll -> coll_barrier (shared_comm , shared_comm -> c_coll -> coll_barrier_module );
605+ 
602606        if  (0  ==  local_rank ) {
607+             /* unlink the shared memory backing file */ 
608+             opal_shmem_unlink  (& module -> seg_ds );
603609            /* just go ahead and register the whole segment */ 
604610            ret  =  ompi_osc_rdma_register  (module , MCA_BTL_ENDPOINT_ANY , module -> segment_base , total_size , MCA_BTL_REG_FLAG_ACCESS_ANY ,
605611                                          & module -> state_handle );
@@ -620,14 +626,6 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s
620626            }
621627        }
622628
623-         /* barrier to make sure all ranks have attached */ 
624-         shared_comm -> c_coll -> coll_barrier (shared_comm , shared_comm -> c_coll -> coll_barrier_module );
625- 
626-         /* unlink the shared memory backing file */ 
627-         if  (0  ==  local_rank ) {
628-             opal_shmem_unlink  (& module -> seg_ds );
629-         }
630- 
631629        if  (MPI_WIN_FLAVOR_ALLOCATE  ==  module -> flavor ) {
632630            ompi_osc_rdma_region_t  * region  =  (ompi_osc_rdma_region_t  * ) module -> state -> regions ;
633631            module -> state -> disp_unit  =  module -> disp_unit ;
0 commit comments