Skip to content

Commit 3ac45e0

Browse files
committed
osc/portals4: add support for mpi_minimum_memory_alignment info key
Signed-off-by: Joseph Schuchart <schuchart@hlrs.de>
1 parent 06d0887 commit 3ac45e0

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

ompi/mca/osc/portals4/osc_portals4_component.c

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
* reserved.
1111
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
1212
* 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.
1315
* $COPYRIGHT$
1416
*
1517
* Additional copyrights may follow
@@ -20,6 +22,8 @@
2022
#include "ompi_config.h"
2123

2224
#include "opal/util/printf.h"
25+
#include "opal/include/opal/align.h"
26+
#include "opal/mca/mpool/base/base.h"
2327

2428
#include "ompi/mca/osc/base/base.h"
2529
#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
384388
{
385389
ompi_osc_portals4_module_t *module = NULL;
386390
int ret = OMPI_ERROR;
387-
int tmp;
391+
int tmp, flag;
388392
ptl_md_t md;
389393
ptl_me_t me;
390394
char *name;
395+
size_t memory_alignment = OPAL_ALIGN_MIN;
391396

392397
if (MPI_WIN_FLAVOR_SHARED == flavor) return OMPI_ERR_NOT_SUPPORTED;
393398

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+
394412
/* create module structure */
395413
module = (ompi_osc_portals4_module_t*)
396414
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
402420

403421
/* fill in our part */
404422
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);
406425
if (NULL == *base) goto error;
426+
module->free_after = *base;
407427
} else {
408428
module->free_after = NULL;
409429
}
@@ -646,7 +666,8 @@ ompi_osc_portals4_free(struct ompi_win_t *win)
646666
PtlCTFree(module->ct_h);
647667
if (NULL != module->disp_units) free(module->disp_units);
648668
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);
650671

651672
if (!opal_list_is_empty(&module->outstanding_locks)) {
652673
ret = OMPI_ERR_RMA_SYNC;

0 commit comments

Comments
 (0)