47
47
#include "opal/util/argv.h"
48
48
#include "opal/util/printf.h"
49
49
#include "opal/align.h"
50
+ #include "opal/util/sys_limits.h"
50
51
#if OPAL_CUDA_SUPPORT
51
52
#include "opal/datatype/opal_datatype_cuda.h"
52
53
#endif /* OPAL_CUDA_SUPPORT */
@@ -550,6 +551,7 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s
550
551
ompi_osc_rdma_region_t * state_region ;
551
552
struct _local_data * temp ;
552
553
char * data_file ;
554
+ int page_size = opal_getpagesize ();
553
555
554
556
shared_comm = module -> shared_comm ;
555
557
@@ -575,9 +577,9 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s
575
577
data_base = state_base + leader_peer_data_size + module -> state_size * local_size ;
576
578
577
579
/* ensure proper alignment */
578
- data_base += OPAL_ALIGN_PAD_AMOUNT (data_base , OPAL_ALIGN_MIN );
579
580
if (MPI_WIN_FLAVOR_ALLOCATE == module -> flavor ) {
580
- size += OPAL_ALIGN_PAD_AMOUNT (size , OPAL_ALIGN_MIN );
581
+ data_base += OPAL_ALIGN_PAD_AMOUNT (data_base , page_size );
582
+ size += OPAL_ALIGN_PAD_AMOUNT (size , page_size );
581
583
}
582
584
583
585
do {
@@ -648,8 +650,12 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s
648
650
}
649
651
650
652
if (size && MPI_WIN_FLAVOR_ALLOCATE == module -> flavor ) {
651
- * base = (void * )((intptr_t ) module -> segment_base + my_base_offset );
652
- memset (* base , 0 , size );
653
+ char * baseptr = (char * )((intptr_t ) module -> segment_base + my_base_offset );
654
+ * base = (void * )baseptr ;
655
+ // touch each page to force allocation on local NUMA node
656
+ for (size_t i = 0 ; i < size ; i += page_size ) {
657
+ baseptr [i ] = 0 ;
658
+ }
653
659
}
654
660
655
661
module -> rank_array = (ompi_osc_rdma_rank_data_t * ) module -> segment_base ;
0 commit comments