@@ -620,6 +620,7 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s
620
620
621
621
if (size && MPI_WIN_FLAVOR_ALLOCATE == module -> flavor ) {
622
622
* base = (void * )((intptr_t ) module -> segment_base + my_base_offset );
623
+ memset (* base , 0 , size );
623
624
}
624
625
625
626
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
633
634
/* initialize my state */
634
635
memset (module -> state , 0 , module -> state_size );
635
636
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
+
636
640
if (0 == local_rank ) {
641
+ /* unlink the shared memory backing file */
642
+ opal_shmem_unlink (& module -> seg_ds );
637
643
/* just go ahead and register the whole segment */
638
644
ret = ompi_osc_rdma_register (module , MCA_BTL_ENDPOINT_ANY , module -> segment_base , total_size , MCA_BTL_REG_FLAG_ACCESS_ANY ,
639
645
& module -> state_handle );
@@ -654,14 +660,6 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s
654
660
}
655
661
}
656
662
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
-
665
663
if (MPI_WIN_FLAVOR_ALLOCATE == module -> flavor ) {
666
664
ompi_osc_rdma_region_t * region = (ompi_osc_rdma_region_t * ) module -> state -> regions ;
667
665
module -> state -> disp_unit = module -> disp_unit ;
0 commit comments