@@ -620,6 +620,7 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s
620620
621621 if (size && MPI_WIN_FLAVOR_ALLOCATE == module -> flavor ) {
622622 * base = (void * )((intptr_t ) module -> segment_base + my_base_offset );
623+ memset (* base , 0 , size );
623624 }
624625
625626 module -> rank_array = (ompi_osc_rdma_rank_data_t * ) module -> segment_base ;
@@ -633,7 +634,12 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s
633634 /* initialize my state */
634635 memset (module -> state , 0 , module -> state_size );
635636
637+ /* barrier to make sure all ranks have attached and initialized */
638+ shared_comm -> c_coll -> coll_barrier (shared_comm , shared_comm -> c_coll -> coll_barrier_module );
639+
636640 if (0 == local_rank ) {
641+ /* unlink the shared memory backing file */
642+ opal_shmem_unlink (& module -> seg_ds );
637643 /* just go ahead and register the whole segment */
638644 ret = ompi_osc_rdma_register (module , MCA_BTL_ENDPOINT_ANY , module -> segment_base , total_size , MCA_BTL_REG_FLAG_ACCESS_ANY ,
639645 & module -> state_handle );
@@ -654,14 +660,6 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s
654660 }
655661 }
656662
657- /* barrier to make sure all ranks have attached */
658- shared_comm -> c_coll -> coll_barrier (shared_comm , shared_comm -> c_coll -> coll_barrier_module );
659-
660- /* unlink the shared memory backing file */
661- if (0 == local_rank ) {
662- opal_shmem_unlink (& module -> seg_ds );
663- }
664-
665663 if (MPI_WIN_FLAVOR_ALLOCATE == module -> flavor ) {
666664 ompi_osc_rdma_region_t * region = (ompi_osc_rdma_region_t * ) module -> state -> regions ;
667665 module -> state -> disp_unit = module -> disp_unit ;
0 commit comments