@@ -283,11 +283,9 @@ component_select(struct ompi_win_t *win, void **base, size_t size, ptrdiff_t dis
283283 if (module -> noncontig ) {
284284 opal_output_verbose (MCA_BASE_VERBOSE_DEBUG , ompi_osc_base_framework .framework_output ,
285285 "allocating window using non-contiguous strategy" );
286- total = ((size - 1 ) / pagesize + 1 ) * pagesize ;
287286 } else {
288287 opal_output_verbose (MCA_BASE_VERBOSE_DEBUG , ompi_osc_base_framework .framework_output ,
289288 "allocating window using contiguous strategy" );
290- total = size ;
291289 }
292290 ret = module -> comm -> c_coll -> coll_allgather (& total , 1 , MPI_UNSIGNED_LONG ,
293291 rbuf , 1 , MPI_UNSIGNED_LONG ,
@@ -301,6 +299,9 @@ component_select(struct ompi_win_t *win, void **base, size_t size, ptrdiff_t dis
301299 total = 0 ;
302300 for (i = 0 ; i < comm_size ; ++ i ) {
303301 total += rbuf [i ];
302+ if (module -> noncontig ) {
303+ total += OPAL_ALIGN_PAD_AMOUNT (total , pagesize );
304+ }
304305 }
305306
306307 /* user opal/shmem directly to create a shared memory segment */
@@ -378,6 +379,9 @@ component_select(struct ompi_win_t *win, void **base, size_t size, ptrdiff_t dis
378379 if (module -> sizes [i ] || !module -> noncontig ) {
379380 module -> bases [i ] = ((char * ) module -> segment_base ) + total ;
380381 total += rbuf [i ];
382+ if (module -> noncontig ) {
383+ total += OPAL_ALIGN_PAD_AMOUNT (total , pagesize );
384+ }
381385 } else {
382386 module -> bases [i ] = NULL ;
383387 }
0 commit comments