OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

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
40 struct mca_mpool_grdma_pool_t {
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 };
50 typedef struct mca_mpool_grdma_pool_t mca_mpool_grdma_pool_t;
51
52 OBJ_CLASS_DECLARATION(mca_mpool_grdma_pool_t);
53
54 struct mca_mpool_grdma_component_t {
55 mca_mpool_base_component_t super;
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 };
62 typedef struct mca_mpool_grdma_component_t mca_mpool_grdma_component_t;
63
64 OMPI_DECLSPEC extern mca_mpool_grdma_component_t mca_mpool_grdma_component;
65
66 struct mca_mpool_grdma_module_t;
67
68 struct mca_mpool_base_resources_t {
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,
73 mca_mpool_base_registration_t *reg);
74 int (*deregister_mem)(void *reg_data, mca_mpool_base_registration_t *reg);
75 };
76 typedef struct mca_mpool_base_resources_t mca_mpool_base_resources_t;
77
78 struct mca_mpool_grdma_module_t {
79 mca_mpool_base_module_t super;
80 struct mca_mpool_base_resources_t resources;
81 mca_mpool_grdma_pool_t *pool;
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 };
89 typedef struct mca_mpool_grdma_module_t mca_mpool_grdma_module_t;
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 */
117 int mca_mpool_grdma_register(mca_mpool_base_module_t* mpool, void *addr,
118 size_t size, uint32_t flags, mca_mpool_base_registration_t **reg);
119
120 /**
121 * deregister memory
122 */
123 int mca_mpool_grdma_deregister(mca_mpool_base_module_t *mpool,
124 mca_mpool_base_registration_t *reg);
125
126 /**
127 * free memory allocated by alloc function
128 */
129 void mca_mpool_grdma_free(mca_mpool_base_module_t *mpool, void * addr,
130 mca_mpool_base_registration_t *reg);
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 */
141 int mca_mpool_grdma_release_memory(mca_mpool_base_module_t* mpool, void *base,
142 size_t size);
143
144 /**
145 * finalize mpool
146 */
147 void mca_mpool_grdma_finalize(struct mca_mpool_base_module_t *mpool);
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 */
162 bool mca_mpool_grdma_evict (struct mca_mpool_base_module_t *mpool);
163
164 END_C_DECLS
165 #endif
mca_mpool_grdma_evict
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
mca_mpool_grdma_module_t
Definition: mpool_grdma.h:78
opal_list.h
The opal_list_t interface is used to provide a generic doubly-linked list container for Open MPI...
mca_mpool_base_registration_t
Definition: mpool.h:44
mca_mpool_base_component_2_0_0_t
mpool component descriptor.
Definition: mpool.h:154
opal_list_item_t
Definition: opal_list.h:98
mca_mpool_grdma_free
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
mca_mpool_grdma_deregister
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
mca_mpool_grdma_realloc
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
mca_mpool_grdma_finalize
void mca_mpool_grdma_finalize(struct mca_mpool_base_module_t *mpool)
finalize mpool
Definition: mpool_grdma_module.c:516
ompi_free_list_t
Definition: ompi_free_list.h:39
mca_mpool_grdma_find
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
mpool.h
Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana University Research and Techno...
mca_mpool_grdma_ft_event
int mca_mpool_grdma_ft_event(int state)
Fault Tolerance Event Notification Function.
Definition: mpool_grdma_module.c:561
opal_list_t
Definition: opal_list.h:147
mca_mpool_grdma_alloc
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
mca_mpool_grdma_component_t
Definition: mpool_grdma.h:54
mca_mpool_grdma_release_memory
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
mca_mpool_grdma_pool_t
Definition: mpool_grdma.h:40
mca_mpool_grdma_register
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
OBJ_CLASS_DECLARATION
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236
mca_mpool_base_resources_t
Definition: mpool_fake.h:38
mca_mpool_base_module_t
mpool module descriptor.
Definition: mpool.h:174