1
1

opal/mca/memory: add a memoryc_set_alignment subroutine to the OPAL memory MCA

this commit also (partially) reverts :
 - open-mpi/ompi@7de01b347c
 - open-mpi/ompi@8b05f308f9
Этот коммит содержится в:
Gilles Gouaillardet 2016-02-18 10:24:57 +09:00
родитель 2c4b93f72b
Коммит d8482ce6f4
7 изменённых файлов: 46 добавлений и 4 удалений

@ -98,7 +98,7 @@
#endif #endif
#include "ompi/runtime/ompi_cr.h" #include "ompi/runtime/ompi_cr.h"
#if defined(MEMORY_LINUX_PTMALLOC2) && MEMORY_LINUX_PTMALLOC2 && MEMORY_LINUX_HAVE_MALLOC_HOOK_SUPPORT #if defined(MEMORY_LINUX_PTMALLOC2) && MEMORY_LINUX_PTMALLOC2
#include "opal/mca/memory/linux/memory_linux.h" #include "opal/mca/memory/linux/memory_linux.h"
/* So this sucks, but with OPAL in its own library that is brought in /* So this sucks, but with OPAL in its own library that is brought in
implicity from libmpi, there are times when the malloc initialize implicity from libmpi, there are times when the malloc initialize
@ -106,7 +106,7 @@
from here, since any MPI code is going to call MPI_Init... */ from here, since any MPI code is going to call MPI_Init... */
OPAL_DECLSPEC void (*__malloc_initialize_hook) (void) = OPAL_DECLSPEC void (*__malloc_initialize_hook) (void) =
opal_memory_linux_malloc_init_hook; opal_memory_linux_malloc_init_hook;
#endif /* defined(MEMORY_LINUX_PTMALLOC2) && MEMORY_LINUX_PTMALLOC2 && MEMORY_LINUX_HAVE_MALLOC_HOOK_SUPPORT */ #endif /* defined(MEMORY_LINUX_PTMALLOC2) && MEMORY_LINUX_PTMALLOC2 */
/* This is required for the boundaries of the hash tables used to store /* This is required for the boundaries of the hash tables used to store
* the F90 types returned by the MPI_Type_create_f90_XXX functions. * the F90 types returned by the MPI_Type_create_f90_XXX functions.

@ -1,5 +1,7 @@
/* /*
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -51,6 +53,15 @@ OPAL_DECLSPEC int opal_memory_base_component_deregister_empty(void *start,
size_t len, size_t len,
uint64_t cookie); uint64_t cookie);
/**
* Default (empty) implementation of the memoryc_set_alignment function
*
* See opal/mca/memory/memory.h for a description of the parameters.
*/
OPAL_DECLSPEC void opal_memory_base_component_set_alignment_empty(int use_memalign,
size_t memalign_threshold);
END_C_DECLS END_C_DECLS
#endif #endif

@ -9,6 +9,8 @@
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -34,3 +36,9 @@ int opal_memory_base_component_deregister_empty(void *base, size_t len,
{ {
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
void opal_memory_base_component_set_alignment_empty(int use_memalign,
size_t memalign_threshold)
{
}

@ -11,6 +11,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -54,6 +56,7 @@ static opal_memory_base_component_2_0_0_t empty_component = {
empty_process, empty_process,
opal_memory_base_component_register_empty, opal_memory_base_component_register_empty,
opal_memory_base_component_deregister_empty, opal_memory_base_component_deregister_empty,
opal_memory_base_component_set_alignment_empty,
}; };

@ -13,6 +13,8 @@
* Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -96,6 +98,11 @@ opal_memory_linux_component_t mca_memory_linux_component = {
end up using ummunotify support. */ end up using ummunotify support. */
.memoryc_register = opal_memory_base_component_register_empty, .memoryc_register = opal_memory_base_component_register_empty,
.memoryc_deregister = opal_memory_base_component_deregister_empty, .memoryc_deregister = opal_memory_base_component_deregister_empty,
#if MEMORY_LINUX_MALLOC_ALIGN_ENABLED
.memoryc_set_alignment = opal_memory_linux_malloc_set_alignment,
#else
.memoryc_set_alignment = opal_memory_base_component_set_alignment_empty,
#endif
}, },
/* Component-specific data, filled in later (compiler will 0/NULL /* Component-specific data, filled in later (compiler will 0/NULL

@ -14,6 +14,8 @@
* Copyright (c) 2009-2011 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2009-2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -68,6 +70,7 @@ const opal_memory_base_component_2_0_0_t mca_memory_malloc_solaris_component = {
provide safe/empty register/deregister functions to call */ provide safe/empty register/deregister functions to call */
.memoryc_register = opal_memory_base_component_register_empty, .memoryc_register = opal_memory_base_component_register_empty,
.memoryc_deregister = opal_memory_base_component_deregister_empty, .memoryc_deregister = opal_memory_base_component_deregister_empty,
.memoryc_set_alignment = opal_memory_base_component_set_alignment_empty,
}; };
/* /*

@ -13,6 +13,8 @@
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -92,7 +94,7 @@ typedef int (*opal_memory_base_component_register_fn_t)(void *base,
/** /**
* Prototype for a function that is the opposite of * Prototype for a function that is the opposite of
* opal_memory_base_component_register_fn_t: this function is invoked * opal_memory_base_component_register_fn_t: this function is invoked
* when Open MPI stops to "caring" about a specific memory region. * when Open MPI stops to "caring" about a specific memory region.
* That is, Open MPI declares that it no longer wants to be notified * That is, Open MPI declares that it no longer wants to be notified
@ -111,6 +113,12 @@ typedef int (*opal_memory_base_component_deregister_fn_t)(void *base,
uint64_t cookie); uint64_t cookie);
/**
* Prototype for a function that set the memory alignment
*/
typedef void (*opal_memory_base_component_set_alignment_fn_t)(int use_memalign,
size_t memalign_threshold);
/** /**
* Structure for memory components. * Structure for memory components.
*/ */
@ -132,6 +140,8 @@ typedef struct opal_memory_base_component_2_0_0_t {
/** Function invoked when Open MPI stops "caring" about a /** Function invoked when Open MPI stops "caring" about a
specific memory region */ specific memory region */
opal_memory_base_component_deregister_fn_t memoryc_deregister; opal_memory_base_component_deregister_fn_t memoryc_deregister;
/** Function invoked in order to set malloc'ed memory alignment */
opal_memory_base_component_set_alignment_fn_t memoryc_set_alignment;
} opal_memory_base_component_2_0_0_t; } opal_memory_base_component_2_0_0_t;
OPAL_DECLSPEC extern opal_memory_base_component_2_0_0_t *opal_memory; OPAL_DECLSPEC extern opal_memory_base_component_2_0_0_t *opal_memory;