OpenMPI  0.1.1
mpool.h File Reference

Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana University Research and Technology Corporation. More...

#include "ompi_config.h"
#include "opal/mca/mca.h"
#include "ompi/info/info.h"
#include "ompi/class/ompi_free_list.h"
#include "opal/mca/crs/crs.h"
#include "opal/mca/crs/base/base.h"

Go to the source code of this file.

Data Structures

struct  mca_mpool_base_registration_t
 
struct  mca_mpool_base_component_2_0_0_t
 mpool component descriptor. More...
 
struct  mca_mpool_base_module_t
 mpool module descriptor. More...
 

Macros

#define MCA_MPOOL_FLAGS_CACHE_BYPASS   0x1
 
#define MCA_MPOOL_FLAGS_PERSIST   0x2
 
#define MCA_MPOOL_FLAGS_MPI_ALLOC_MEM   0x4
 
#define MCA_MPOOL_FLAGS_INVALID   0x8
 
#define MCA_MPOOL_FLAGS_SO_MEM   0x10
 
#define MCA_MPOOL_FLAGS_CUDA_REGISTER_MEM   0x20
 
#define MCA_MPOOL_BASE_VERSION_2_0_0
 Macro for use in components that are of type mpool. More...
 

Typedefs

typedef struct
mca_mpool_base_registration_t 
mca_mpool_base_registration_t
 
typedef struct
mca_mpool_base_module_t *(* 
mca_mpool_base_component_init_fn_t )(struct mca_mpool_base_resources_t *)
 component initialize
 
typedef void *(* mca_mpool_base_module_alloc_fn_t )(struct mca_mpool_base_module_t *mpool, size_t size, size_t align, uint32_t flags, mca_mpool_base_registration_t **registration)
 allocate function typedef
 
typedef void *(* mca_mpool_base_module_realloc_fn_t )(struct mca_mpool_base_module_t *mpool, void *addr, size_t size, mca_mpool_base_registration_t **registration)
 realloc function typedef
 
typedef void(* mca_mpool_base_module_free_fn_t )(struct mca_mpool_base_module_t *mpool, void *addr, mca_mpool_base_registration_t *registration)
 free function typedef
 
typedef int(* mca_mpool_base_module_register_fn_t )(struct mca_mpool_base_module_t *mpool, void *addr, size_t size, uint32_t flags, mca_mpool_base_registration_t **registration)
 register memory
 
typedef int(* mca_mpool_base_module_deregister_fn_t )(struct mca_mpool_base_module_t *mpool, mca_mpool_base_registration_t *registration)
 deregister memory
 
typedef int(* mca_mpool_base_module_find_fn_t )(struct mca_mpool_base_module_t *mpool, void *addr, size_t size, mca_mpool_base_registration_t **reg)
 find registration in this memory pool
 
typedef int(* mca_mpool_base_module_release_fn_t )(struct mca_mpool_base_module_t *mpool, mca_mpool_base_registration_t *registration)
 release registration
 
typedef int(* mca_mpool_base_module_release_memory_fn_t )(struct mca_mpool_base_module_t *mpool, void *base, size_t size)
 release memory region
 
typedef void *(* mca_mpool_base_module_address_fn_t )(struct mca_mpool_base_module_t *mpool)
 if appropriate - returns base address of memory pool
 
typedef void(* mca_mpool_base_module_finalize_fn_t )(struct mca_mpool_base_module_t *)
 finalize
 
typedef int(* mca_mpool_base_module_ft_event_fn_t )(int state)
 Fault Tolerance Event Notification Function. More...
 
typedef struct
mca_mpool_base_component_2_0_0_t 
mca_mpool_base_component_2_0_0_t
 Convenience typedef.
 
typedef struct
mca_mpool_base_component_2_0_0_t 
mca_mpool_base_component_t
 Convenience typedef.
 
typedef struct
mca_mpool_base_module_t 
mca_mpool_base_module_t
 Convenience typedef.
 

Functions

OMPI_DECLSPEC OBJ_CLASS_DECLARATION (mca_mpool_base_registration_t)
 
OMPI_DECLSPEC void * mca_mpool_base_alloc (size_t size, struct ompi_info_t *info)
 Function to allocate special memory according to what the user requests in the info object. More...
 
OMPI_DECLSPEC int mca_mpool_base_free (void *base)
 Function to free memory previously allocated by mca_mpool_base_alloc. More...
 
OMPI_DECLSPEC int mca_mpool_base_tree_node_compare (void *key1, void *key2)
 Function for the red black tree to compare 2 keys. More...
 
OMPI_DECLSPEC int mca_mpool_base_insert (void *addr, size_t size, mca_mpool_base_module_t *mpool, void *user_in, mca_mpool_base_registration_t *registration)
 
OMPI_DECLSPEC int mca_mpool_base_remove (void *base)
 

Detailed Description

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$

Additional copyrights may follow

$HEADER$

Description of the Memory Pool framework

Macro Definition Documentation

#define MCA_MPOOL_BASE_VERSION_2_0_0
Value:
MCA_BASE_VERSION_2_0_0, \
"mpool", 2, 0, 0

Macro for use in components that are of type mpool.

Typedef Documentation

typedef int(* mca_mpool_base_module_ft_event_fn_t)(int state)

Fault Tolerance Event Notification Function.

Parameters
stateCheckpoint Stae
Returns
OMPI_SUCCESS or failure status

Function Documentation

OMPI_DECLSPEC void* mca_mpool_base_alloc ( size_t  size,
ompi_info_t info 
)

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.

Parameters
sizethe size of the memory area to allocate
infoan info object which tells us what kind of memory to allocate
Return values
pointerto the allocated memory
NULLon failure

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 with as many mpools as possible. However, if any of the registratons fail the mpool will simply be ignored.

Parameters
sizethe size of the memory area to allocate
infoan info object which tells us what kind of memory to allocate
Return values
pointerto the allocated memory
NULLon failure

References mca_mpool_base_tree_item_t::count, mca_mpool_base_module_t::flags, mca_mpool_base_tree_item_t::key, mca_base_component_2_0_0_t::mca_component_name, mca_mpool_base_module_t::mpool_alloc, mca_mpool_base_module_t::mpool_component, mca_mpool_base_module_t::mpool_register, mca_mpool_base_component_2_0_0_t::mpool_version, mca_mpool_base_tree_item_t::mpools, mca_mpool_base_tree_item_t::num_bytes, opal_list_get_end(), opal_list_get_first(), opal_list_get_next, opal_list_get_size(), and mca_mpool_base_tree_item_t::regs.

OMPI_DECLSPEC int mca_mpool_base_free ( void *  base)

Function to free memory previously allocated by mca_mpool_base_alloc.

Parameters
basepointer to the memory to free
Return values
OMPI_SUCCESS
OMPI_ERR_BAD_PARAMif the passed base pointer was invalid

References mca_mpool_base_tree_find().

OMPI_DECLSPEC int mca_mpool_base_tree_node_compare ( void *  key1,
void *  key2 
)

Function for the red black tree to compare 2 keys.

Parameters
key1a pointer to the 1st key
key2a pointer to the second key
Return values
-1if key1 is below key2
1if key 1 is above key2
0if the keys are the same