10
10
* reserved.
11
11
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
12
12
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
13
+ * Copyright (c) 2020 High Performance Computing Center Stuttgart,
14
+ * University of Stuttgart. All rights reserved.
13
15
* $COPYRIGHT$
14
16
*
15
17
* Additional copyrights may follow
20
22
#include "ompi_config.h"
21
23
22
24
#include "opal/util/printf.h"
25
+ #include "opal/include/opal/align.h"
26
+ #include "opal/mca/mpool/base/base.h"
23
27
24
28
#include "ompi/mca/osc/base/base.h"
25
29
#include "ompi/mca/osc/base/osc_base_obj_convert.h"
@@ -384,13 +388,27 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit
384
388
{
385
389
ompi_osc_portals4_module_t * module = NULL ;
386
390
int ret = OMPI_ERROR ;
387
- int tmp ;
391
+ int tmp , flag ;
388
392
ptl_md_t md ;
389
393
ptl_me_t me ;
390
394
char * name ;
395
+ size_t memory_alignment = OPAL_ALIGN_MIN ;
391
396
392
397
if (MPI_WIN_FLAVOR_SHARED == flavor ) return OMPI_ERR_NOT_SUPPORTED ;
393
398
399
+ if (NULL != info ) {
400
+ opal_cstring_t * align_info_str ;
401
+ opal_info_get (info , "mpi_minimum_memory_alignment" ,
402
+ & align_info_str , & flag );
403
+ if (flag ) {
404
+ ssize_t tmp_align = atoll (infoval );
405
+ OBJ_RELEASE (align_info_str );
406
+ if (OPAL_ALIGN_MIN < tmp_align ) {
407
+ memory_alignment = tmp_align ;
408
+ }
409
+ }
410
+ }
411
+
394
412
/* create module structure */
395
413
module = (ompi_osc_portals4_module_t * )
396
414
calloc (1 , sizeof (ompi_osc_portals4_module_t ));
@@ -402,8 +420,10 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit
402
420
403
421
/* fill in our part */
404
422
if (MPI_WIN_FLAVOR_ALLOCATE == flavor ) {
405
- module -> free_after = * base = malloc (size );
423
+ * base = mca_mpool_base_default_module -> mpool_alloc (mca_mpool_base_default_module , size ,
424
+ memory_alignment , 0 );
406
425
if (NULL == * base ) goto error ;
426
+ module -> free_after = * base ;
407
427
} else {
408
428
module -> free_after = NULL ;
409
429
}
@@ -646,7 +666,8 @@ ompi_osc_portals4_free(struct ompi_win_t *win)
646
666
PtlCTFree (module -> ct_h );
647
667
if (NULL != module -> disp_units ) free (module -> disp_units );
648
668
ompi_comm_free (& module -> comm );
649
- if (NULL != module -> free_after ) free (module -> free_after );
669
+ mca_mpool_base_default_module -> mpool_free (mca_mpool_base_default_module ,
670
+ module -> free_after );
650
671
651
672
if (!opal_list_is_empty (& module -> outstanding_locks )) {
652
673
ret = OMPI_ERR_RMA_SYNC ;
0 commit comments