2013-11-18 08:58:37 +04:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
2015-02-19 23:41:41 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
|
|
|
* Copyright (c) 2011 NVIDIA Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
|
|
|
* reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
2004-06-15 23:07:45 +04:00
|
|
|
/**
|
|
|
|
* @file
|
2004-07-13 00:05:29 +04:00
|
|
|
* Description of the Memory Pool framework
|
2004-06-15 23:07:45 +04:00
|
|
|
*/
|
|
|
|
#ifndef MCA_MPOOL_H
|
|
|
|
#define MCA_MPOOL_H
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
#include "opal_config.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal/mca/mca.h"
|
2015-02-19 23:41:41 +03:00
|
|
|
#include "opal/class/opal_free_list.h"
|
2015-11-02 22:07:08 +03:00
|
|
|
#include "opal/mca/rcache/base/rcache_base_vma.h"
|
2005-06-23 19:53:51 +04:00
|
|
|
|
2007-03-17 02:11:45 +03:00
|
|
|
#include "opal/mca/crs/crs.h"
|
|
|
|
#include "opal/mca/crs/base/base.h"
|
|
|
|
|
2015-11-02 22:07:08 +03:00
|
|
|
#define MCA_MPOOL_ALLOC_FLAG_DEFAULT 0x00
|
|
|
|
#define MCA_MPOOL_ALLOC_FLAG_USER 0x01
|
2013-11-18 08:58:37 +04:00
|
|
|
|
2015-11-02 22:07:08 +03:00
|
|
|
#define MCA_MPOOL_FLAGS_MPI_ALLOC_MEM 0x80
|
2005-06-25 01:12:38 +04:00
|
|
|
|
2015-11-02 22:07:08 +03:00
|
|
|
struct opal_info_t;
|
|
|
|
struct mca_mpool_base_module_t;
|
|
|
|
typedef struct mca_mpool_base_module_t mca_mpool_base_module_t;
|
2004-06-15 23:07:45 +04:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
/**
|
2015-11-02 22:07:08 +03:00
|
|
|
* component query function
|
|
|
|
*
|
|
|
|
* @param[in] hints memory pool hints in order of priority. this should
|
|
|
|
* be replaced by opal_info_t when the work to move
|
|
|
|
* info down to opal is complete.
|
|
|
|
* @param[out] priority relative priority of this memory pool component
|
|
|
|
* @param[out] module best match module
|
|
|
|
*
|
|
|
|
* This function should parse the provided hints and return a relative priority
|
|
|
|
* of the component based on the number of hints matched. For example, if the
|
|
|
|
* hints are "page_size=2M,high-bandwidth" and a pool matches the page_size but
|
|
|
|
* not the high-bandwidth hint then the component should return a lower priority
|
|
|
|
* than if both matched but a higher priority than if a pool matches only the
|
|
|
|
* high-bandwidth hint.
|
|
|
|
*
|
|
|
|
* Memory pools should try to support at a minimum name=value but can define
|
|
|
|
* any additional keys.
|
2004-08-02 04:24:22 +04:00
|
|
|
*/
|
2015-11-02 22:07:08 +03:00
|
|
|
typedef int (*mca_mpool_base_component_query_fn_t) (const char *hints, int *priority,
|
|
|
|
mca_mpool_base_module_t **module);
|
2004-06-18 00:57:47 +04:00
|
|
|
|
2004-06-15 23:07:45 +04:00
|
|
|
/**
|
|
|
|
* allocate function typedef
|
|
|
|
*/
|
2015-11-02 22:07:08 +03:00
|
|
|
typedef void *(*mca_mpool_base_module_alloc_fn_t) (mca_mpool_base_module_t *mpool,
|
|
|
|
size_t size, size_t align,
|
|
|
|
uint32_t flags);
|
2015-06-24 06:59:57 +03:00
|
|
|
|
2004-06-15 23:07:45 +04:00
|
|
|
/**
|
2015-11-02 22:07:08 +03:00
|
|
|
* allocate function typedef
|
2004-06-15 23:07:45 +04:00
|
|
|
*/
|
2015-11-02 22:07:08 +03:00
|
|
|
typedef void *(*mca_mpool_base_module_realloc_fn_t) (mca_mpool_base_module_t *mpool,
|
|
|
|
void *addr, size_t size);
|
2015-06-24 06:59:57 +03:00
|
|
|
|
2004-06-15 23:07:45 +04:00
|
|
|
/**
|
|
|
|
* free function typedef
|
|
|
|
*/
|
2015-11-02 22:07:08 +03:00
|
|
|
typedef void (*mca_mpool_base_module_free_fn_t) (mca_mpool_base_module_t *mpool,
|
|
|
|
void *addr);
|
2006-12-17 15:26:41 +03:00
|
|
|
|
2005-06-21 21:10:28 +04:00
|
|
|
/**
|
|
|
|
* if appropriate - returns base address of memory pool
|
|
|
|
*/
|
2015-11-02 22:07:08 +03:00
|
|
|
typedef void* (*mca_mpool_base_module_address_fn_t) (mca_mpool_base_module_t *mpool);
|
2004-06-16 19:41:29 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* finalize
|
|
|
|
*/
|
2015-11-02 22:07:08 +03:00
|
|
|
typedef void (*mca_mpool_base_module_finalize_fn_t)(mca_mpool_base_module_t *mpool);
|
2004-06-15 23:07:45 +04:00
|
|
|
|
2004-06-16 19:41:29 +04:00
|
|
|
|
2007-03-17 02:11:45 +03:00
|
|
|
/**
|
|
|
|
* Fault Tolerance Event Notification Function
|
|
|
|
* @param state Checkpoint Stae
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
* @return OPAL_SUCCESS or failure status
|
2007-03-17 02:11:45 +03:00
|
|
|
*/
|
|
|
|
typedef int (*mca_mpool_base_module_ft_event_fn_t)(int state);
|
|
|
|
|
|
|
|
|
2004-07-13 00:05:29 +04:00
|
|
|
/**
|
|
|
|
* mpool component descriptor. Contains component version information
|
|
|
|
* and open/close/init functions.
|
|
|
|
*/
|
2008-07-29 02:40:57 +04:00
|
|
|
struct mca_mpool_base_component_2_0_0_t {
|
2015-11-02 22:07:08 +03:00
|
|
|
mca_base_component_t mpool_version; /**< version */
|
|
|
|
mca_base_component_data_t mpool_data;/**< metadata */
|
2004-08-02 04:24:22 +04:00
|
|
|
|
2015-11-02 22:07:08 +03:00
|
|
|
mca_mpool_base_component_query_fn_t mpool_query; /**< query for matching pools */
|
2004-06-16 19:41:29 +04:00
|
|
|
};
|
2004-07-13 00:05:29 +04:00
|
|
|
/**
|
|
|
|
* Convenience typedef.
|
|
|
|
*/
|
2008-07-29 02:40:57 +04:00
|
|
|
typedef struct mca_mpool_base_component_2_0_0_t mca_mpool_base_component_2_0_0_t;
|
2004-07-13 00:05:29 +04:00
|
|
|
/**
|
|
|
|
* Convenience typedef
|
|
|
|
*/
|
2008-07-29 02:40:57 +04:00
|
|
|
typedef struct mca_mpool_base_component_2_0_0_t mca_mpool_base_component_t;
|
2004-06-16 19:41:29 +04:00
|
|
|
|
|
|
|
/**
|
2004-08-17 03:06:33 +04:00
|
|
|
* mpool module descriptor. Contains the interface functions exported
|
|
|
|
* by the component. This does not expose memory management
|
|
|
|
* details.
|
2004-06-16 19:41:29 +04:00
|
|
|
*/
|
2004-08-02 04:24:22 +04:00
|
|
|
struct mca_mpool_base_module_t {
|
2015-11-02 22:07:08 +03:00
|
|
|
mca_mpool_base_component_t *mpool_component; /**< component stuct */
|
2004-08-02 04:24:22 +04:00
|
|
|
mca_mpool_base_module_address_fn_t mpool_base; /**< returns the base address */
|
|
|
|
mca_mpool_base_module_alloc_fn_t mpool_alloc; /**< allocate function */
|
|
|
|
mca_mpool_base_module_realloc_fn_t mpool_realloc; /**< reallocate function */
|
|
|
|
mca_mpool_base_module_free_fn_t mpool_free; /**< free function */
|
2015-11-02 22:07:08 +03:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
mca_mpool_base_module_finalize_fn_t mpool_finalize; /**< finalize */
|
2007-03-17 02:11:45 +03:00
|
|
|
mca_mpool_base_module_ft_event_fn_t mpool_ft_event; /**< ft_event */
|
2005-09-17 02:22:03 +04:00
|
|
|
uint32_t flags; /**< mpool flags */
|
2015-11-02 22:07:08 +03:00
|
|
|
|
|
|
|
size_t mpool_allocation_unit; /**< allocation unit used by this mpool */
|
|
|
|
char *mpool_name; /**< name of this pool module */
|
2004-06-15 23:07:45 +04:00
|
|
|
};
|
|
|
|
|
2005-06-25 01:12:38 +04:00
|
|
|
|
2005-05-31 23:07:27 +04:00
|
|
|
/**
|
|
|
|
* Function to allocate special memory according to what the user requests in
|
|
|
|
* the info object.
|
|
|
|
*
|
|
|
|
* If the user passes in a valid info structure then the function will
|
|
|
|
* try to allocate the memory and register it with every mpool that there is a
|
|
|
|
* key for it in the info struct. If it fails at registering the memory with
|
|
|
|
* one of the requested mpools, an error will be returned. Also, if there is a
|
|
|
|
* key in info that does not match any mpool, an error will be returned.
|
|
|
|
*
|
|
|
|
* If the info parameter is MPI_INFO_NULL, then this function will try to allocate
|
|
|
|
* the memory and register it wih as many mpools as possible. However,
|
|
|
|
* if any of the registratons fail the mpool will simply be ignored.
|
|
|
|
*
|
|
|
|
* @param size the size of the memory area to allocate
|
|
|
|
* @param info an info object which tells us what kind of memory to allocate
|
|
|
|
*
|
|
|
|
* @retval pointer to the allocated memory
|
|
|
|
* @retval NULL on failure
|
|
|
|
*/
|
2015-11-02 22:07:08 +03:00
|
|
|
OPAL_DECLSPEC void * mca_mpool_base_alloc(size_t size, struct opal_info_t * info, const char *hints);
|
2005-05-31 23:07:27 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function to free memory previously allocated by mca_mpool_base_alloc
|
|
|
|
*
|
|
|
|
* @param base pointer to the memory to free
|
|
|
|
*
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
* @retval OPAL_SUCCESS
|
|
|
|
* @retval OPAL_ERR_BAD_PARAM if the passed base pointer was invalid
|
2005-05-31 23:07:27 +04:00
|
|
|
*/
|
2015-06-24 06:59:57 +03:00
|
|
|
OPAL_DECLSPEC int mca_mpool_base_free(void * base);
|
2005-05-31 23:07:27 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function for the red black tree to compare 2 keys
|
|
|
|
*
|
|
|
|
* @param key1 a pointer to the 1st key
|
|
|
|
* @param key2 a pointer to the second key
|
|
|
|
*
|
|
|
|
* @retval -1 if key1 is below key2
|
|
|
|
* @retval 1 if key 1 is above key2
|
|
|
|
* @retval 0 if the keys are the same
|
|
|
|
*/
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
OPAL_DECLSPEC int mca_mpool_base_tree_node_compare(void * key1, void * key2);
|
2005-05-31 23:07:27 +04:00
|
|
|
|
2004-07-13 00:05:29 +04:00
|
|
|
/**
|
2008-07-29 02:40:57 +04:00
|
|
|
* Macro for use in components that are of type mpool
|
2004-06-16 19:41:29 +04:00
|
|
|
*/
|
2015-11-02 22:07:08 +03:00
|
|
|
#define MCA_MPOOL_BASE_VERSION_3_0_0 \
|
|
|
|
OPAL_MCA_BASE_VERSION_2_1_0("mpool", 3, 0, 0)
|
2004-06-15 23:07:45 +04:00
|
|
|
|
|
|
|
#endif /* MCA_MPOOL_H */
|
|
|
|
|