OpenMPI  0.1.1
mpool_grdma.h
Go to the documentation of this file.
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
4  * University Research and Technology
5  * Corporation. All rights reserved.
6  * Copyright (c) 2004-2006 The University of Tennessee and The University
7  * of Tennessee Research Foundation. All rights
8  * reserved.
9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10  * University of Stuttgart. All rights reserved.
11  * Copyright (c) 2004-2005 The Regents of the University of California.
12  * All rights reserved.
13  * Copyright (c) 2006 Voltaire. All rights reserved.
14  * Copyright (c) 2011-2012 Los Alamos National Security, LLC. All rights
15  * reserved.
16  *
17  * $COPYRIGHT$
18  *
19  * Additional copyrights may follow
20  *
21  * $HEADER$
22  */
23 /**
24  * @file
25  */
26 #ifndef MCA_MPOOL_OPENIB_H
27 #define MCA_MPOOL_OPENIB_H
28 
29 #include "ompi_config.h"
30 #include "opal/class/opal_list.h"
31 #include "ompi/class/ompi_free_list.h"
32 #include "opal/mca/event/event.h"
33 #include "ompi/mca/mpool/mpool.h"
34 #include <sys/mman.h>
35 
36 BEGIN_C_DECLS
37 
38 #define MCA_MPOOL_GRDMA_NAME_MAX 256
39 
41  opal_list_item_t super;
42  char pool_name[MCA_MPOOL_GRDMA_NAME_MAX];
43  opal_list_t lru_list;
44  opal_list_t gc_list;
45  int shm_fd;
46  char *shm_filename;
47  volatile int64_t *flagp;
48  bool skip;
49 };
51 
53 
56  opal_list_t pools;
57  char* rcache_name;
58  size_t rcache_size_limit;
59  bool print_stats;
60  uint32_t leave_pinned;
61 };
63 
64 OMPI_DECLSPEC extern mca_mpool_grdma_component_t mca_mpool_grdma_component;
65 
67 
69  char pool_name[MCA_MPOOL_GRDMA_NAME_MAX];
70  void *reg_data;
71  size_t sizeof_reg;
72  int (*register_mem)(void *reg_data, void *base, size_t size,
74  int (*deregister_mem)(void *reg_data, mca_mpool_base_registration_t *reg);
75 };
77 
80  struct mca_mpool_base_resources_t resources;
82  ompi_free_list_t reg_list;
83  uint32_t stat_cache_hit;
84  uint32_t stat_cache_miss;
85  uint32_t stat_evicted;
86  uint32_t stat_cache_found;
87  uint32_t stat_cache_notfound;
88 };
90 
91 /*
92  * Initializes the mpool module.
93  */
94 void mca_mpool_grdma_module_init(mca_mpool_grdma_module_t *mpool, mca_mpool_grdma_pool_t *pool);
95 
96 /*
97  * Returns base address of shared memory mapping.
98  */
99 void *mca_mpool_grdma_base(mca_mpool_base_module_t *mpool);
100 
101 /**
102  * Allocate block of registered memory.
103  */
104 void* mca_mpool_grdma_alloc(mca_mpool_base_module_t *mpool, size_t size,
105  size_t align, uint32_t flags,
106  mca_mpool_base_registration_t** registration);
107 
108 /**
109  * realloc block of registered memory
110  */
111 void* mca_mpool_grdma_realloc( mca_mpool_base_module_t *mpool, void* addr,
112  size_t size, mca_mpool_base_registration_t** registration);
113 
114 /**
115  * register block of memory
116  */
118  size_t size, uint32_t flags, mca_mpool_base_registration_t **reg);
119 
120 /**
121  * deregister memory
122  */
125 
126 /**
127  * free memory allocated by alloc function
128  */
129 void mca_mpool_grdma_free(mca_mpool_base_module_t *mpool, void * addr,
131 
132 /**
133  * find registration for a given block of memory
134  */
135 int mca_mpool_grdma_find(struct mca_mpool_base_module_t* mpool, void* addr,
136  size_t size, mca_mpool_base_registration_t **reg);
137 
138 /**
139  * unregister all registration covering the block of memory
140  */
142  size_t size);
143 
144 /**
145  * finalize mpool
146  */
148 
149 /**
150  * Fault Tolerance Event Notification Function
151  * @param state Checkpoint Stae
152  * @return OMPI_SUCCESS or failure status
153  */
154 int mca_mpool_grdma_ft_event(int state);
155 
156 int mca_mpool_grdma_progress (void);
157 
158 /**
159  * evict one unused registration from the mpool's lru.
160  * @return true on success, false on failure
161  */
163 
164 END_C_DECLS
165 #endif
bool mca_mpool_grdma_evict(struct mca_mpool_base_module_t *mpool)
evict one unused registration from the mpool's lru.
Definition: mpool_grdma_module.c:211
Definition: mpool_grdma.h:78
The opal_list_t interface is used to provide a generic doubly-linked list container for Open MPI...
Definition: mpool.h:44
mpool component descriptor.
Definition: mpool.h:154
Definition: opal_list.h:98
void mca_mpool_grdma_free(mca_mpool_base_module_t *mpool, void *addr, mca_mpool_base_registration_t *reg)
free memory allocated by alloc function
Definition: mpool_grdma_module.c:402
int mca_mpool_grdma_deregister(mca_mpool_base_module_t *mpool, mca_mpool_base_registration_t *reg)
deregister memory
Definition: mpool_grdma_module.c:454
void * mca_mpool_grdma_realloc(mca_mpool_base_module_t *mpool, void *addr, size_t size, mca_mpool_base_registration_t **registration)
realloc block of registered memory
Definition: mpool_grdma_module.c:388
void mca_mpool_grdma_finalize(struct mca_mpool_base_module_t *mpool)
finalize mpool
Definition: mpool_grdma_module.c:516
Definition: ompi_free_list.h:39
int mca_mpool_grdma_find(struct mca_mpool_base_module_t *mpool, void *addr, size_t size, mca_mpool_base_registration_t **reg)
find registration for a given block of memory
Definition: mpool_grdma_module.c:410
Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana University Research and Techno...
int mca_mpool_grdma_ft_event(int state)
Fault Tolerance Event Notification Function.
Definition: mpool_grdma_module.c:561
Definition: opal_list.h:147
void * mca_mpool_grdma_alloc(mca_mpool_base_module_t *mpool, size_t size, size_t align, uint32_t flags, mca_mpool_base_registration_t **registration)
Allocate block of registered memory.
Definition: mpool_grdma_module.c:133
Definition: mpool_grdma.h:54
int mca_mpool_grdma_release_memory(mca_mpool_base_module_t *mpool, void *base, size_t size)
unregister all registration covering the block of memory
Definition: mpool_grdma_module.c:483
Definition: mpool_grdma.h:40
int mca_mpool_grdma_register(mca_mpool_base_module_t *mpool, void *addr, size_t size, uint32_t flags, mca_mpool_base_registration_t **reg)
register block of memory
Definition: mpool_grdma_module.c:279
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236
Definition: mpool_fake.h:38
mpool module descriptor.
Definition: mpool.h:174