This source file includes following definitions.
- register_component
- open_component
- close_component
- init_query
- file_query
- file_unquery
- delete_query
- delete_select
- register_datarep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 #include "ompi_config.h"
27
28 #include "mpi.h"
29 #include "opal/class/opal_list.h"
30 #include "opal/threads/mutex.h"
31 #include "opal/mca/base/base.h"
32 #include "ompi/mca/io/io.h"
33 #include "io_romio321.h"
34
35 #define ROMIO_VERSION_STRING "from MPICH v3.1.4"
36
37
38
39
40 static int register_component(void);
41 static int open_component(void);
42 static int close_component(void);
43 static int init_query(bool enable_progress_threads,
44 bool enable_mpi_threads);
45 static const struct mca_io_base_module_2_0_0_t *
46 file_query(struct ompi_file_t *file,
47 struct mca_io_base_file_t **private_data,
48 int *priority);
49 static int file_unquery(struct ompi_file_t *file,
50 struct mca_io_base_file_t *private_data);
51
52 static int delete_query(const char *filename, struct opal_info_t *info,
53 struct mca_io_base_delete_t **private_data,
54 bool *usable, int *priorty);
55 static int delete_select(const char *filename, struct opal_info_t *info,
56 struct mca_io_base_delete_t *private_data);
57
58 static int register_datarep(const char *,
59 MPI_Datarep_conversion_function*,
60 MPI_Datarep_conversion_function*,
61 MPI_Datarep_extent_function*,
62 void*);
63
64
65
66
67 static int priority_param = 20;
68 static int delete_priority_param = 20;
69
70
71
72
73
74 opal_mutex_t mca_io_romio321_mutex = {{0}};
75
76
77
78
79
80 const char *mca_io_romio321_component_version_string =
81 "OMPI/MPI ROMIO io MCA component version " OMPI_VERSION ", " ROMIO_VERSION_STRING;
82
83
84 mca_io_base_component_2_0_0_t mca_io_romio321_component = {
85
86
87
88 .io_version = {
89 MCA_IO_BASE_VERSION_2_0_0,
90 .mca_component_name = "romio321",
91 MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
92 OMPI_RELEASE_VERSION),
93 .mca_open_component = open_component,
94 .mca_close_component = close_component,
95 .mca_register_component_params = register_component,
96 },
97 .io_data = {
98
99 MCA_BASE_METADATA_PARAM_CHECKPOINT
100 },
101
102
103
104 .io_init_query = init_query,
105 .io_file_query = file_query,
106 .io_file_unquery = file_unquery,
107
108
109
110 .io_delete_query = delete_query,
111 .io_delete_select = delete_select,
112
113 .io_register_datarep = register_datarep,
114 };
115
116 static char *ompi_io_romio321_version = ROMIO_VERSION_STRING;
117 static char *ompi_io_romio321_user_configure_params = MCA_io_romio321_USER_CONFIGURE_FLAGS;
118 static char *ompi_io_romio321_complete_configure_params = MCA_io_romio321_COMPLETE_CONFIGURE_FLAGS;
119
120 static int register_component(void)
121 {
122
123 priority_param = 10;
124 (void) mca_base_component_var_register(&mca_io_romio321_component.io_version,
125 "priority", "Priority of the io romio component",
126 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
127 OPAL_INFO_LVL_9,
128 MCA_BASE_VAR_SCOPE_READONLY, &priority_param);
129 delete_priority_param = 10;
130 (void) mca_base_component_var_register(&mca_io_romio321_component.io_version,
131 "delete_priority", "Delete priority of the io romio component",
132 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
133 OPAL_INFO_LVL_9,
134 MCA_BASE_VAR_SCOPE_READONLY, &delete_priority_param);
135 (void) mca_base_component_var_register(&mca_io_romio321_component.io_version,
136 "version", "Version of ROMIO", MCA_BASE_VAR_TYPE_STRING,
137 NULL, 0, MCA_BASE_VAR_FLAG_DEFAULT_ONLY,
138 OPAL_INFO_LVL_9,
139 MCA_BASE_VAR_SCOPE_READONLY, &ompi_io_romio321_version);
140 (void) mca_base_component_var_register(&mca_io_romio321_component.io_version,
141 "user_configure_params",
142 "User-specified command line parameters passed to ROMIO's configure script",
143 MCA_BASE_VAR_TYPE_STRING, NULL, 0,
144 MCA_BASE_VAR_FLAG_DEFAULT_ONLY,
145 OPAL_INFO_LVL_9,
146 MCA_BASE_VAR_SCOPE_READONLY, &ompi_io_romio321_user_configure_params);
147 (void) mca_base_component_var_register(&mca_io_romio321_component.io_version,
148 "complete_configure_params",
149 "Complete set of command line parameters passed to ROMIO's configure script",
150 MCA_BASE_VAR_TYPE_STRING, NULL, 0,
151 MCA_BASE_VAR_FLAG_DEFAULT_ONLY,
152 OPAL_INFO_LVL_9,
153 MCA_BASE_VAR_SCOPE_READONLY, &ompi_io_romio321_complete_configure_params);
154
155 return OMPI_SUCCESS;
156 }
157
158 static int open_component(void)
159 {
160
161 OBJ_CONSTRUCT(&mca_io_romio321_mutex, opal_mutex_t);
162
163 return OMPI_SUCCESS;
164 }
165
166
167 static int close_component(void)
168 {
169 OBJ_DESTRUCT(&mca_io_romio321_mutex);
170
171 return OMPI_SUCCESS;
172 }
173
174
175 static int init_query(bool enable_progress_threads,
176 bool enable_mpi_threads)
177 {
178
179
180
181
182
183 return OMPI_SUCCESS;
184 }
185
186
187 static const struct mca_io_base_module_2_0_0_t *
188 file_query(struct ompi_file_t *file,
189 struct mca_io_base_file_t **private_data,
190 int *priority)
191 {
192 mca_io_romio321_data_t *data;
193
194 *priority = priority_param;
195
196
197
198
199 data = malloc(sizeof(mca_io_romio321_data_t));
200 if (NULL == data) {
201 return NULL;
202 }
203 data->romio_fh = NULL;
204 *private_data = (struct mca_io_base_file_t*) data;
205
206
207
208 return &mca_io_romio321_module;
209 }
210
211
212 static int file_unquery(struct ompi_file_t *file,
213 struct mca_io_base_file_t *private_data)
214 {
215
216
217
218 if (NULL != private_data) {
219 free(private_data);
220 }
221
222 return OMPI_SUCCESS;
223 }
224
225
226 static int delete_query(const char *filename, struct opal_info_t *info,
227 struct mca_io_base_delete_t **private_data,
228 bool *usable, int *priority)
229 {
230 *priority = delete_priority_param;
231 *usable = true;
232 *private_data = NULL;
233
234 return OMPI_SUCCESS;
235 }
236
237
238 static int delete_select(const char *filename, struct opal_info_t *info,
239 struct mca_io_base_delete_t *private_data)
240 {
241 int ret;
242
243
244
245
246 ompi_info_t *ompi_info;
247 ompi_info = OBJ_NEW(ompi_info_t);
248 if (!ompi_info) { return(MPI_ERR_NO_MEM); }
249 opal_info_t *opal_info = &(ompi_info->super);
250 opal_info_dup (info, &opal_info);
251
252 OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
253 ret = ROMIO_PREFIX(MPI_File_delete)(filename, ompi_info);
254 OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
255
256 ompi_info_free(&ompi_info);
257 return ret;
258 }
259
260
261 static int
262 register_datarep(const char * datarep,
263 MPI_Datarep_conversion_function* read_fn,
264 MPI_Datarep_conversion_function* write_fn,
265 MPI_Datarep_extent_function* extent_fn,
266 void* state)
267 {
268 int ret;
269
270 OPAL_THREAD_LOCK(&mca_io_romio321_mutex);
271 ret = ROMIO_PREFIX(MPI_Register_datarep(datarep, read_fn, write_fn,
272 extent_fn, state));
273 OPAL_THREAD_UNLOCK(&mca_io_romio321_mutex);
274
275 return ret;
276 }