Skip to content

Commit 593920a

Browse files
authored
Merge pull request #5925 from hjelmn/v3.0.x_osc_rdma_really_needs_to_do_first_touch_before_registration_to_ensure_memory_locality
v3.0.x: RDMA OSC: initialize segment memory before registering the segment
2 parents 521f04d + 4f435e8 commit 593920a

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

ompi/mca/osc/rdma/osc_rdma_component.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)