OpenMPI 0.1.1

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

- File List
- Globals

btl_template.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2009 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2005 The Regents of the University of California.
11 * All rights reserved.
12 * $COPYRIGHT$
13 *
14 * Additional copyrights may follow
15 *
16 * $HEADER$
17 */
18 /**
19 * @file
20 */
21 #ifndef MCA_BTL_TEMPLATE_H
22 #define MCA_BTL_TEMPLATE_H
23
24 #include "ompi_config.h"
25 #include <sys/types.h>
26 #include <string.h>
27
28 /* Open MPI includes */
29 #include "opal/mca/event/event.h"
30 #include "ompi/class/ompi_free_list.h"
31 #include "ompi/mca/btl/btl.h"
32 #include "ompi/mca/btl/base/base.h"
33 #include "ompi/mca/mpool/mpool.h"
34 #include "ompi/mca/btl/btl.h"
35
36 BEGIN_C_DECLS
37
38 #define MCA_BTL_HAS_MPOOL 1
39
40 /**
41 * Infiniband (TEMPLATE) BTL component.
42 */
43
44 struct mca_btl_template_component_t {
45 mca_btl_base_component_2_0_0_t super; /**< base BTL component */
46
47 uint32_t template_num_btls;
48 /**< number of hcas available to the TEMPLATE component */
49
50 struct mca_btl_template_module_t *template_btls;
51 /**< array of available BTL modules */
52
53 int template_free_list_num;
54 /**< initial size of free lists */
55
56 int template_free_list_max;
57 /**< maximum size of free lists */
58
59 int template_free_list_inc;
60 /**< number of elements to alloc when growing free lists */
61
62 opal_list_t template_procs;
63 /**< list of template proc structures */
64
65 opal_mutex_t template_lock;
66 /**< lock for accessing module state */
67
68 char* template_mpool_name;
69 /**< name of memory pool */
70
71 bool leave_pinned;
72 /**< pin memory on first use and leave pinned */
73 };
74 typedef struct mca_btl_template_component_t mca_btl_template_component_t;
75
76 OMPI_MODULE_DECLSPEC extern mca_btl_template_component_t mca_btl_template_component;
77
78 /**
79 * BTL Module Interface
80 */
81 struct mca_btl_template_module_t {
82 mca_btl_base_module_t super; /**< base BTL interface */
83
84 /* free list of fragment descriptors */
85 ompi_free_list_t template_frag_eager;
86 ompi_free_list_t template_frag_max;
87 ompi_free_list_t template_frag_user;
88
89 /* lock for accessing module state */
90 opal_mutex_t template_lock;
91
92 #if MCA_BTL_HAS_MPOOL
93 struct mca_mpool_base_module_t* template_mpool;
94 #endif
95 };
96 typedef struct mca_btl_template_module_t mca_btl_template_module_t;
97 extern mca_btl_template_module_t mca_btl_template_module;
98
99
100 /**
101 * TEMPLATE component initialization.
102 *
103 * @param num_btl_modules (OUT) Number of BTLs returned in BTL array.
104 * @param allow_multi_user_threads (OUT) Flag indicating wether BTL supports user threads (TRUE)
105 * @param have_hidden_threads (OUT) Flag indicating wether BTL uses threads (TRUE)
106 */
107 extern mca_btl_base_module_t** mca_btl_template_component_init(
108 int *num_btl_modules,
109 bool allow_multi_user_threads,
110 bool have_hidden_threads
111 );
112
113
114 /**
115 * TEMPLATE component progress.
116 */
117 extern int mca_btl_template_component_progress(void);
118
119
120
121 /**
122 * Cleanup any resources held by the BTL.
123 *
124 * @param btl BTL instance.
125 * @return OMPI_SUCCESS or error status on failure.
126 */
127
128 extern int mca_btl_template_finalize(
129 struct mca_btl_base_module_t* btl
130 );
131
132
133 /**
134 * PML->BTL notification of change in the process list.
135 *
136 * @param btl (IN)
137 * @param nprocs (IN) Number of processes
138 * @param procs (IN) Set of processes
139 * @param peers (OUT) Set of (optional) peer addressing info.
140 * @param peers (IN/OUT) Set of processes that are reachable via this BTL.
141 * @return OMPI_SUCCESS or error status on failure.
142 *
143 */
144
145 extern int mca_btl_template_add_procs(
146 struct mca_btl_base_module_t* btl,
147 size_t nprocs,
148 struct ompi_proc_t **procs,
149 struct mca_btl_base_endpoint_t** peers,
150 opal_bitmap_t* reachable
151 );
152
153 /**
154 * PML->BTL notification of change in the process list.
155 *
156 * @param btl (IN) BTL instance
157 * @param nproc (IN) Number of processes.
158 * @param procs (IN) Set of processes.
159 * @param peers (IN) Set of peer data structures.
160 * @return Status indicating if cleanup was successful
161 *
162 */
163
164 extern int mca_btl_template_del_procs(
165 struct mca_btl_base_module_t* btl,
166 size_t nprocs,
167 struct ompi_proc_t **procs,
168 struct mca_btl_base_endpoint_t** peers
169 );
170
171
172 /**
173 * Initiate an asynchronous send.
174 *
175 * @param btl (IN) BTL module
176 * @param endpoint (IN) BTL addressing information
177 * @param descriptor (IN) Description of the data to be transfered
178 * @param tag (IN) The tag value used to notify the peer.
179 */
180
181 extern int mca_btl_template_send(
182 struct mca_btl_base_module_t* btl,
183 struct mca_btl_base_endpoint_t* btl_peer,
184 struct mca_btl_base_descriptor_t* descriptor,
185 mca_btl_base_tag_t tag
186 );
187
188
189 /**
190 * Initiate an asynchronous put.
191 *
192 * @param btl (IN) BTL module
193 * @param endpoint (IN) BTL addressing information
194 * @param descriptor (IN) Description of the data to be transferred
195 */
196
197 extern int mca_btl_template_put(
198 struct mca_btl_base_module_t* btl,
199 struct mca_btl_base_endpoint_t* btl_peer,
200 struct mca_btl_base_descriptor_t* decriptor
201 );
202
203
204 /**
205 * Initiate an asynchronous get.
206 *
207 * @param btl (IN) BTL module
208 * @param endpoint (IN) BTL addressing information
209 * @param descriptor (IN) Description of the data to be transferred
210 */
211
212 extern int mca_btl_template_get(
213 struct mca_btl_base_module_t* btl,
214 struct mca_btl_base_endpoint_t* btl_peer,
215 struct mca_btl_base_descriptor_t* decriptor
216 );
217
218 /**
219 * Register a callback function that is called on receipt
220 * of a fragment.
221 *
222 * @param btl (IN) BTL module
223 * @return Status indicating if registration was successful
224 *
225 */
226
227 extern int mca_btl_template_register(
228 struct mca_btl_base_module_t* btl,
229 mca_btl_base_tag_t tag,
230 mca_btl_base_module_recv_cb_fn_t cbfunc,
231 void* cbdata);
232
233 /**
234 * Allocate a descriptor with a segment of the requested size.
235 * Note that the BTL layer may choose to return a smaller size
236 * if it cannot support the request.
237 *
238 * @param btl (IN) BTL module
239 * @param size (IN) Request segment size.
240 */
241
242 extern mca_btl_base_descriptor_t* mca_btl_template_alloc(
243 struct mca_btl_base_module_t* btl,
244 struct mca_btl_base_endpoint_t* endpoint,
245 uint8_t order,
246 size_t size,
247 uint32_t flags);
248
249
250 /**
251 * Return a segment allocated by this BTL.
252 *
253 * @param btl (IN) BTL module
254 * @param descriptor (IN) Allocated descriptor.
255 */
256
257 extern int mca_btl_template_free(
258 struct mca_btl_base_module_t* btl,
259 mca_btl_base_descriptor_t* des);
260
261
262 /**
263 * Prepare a descriptor for send/rdma using the supplied
264 * convertor. If the convertor references data that is contigous,
265 * the descriptor may simply point to the user buffer. Otherwise,
266 * this routine is responsible for allocating buffer space and
267 * packing if required.
268 *
269 * @param btl (IN) BTL module
270 * @param endpoint (IN) BTL peer addressing
271 * @param convertor (IN) Data type convertor
272 * @param reserve (IN) Additional bytes requested by upper layer to precede user data
273 * @param size (IN/OUT) Number of bytes to prepare (IN), number of bytes actually prepared (OUT)
274 */
275
276 mca_btl_base_descriptor_t* mca_btl_template_prepare_src(
277 struct mca_btl_base_module_t* btl,
278 struct mca_btl_base_endpoint_t* peer,
279 struct mca_mpool_base_registration_t*,
280 struct opal_convertor_t* convertor,
281 uint8_t order,
282 size_t reserve,
283 size_t* size,
284 uint32_t flags
285 );
286
287 extern mca_btl_base_descriptor_t* mca_btl_template_prepare_dst(
288 struct mca_btl_base_module_t* btl,
289 struct mca_btl_base_endpoint_t* peer,
290 struct mca_mpool_base_registration_t*,
291 struct opal_convertor_t* convertor,
292 uint8_t order,
293 size_t reserve,
294 size_t* size,
295 uint32_t flags);
296
297 /**
298 * Fault Tolerance Event Notification Function
299 * @param state Checkpoint Stae
300 * @return OMPI_SUCCESS or failure status
301 */
302 int mca_btl_template_ft_event(int state);
303
304 END_C_DECLS
305 #endif
mca_btl_base_descriptor_t
A descriptor that holds the parameters to a send/put/get operation along w/ a callback routine that i...
Definition: btl.h:275
mca_btl_template_component_t::template_free_list_max
int template_free_list_max
maximum size of free lists
Definition: btl_template.h:56
mca_btl_template_module_t
BTL Module Interface.
Definition: btl_template.h:81
mca_btl_template_prepare_src
mca_btl_base_descriptor_t * mca_btl_template_prepare_src(struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *peer, struct mca_mpool_base_registration_t *, struct opal_convertor_t *convertor, uint8_t order, size_t reserve, size_t *size, uint32_t flags)
Prepare a descriptor for send/rdma using the supplied convertor.
Definition: btl_template.c:219
mca_btl_base_module_recv_cb_fn_t
void(* mca_btl_base_module_recv_cb_fn_t)(struct mca_btl_base_module_t *btl, mca_btl_base_tag_t tag, mca_btl_base_descriptor_t *descriptor, void *cbdata)
Callback function that is called asynchronously on receipt of data by the transport layer...
Definition: btl.h:391
opal_bitmap_t
Definition: opal_bitmap.h:53
mca_btl_template_del_procs
int mca_btl_template_del_procs(struct mca_btl_base_module_t *btl, size_t nprocs, struct ompi_proc_t **procs, struct mca_btl_base_endpoint_t **peers)
PML->BTL notification of change in the process list.
Definition: btl_template.c:131
mca_btl_template_module_t::super
mca_btl_base_module_t super
base BTL interface
Definition: btl_template.h:82
mca_btl_template_component_t::leave_pinned
bool leave_pinned
pin memory on first use and leave pinned
Definition: btl_template.h:71
mca_btl_template_add_procs
int mca_btl_template_add_procs(struct mca_btl_base_module_t *btl, size_t nprocs, struct ompi_proc_t **procs, struct mca_btl_base_endpoint_t **peers, opal_bitmap_t *reachable)
PML->BTL notification of change in the process list.
Definition: btl_template.c:69
mca_btl_template_component_t::template_procs
opal_list_t template_procs
list of template proc structures
Definition: btl_template.h:62
opal_mutex_t
Definition: mutex_unix.h:53
mca_btl_template_ft_event
int mca_btl_template_ft_event(int state)
Fault Tolerance Event Notification Function.
Definition: btl_template.c:421
mca_btl_template_prepare_dst
mca_btl_base_descriptor_t * mca_btl_template_prepare_dst(struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *peer, struct mca_mpool_base_registration_t *, struct opal_convertor_t *convertor, uint8_t order, size_t reserve, size_t *size, uint32_t flags)
Prepare a descriptor for send/rdma using the supplied convertor.
Definition: btl_template.c:309
mca_mpool_base_registration_t
Definition: mpool.h:44
mca_btl_template_component_t::template_mpool_name
char * template_mpool_name
name of memory pool
Definition: btl_template.h:68
ompi_proc_t
Remote Open MPI process structure.
Definition: proc.h:56
mca_btl_template_send
int mca_btl_template_send(struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *btl_peer, struct mca_btl_base_descriptor_t *descriptor, mca_btl_base_tag_t tag)
Initiate an asynchronous send.
Definition: btl_template.c:348
mca_btl_template_component_t::template_free_list_num
int template_free_list_num
initial size of free lists
Definition: btl_template.h:53
btl.h
Byte Transfer Layer (BTL)
mca_btl_template_component_t::template_btls
struct mca_btl_template_module_t * template_btls
array of available BTL modules
Definition: btl_template.h:50
mca_btl_template_component_t::template_num_btls
uint32_t template_num_btls
number of hcas available to the TEMPLATE component
Definition: btl_template.h:47
ompi_free_list_t
Definition: ompi_free_list.h:39
mca_btl_base_endpoint_t
State of ELAN endpoint connection.
Definition: btl_elan_endpoint.h:33
mca_btl_base_component_2_0_0_t
BTL component descriptor.
Definition: btl.h:411
mpool.h
Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana University Research and Techno...
mca_btl_template_component_t::template_lock
opal_mutex_t template_lock
lock for accessing module state
Definition: btl_template.h:65
opal_convertor_t
Definition: opal_convertor.h:90
mca_btl_template_component_progress
int mca_btl_template_component_progress(void)
TEMPLATE component progress.
Definition: btl_template_component.c:171
opal_list_t
Definition: opal_list.h:147
base.h
mca_btl_template_component_t::super
mca_btl_base_component_2_0_0_t super
base BTL component
Definition: btl_template.h:45
mca_btl_template_register
int mca_btl_template_register(struct mca_btl_base_module_t *btl, mca_btl_base_tag_t tag, mca_btl_base_module_recv_cb_fn_t cbfunc, void *cbdata)
Register a callback function that is called on receipt of a fragment.
Definition: btl_template.c:145
mca_btl_base_module_t
BTL module interface functions and attributes.
Definition: btl.h:786
mca_btl_template_component_t::template_free_list_inc
int template_free_list_inc
number of elements to alloc when growing free lists
Definition: btl_template.h:59
mca_btl_template_alloc
mca_btl_base_descriptor_t * mca_btl_template_alloc(struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, uint8_t order, size_t size, uint32_t flags)
Allocate a descriptor with a segment of the requested size.
Definition: btl_template.c:162
mca_btl_template_free
int mca_btl_template_free(struct mca_btl_base_module_t *btl, mca_btl_base_descriptor_t *des)
Return a segment allocated by this BTL.
Definition: btl_template.c:192
mca_btl_template_put
int mca_btl_template_put(struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *btl_peer, struct mca_btl_base_descriptor_t *decriptor)
Initiate an asynchronous put.
Definition: btl_template.c:371
mca_btl_template_component_init
mca_btl_base_module_t ** mca_btl_template_component_init(int *num_btl_modules, bool allow_multi_user_threads, bool have_hidden_threads)
TEMPLATE component initialization.
Definition: btl_template_component.c:159
mca_btl_template_component_t
Infiniband (TEMPLATE) BTL component.
Definition: btl_template.h:44
mca_mpool_base_module_t
mpool module descriptor.
Definition: mpool.h:174
mca_btl_template_finalize
int mca_btl_template_finalize(struct mca_btl_base_module_t *btl)
Cleanup any resources held by the BTL.
Definition: btl_template.c:410
mca_btl_template_get
int mca_btl_template_get(struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *btl_peer, struct mca_btl_base_descriptor_t *decriptor)
Initiate an asynchronous get.
Definition: btl_template.c:393