OpenMPI 0.1.1

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

- File List
- Globals

shmem.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2005 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 (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
13 * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
14 * Copyright (c) 2010 IBM Corporation. All rights reserved.
15 * Copyright (c) 2010-2011 Los Alamos National Security, LLC.
16 * All rights reserved.
17 * $COPYRIGHT$
18 *
19 * Additional copyrights may follow
20 *
21 * $HEADER$
22 */
23
24 /**
25 * @file
26 *
27 * shmem (shared memory backing facility) framework component interface
28 * definitions.
29 *
30 * usage example: see ompi/mca/common/sm
31 *
32 * The module has the following functions:
33 *
34 * - module_init
35 * - segment_create
36 * - ds_copy
37 * - segment_attach
38 * - segment_detach
39 * - unlink
40 * - module_finalize
41 */
42
43 #ifndef OPAL_SHMEM_H
44 #define OPAL_SHMEM_H
45
46 #include "opal_config.h"
47
48 #include "opal/mca/mca.h"
49 #include "opal/mca/base/base.h"
50
51 #include "opal/mca/shmem/shmem_types.h"
52
53 BEGIN_C_DECLS
54
55 /* ////////////////////////////////////////////////////////////////////////// */
56 typedef int
57 (*mca_shmem_base_component_runtime_query_fn_t)(mca_base_module_t **module,
58 int *priority,
59 const char *hint);
60
61 /* structure for shmem components. */
62 struct opal_shmem_base_component_2_0_0_t {
63 /* base MCA component */
64 mca_base_component_t base_version;
65 /* base MCA data */
66 mca_base_component_data_t base_data;
67 /* component runtime query */
68 mca_shmem_base_component_runtime_query_fn_t runtime_query;
69 };
70
71 /* convenience typedefs */
72 typedef struct opal_shmem_base_component_2_0_0_t
73 opal_shmem_base_component_2_0_0_t;
74
75 typedef struct opal_shmem_base_component_2_0_0_t opal_shmem_base_component_t;
76
77 /* ////////////////////////////////////////////////////////////////////////// */
78 /* shmem API function pointers */
79
80 /**
81 * module initialization function.
82 * @return OPAL_SUCCESS on success.
83 */
84 typedef int
85 (*opal_shmem_base_module_init_fn_t)(void);
86
87 /**
88 * copy shmem data structure information pointed to by from to the structure
89 * pointed to by to.
90 *
91 * @param from source pointer (IN).
92 *
93 * @param to destination pointer (OUT).
94 *
95 * @return OPAL_SUCCESS on success.
96 */
97 typedef int
98 (*opal_shmem_base_ds_copy_fn_t)(const opal_shmem_ds_t *from,
99 opal_shmem_ds_t *to);
100
101 /**
102 * create a new shared memory segment and initialize members in structure
103 * pointed to by ds_buf.
104 *
105 * @param ds_buf pointer to opal_shmem_ds_t typedef'd structure
106 * defined in shmem_types.h (OUT).
107 *
108 * @param file_name file_name unique string identifier that must be a valid,
109 * writable path (IN).
110 *
111 * @param size size of the shared memory segment.
112 *
113 * @return OPAL_SUCCESS on success.
114 */
115 typedef int
116 (*opal_shmem_base_module_segment_create_fn_t)(opal_shmem_ds_t *ds_buf,
117 const char *file_name,
118 size_t size);
119
120 /**
121 * attach to an existing shared memory segment initialized by segment_create.
122 *
123 * @param ds_buf pointer to initialized opal_shmem_ds_t typedef'd
124 * structure (IN/OUT).
125 *
126 * @return base address of shared memory segment on success. returns
127 * NULL otherwise.
128 */
129 typedef void *
130 (*opal_shmem_base_module_segment_attach_fn_t)(opal_shmem_ds_t *ds_buf);
131
132 /**
133 * detach from an existing shared memory segment.
134 *
135 * @param ds_buf pointer to initialized opal_shmem_ds_t typedef'd structure
136 * (IN/OUT).
137 *
138 * @return OPAL_SUCCESS on success.
139 */
140 typedef int
141 (*opal_shmem_base_module_segment_detach_fn_t)(opal_shmem_ds_t *ds_buf);
142
143 /**
144 * unlink an existing shared memory segment.
145 *
146 * @param ds_buf pointer to initialized opal_shmem_ds_t typedef'd structure
147 * (IN/OUT).
148 *
149 * @return OPAL_SUCCESS on success.
150 */
151 typedef int
152 (*opal_shmem_base_module_unlink_fn_t)(opal_shmem_ds_t *ds_buf);
153
154 /**
155 * module finalize function. invoked by the base on the selected
156 * module when the shmem framework is being shut down.
157 */
158 typedef int (*opal_shmem_base_module_finalize_fn_t)(void);
159
160 /**
161 * structure for shmem modules
162 */
163 struct opal_shmem_base_module_2_0_0_t {
164 opal_shmem_base_module_init_fn_t module_init;
165 opal_shmem_base_module_segment_create_fn_t segment_create;
166 opal_shmem_base_ds_copy_fn_t ds_copy;
167 opal_shmem_base_module_segment_attach_fn_t segment_attach;
168 opal_shmem_base_module_segment_detach_fn_t segment_detach;
169 opal_shmem_base_module_unlink_fn_t unlink;
170 opal_shmem_base_module_finalize_fn_t module_finalize;
171 };
172
173 /**
174 * convenience typedefs
175 */
176 typedef struct opal_shmem_base_module_2_0_0_t opal_shmem_base_module_2_0_0_t;
177 typedef struct opal_shmem_base_module_2_0_0_t opal_shmem_base_module_t;
178
179 /**
180 * macro for use in components that are of type shmem
181 * see: opal/mca/mca.h for more information
182 */
183 #define OPAL_SHMEM_BASE_VERSION_2_0_0 \
184 MCA_BASE_VERSION_2_0_0, \
185 "shmem", 2, 0, 0
186
187 END_C_DECLS
188
189 #endif /* OPAL_SHMEM_H */
mca_base_component_2_0_0_t
Common type for all MCA components.
Definition: mca.h:250
opal_shmem_base_module_finalize_fn_t
int(* opal_shmem_base_module_finalize_fn_t)(void)
module finalize function.
Definition: shmem.h:158
mca_base_module_2_0_0_t
Common type for all MCA modules.
Definition: mca.h:100
opal_shmem_base_ds_copy_fn_t
int(* opal_shmem_base_ds_copy_fn_t)(const opal_shmem_ds_t *from, opal_shmem_ds_t *to)
copy shmem data structure information pointed to by from to the structure pointed to by to...
Definition: shmem.h:98
opal_shmem_base_module_2_0_0_t
structure for shmem modules
Definition: shmem.h:163
opal_shmem_base_component_2_0_0_t
Definition: shmem.h:62
shmem_types.h
shmem (shared memory backing facility) framework types, convenience macros, etc.
mca.h
Top-level interface for all MCA components.
opal_shmem_ds_t
Definition: shmem_types.h:107
opal_shmem_base_module_init_fn_t
int(* opal_shmem_base_module_init_fn_t)(void)
module initialization function.
Definition: shmem.h:85
mca_base_component_data_2_0_0_t
Meta data for MCA v2.0.0 components.
Definition: mca.h:309
opal_shmem_base_module_segment_detach_fn_t
int(* opal_shmem_base_module_segment_detach_fn_t)(opal_shmem_ds_t *ds_buf)
detach from an existing shared memory segment.
Definition: shmem.h:141
opal_shmem_base_module_segment_create_fn_t
int(* opal_shmem_base_module_segment_create_fn_t)(opal_shmem_ds_t *ds_buf, const char *file_name, size_t size)
create a new shared memory segment and initialize members in structure pointed to by ds_buf...
Definition: shmem.h:116
opal_shmem_base_module_unlink_fn_t
int(* opal_shmem_base_module_unlink_fn_t)(opal_shmem_ds_t *ds_buf)
unlink an existing shared memory segment.
Definition: shmem.h:152
opal_shmem_base_module_segment_attach_fn_t
void *(* opal_shmem_base_module_segment_attach_fn_t)(opal_shmem_ds_t *ds_buf)
attach to an existing shared memory segment initialized by segment_create.
Definition: shmem.h:130