This source file includes following definitions.
- ompi_fill_in_type_info
- ompi_fetch_pointer
- ompi_fetch_int
- ompi_fetch_bool
- ompi_fetch_size_t
- ompi_fetch_opal_pointer_array_info
- ompi_fetch_opal_pointer_array_item
- ompi_get_lib_version
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 #include "ompi_config.h"
44
45 #include "ompi_common_dll_defs.h"
46
47 #include <string.h>
48
49
50 const mqs_basic_callbacks *mqs_basic_entrypoints = NULL;
51
52 #if defined(WORDS_BIGENDIAN)
53 static int host_is_big_endian = 1;
54 #else
55 static int host_is_big_endian = 0;
56 #endif
57
58
59
60
61
62
63
64
65 #ifndef ompi_field_offset
66 #define ompi_field_offset(out_name, qh_type, struct_name, field_name) \
67 { \
68 out_name = mqs_field_offset((qh_type), #field_name); \
69 if (out_name < 0) { \
70 fprintf(stderr, "WARNING: Open MPI is unable to find " \
71 "field " #field_name " in the " #struct_name \
72 " type. This can happen can if Open MPI is built " \
73 "without debugging information, or is stripped " \
74 "after building.\n"); \
75 } \
76 }
77 #endif
78
79
80
81
82
83
84
85
86
87
88
89
90
91 int ompi_fill_in_type_info(mqs_image *image, char **message)
92 {
93 char* missing_in_action;
94 mpi_image_info * i_info = (mpi_image_info *)mqs_get_image_info (image);
95
96 {
97 mqs_type* qh_type = mqs_find_type( image, "opal_list_item_t", mqs_lang_c );
98 if( !qh_type ) {
99 missing_in_action = "opal_list_item_t";
100 goto type_missing;
101 }
102 i_info->opal_list_item_t.type = qh_type;
103 i_info->opal_list_item_t.size = mqs_sizeof(qh_type);
104 ompi_field_offset(i_info->opal_list_item_t.offset.opal_list_next,
105 qh_type, opal_list_item_t, opal_list_next);
106 }
107 {
108 mqs_type* qh_type = mqs_find_type( image, "opal_list_t", mqs_lang_c );
109 if( !qh_type ) {
110 missing_in_action = "opal_list_t";
111 goto type_missing;
112 }
113 i_info->opal_list_t.type = qh_type;
114 i_info->opal_list_t.size = mqs_sizeof(qh_type);
115 ompi_field_offset(i_info->opal_list_t.offset.opal_list_sentinel,
116 qh_type, opal_list_t, opal_list_sentinel);
117 }
118 {
119 mqs_type* qh_type = mqs_find_type( image, "opal_free_list_item_t", mqs_lang_c );
120 if( !qh_type ) {
121 missing_in_action = "opal_free_list_item_t";
122 goto type_missing;
123 }
124
125 i_info->opal_free_list_item_t.type = qh_type;
126 i_info->opal_free_list_item_t.size = mqs_sizeof(qh_type);
127 }
128 {
129 mqs_type* qh_type = mqs_find_type( image, "opal_free_list_t", mqs_lang_c );
130
131 if( !qh_type ) {
132 missing_in_action = "opal_free_list_t";
133 goto type_missing;
134 }
135
136 i_info->opal_free_list_t.type = qh_type;
137 i_info->opal_free_list_t.size = mqs_sizeof(qh_type);
138 ompi_field_offset(i_info->opal_free_list_t.offset.fl_mpool,
139 qh_type, opal_free_list_t, fl_mpool);
140 ompi_field_offset(i_info->opal_free_list_t.offset.fl_allocations,
141 qh_type, opal_free_list_t, fl_allocations);
142 ompi_field_offset(i_info->opal_free_list_t.offset.fl_frag_class,
143 qh_type, opal_free_list_t, fl_frag_class);
144 ompi_field_offset(i_info->opal_free_list_t.offset.fl_frag_size,
145 qh_type, opal_free_list_t, fl_frag_size);
146 ompi_field_offset(i_info->opal_free_list_t.offset.fl_frag_alignment,
147 qh_type, opal_free_list_t, fl_frag_alignment);
148 ompi_field_offset(i_info->opal_free_list_t.offset.fl_max_to_alloc,
149 qh_type, opal_free_list_t, fl_max_to_alloc);
150 ompi_field_offset(i_info->opal_free_list_t.offset.fl_num_per_alloc,
151 qh_type, opal_free_list_t, fl_num_per_alloc);
152 ompi_field_offset(i_info->opal_free_list_t.offset.fl_num_allocated,
153 qh_type, opal_free_list_t, fl_num_allocated);
154 }
155 {
156 mqs_type* qh_type = mqs_find_type( image, "opal_hash_table_t", mqs_lang_c );
157 if( !qh_type ) {
158 missing_in_action = "opal_hash_table_t";
159 goto type_missing;
160 }
161 i_info->opal_hash_table_t.type = qh_type;
162 i_info->opal_hash_table_t.size = mqs_sizeof(qh_type);
163 ompi_field_offset(i_info->opal_hash_table_t.offset.ht_table,
164 qh_type, opal_hash_table_t, ht_table);
165 ompi_field_offset(i_info->opal_hash_table_t.offset.ht_size,
166 qh_type, opal_hash_table_t, ht_size);
167 }
168
169
170
171 {
172 mqs_type* qh_type = mqs_find_type( image, "ompi_request_t", mqs_lang_c );
173 if( !qh_type ) {
174 missing_in_action = "ompi_request_t";
175 goto type_missing;
176 }
177 i_info->ompi_request_t.type = qh_type;
178 i_info->ompi_request_t.size = mqs_sizeof(qh_type);
179 ompi_field_offset(i_info->ompi_request_t.offset.req_type,
180 qh_type, ompi_request_t, req_type);
181 ompi_field_offset(i_info->ompi_request_t.offset.req_status,
182 qh_type, ompi_request_t, req_status);
183 ompi_field_offset(i_info->ompi_request_t.offset.req_complete,
184 qh_type, ompi_request_t, req_complete);
185 ompi_field_offset(i_info->ompi_request_t.offset.req_state,
186 qh_type, ompi_request_t, req_state);
187 ompi_field_offset(i_info->ompi_request_t.offset.req_f_to_c_index,
188 qh_type, ompi_request_t, req_f_to_c_index);
189 }
190 {
191 mqs_type* qh_type = mqs_find_type( image, "mca_pml_base_request_t", mqs_lang_c );
192 if( !qh_type ) {
193 missing_in_action = "mca_pml_base_request_t";
194 goto type_missing;
195 }
196 i_info->mca_pml_base_request_t.type = qh_type;
197 i_info->mca_pml_base_request_t.size = mqs_sizeof(qh_type);
198 ompi_field_offset(i_info->mca_pml_base_request_t.offset.req_addr,
199 qh_type, mca_pml_base_request_t, req_addr);
200 ompi_field_offset(i_info->mca_pml_base_request_t.offset.req_count,
201 qh_type, mca_pml_base_request_t, req_count);
202 ompi_field_offset(i_info->mca_pml_base_request_t.offset.req_peer,
203 qh_type, mca_pml_base_request_t, req_peer);
204 ompi_field_offset(i_info->mca_pml_base_request_t.offset.req_tag,
205 qh_type, mca_pml_base_request_t, req_tag);
206 ompi_field_offset(i_info->mca_pml_base_request_t.offset.req_comm,
207 qh_type, mca_pml_base_request_t, req_comm);
208 ompi_field_offset(i_info->mca_pml_base_request_t.offset.req_datatype,
209 qh_type, mca_pml_base_request_t, req_datatype);
210 ompi_field_offset(i_info->mca_pml_base_request_t.offset.req_proc,
211 qh_type, mca_pml_base_request_t, req_proc);
212 ompi_field_offset(i_info->mca_pml_base_request_t.offset.req_sequence,
213 qh_type, mca_pml_base_request_t, req_sequence);
214 ompi_field_offset(i_info->mca_pml_base_request_t.offset.req_type,
215 qh_type, mca_pml_base_request_t, req_type);
216 ompi_field_offset(i_info->mca_pml_base_request_t.offset.req_pml_complete,
217 qh_type, mca_pml_base_request_t, req_pml_complete);
218 }
219 {
220 mqs_type* qh_type = mqs_find_type( image, "mca_pml_base_send_request_t", mqs_lang_c );
221 if( !qh_type ) {
222 missing_in_action = "mca_pml_base_send_request_t";
223 goto type_missing;
224 }
225 i_info->mca_pml_base_send_request_t.type = qh_type;
226 i_info->mca_pml_base_send_request_t.size = mqs_sizeof(qh_type);
227 ompi_field_offset(i_info->mca_pml_base_send_request_t.offset.req_addr,
228 qh_type, mca_pml_base_send_request_t, req_addr);
229 ompi_field_offset(i_info->mca_pml_base_send_request_t.offset.req_bytes_packed,
230 qh_type, mca_pml_base_send_request_t, req_bytes_packed);
231 ompi_field_offset(i_info->mca_pml_base_send_request_t.offset.req_send_mode,
232 qh_type, mca_pml_base_send_request_t, req_send_mode);
233 }
234 {
235 mqs_type* qh_type = mqs_find_type( image, "mca_pml_base_recv_request_t", mqs_lang_c );
236 if( !qh_type ) {
237 missing_in_action = "mca_pml_base_recv_request_t";
238 goto type_missing;
239 }
240 i_info->mca_pml_base_recv_request_t.type = qh_type;
241 i_info->mca_pml_base_recv_request_t.size = mqs_sizeof(qh_type);
242 ompi_field_offset(i_info->mca_pml_base_recv_request_t.offset.req_bytes_packed,
243 qh_type, mca_pml_base_recv_request_t, req_bytes_packed);
244 }
245
246
247
248 #if 0
249 {
250 mqs_type* qh_type = mqs_find_type( image, "mca_pml_ob1_common_hdr_t", mqs_lang_c );
251 if( !qh_type ) {
252 missing_in_action = "mca_pml_ob1_common_hdr_t";
253 goto type_missing;
254 }
255 i_info->mca_pml_ob1_common_hdr_t.type = qh_type;
256 i_info->mca_pml_ob1_common_hdr_t.size = mqs_sizeof(qh_type);
257 ompi_field_offset(i_info->mca_pml_ob1_common_hdr_t.offset.hdr_type,
258 qh_type, mca_pml_ob1_common_hdr_t, hdr_type);
259 ompi_field_offset(i_info->mca_pml_ob1_common_hdr_t.offset.hdr_flags,
260 qh_type, mca_pml_ob1_common_hdr_t, hdr_flags);
261 }
262 {
263 mqs_type* qh_type = mqs_find_type( image, "mca_pml_ob1_match_hdr_t", mqs_lang_c );
264 if( !qh_type ) {
265 missing_in_action = "mca_pml_ob1_match_hdr_t";
266 goto type_missing;
267 }
268 i_info->mca_pml_ob1_match_hdr_t.type = qh_type;
269 i_info->mca_pml_ob1_match_hdr_t.size = mqs_sizeof(qh_type);
270 ompi_field_offset(i_info->mca_pml_ob1_match_hdr_t.offset.hdr_common,
271 qh_type, mca_pml_ob1_match_hdr_t, hdr_common);
272 ompi_field_offset(i_info->mca_pml_ob1_match_hdr_t.offset.hdr_ctx,
273 qh_type, mca_pml_ob1_match_hdr_t, hdr_ctx);
274 ompi_field_offset(i_info->mca_pml_ob1_match_hdr_t.offset.hdr_src,
275 qh_type, mca_pml_ob1_match_hdr_t, hdr_src);
276 ompi_field_offset(i_info->mca_pml_ob1_match_hdr_t.offset.hdr_tag,
277 qh_type, mca_pml_ob1_match_hdr_t, hdr_tag);
278 ompi_field_offset(i_info->mca_pml_ob1_match_hdr_t.offset.hdr_seq,
279 qh_type, mca_pml_ob1_match_hdr_t, hdr_seq);
280 }
281 {
282 mqs_type* qh_type = mqs_find_type( image, "mca_pml_ob1_recv_frag_t", mqs_lang_c );
283 if( !qh_type ) {
284 missing_in_action = "mca_pml_ob1_recv_frag_t";
285 goto type_missing;
286 }
287 i_info->mca_pml_ob1_recv_frag_t.type = qh_type;
288 i_info->mca_pml_ob1_recv_frag_t.size = mqs_sizeof(qh_type);
289 ompi_field_offset(i_info->mca_pml_ob1_recv_frag_t.offset.hdr,
290 qh_type, mca_pml_ob1_recv_frag_t, hdr);
291 ompi_field_offset(i_info->mca_pml_ob1_recv_frag_t.offset.request,
292 qh_type, mca_pml_ob1_recv_frag_t, request);
293 }
294 #endif
295
296
297
298 {
299 mqs_type* qh_type = mqs_find_type( image, "opal_pointer_array_t", mqs_lang_c );
300 if( !qh_type ) {
301 missing_in_action = "opal_pointer_array_t";
302 goto type_missing;
303 }
304 i_info->opal_pointer_array_t.type = qh_type;
305 i_info->opal_pointer_array_t.size = mqs_sizeof(qh_type);
306 ompi_field_offset(i_info->opal_pointer_array_t.offset.lowest_free,
307 qh_type, opal_pointer_array_t, lowest_free);
308 ompi_field_offset(i_info->opal_pointer_array_t.offset.number_free,
309 qh_type, opal_pointer_array_t, number_free);
310 ompi_field_offset(i_info->opal_pointer_array_t.offset.size,
311 qh_type, opal_pointer_array_t, size);
312 ompi_field_offset(i_info->opal_pointer_array_t.offset.addr,
313 qh_type, opal_pointer_array_t, addr);
314 }
315 {
316 mqs_type* qh_type = mqs_find_type( image, "ompi_communicator_t", mqs_lang_c );
317 if( !qh_type ) {
318 missing_in_action = "ompi_communicator_t";
319 goto type_missing;
320 }
321 i_info->ompi_communicator_t.type = qh_type;
322 i_info->ompi_communicator_t.size = mqs_sizeof(qh_type);
323 ompi_field_offset(i_info->ompi_communicator_t.offset.c_name,
324 qh_type, ompi_communicator_t, c_name);
325 ompi_field_offset(i_info->ompi_communicator_t.offset.c_contextid,
326 qh_type, ompi_communicator_t, c_contextid);
327 ompi_field_offset(i_info->ompi_communicator_t.offset.c_my_rank,
328 qh_type, ompi_communicator_t, c_my_rank);
329 ompi_field_offset(i_info->ompi_communicator_t.offset.c_local_group,
330 qh_type, ompi_communicator_t, c_local_group);
331 ompi_field_offset(i_info->ompi_communicator_t.offset.c_remote_group,
332 qh_type, ompi_communicator_t, c_remote_group);
333 ompi_field_offset(i_info->ompi_communicator_t.offset.c_flags,
334 qh_type, ompi_communicator_t, c_flags);
335 ompi_field_offset(i_info->ompi_communicator_t.offset.c_f_to_c_index,
336 qh_type, ompi_communicator_t, c_f_to_c_index);
337 ompi_field_offset(i_info->ompi_communicator_t.offset.c_topo,
338 qh_type, ompi_communicator_t, c_topo);
339 ompi_field_offset(i_info->ompi_communicator_t.offset.c_keyhash,
340 qh_type, ompi_communicator_t, c_keyhash);
341 }
342 {
343 mqs_type* qh_type, *cart_type, *graph_type, *dist_graph_type;
344 int offset = 0;
345
346 missing_in_action = "mca_topo_base_module_t";
347 qh_type = mqs_find_type(image, missing_in_action, mqs_lang_c);
348 if( !qh_type ) {
349 goto type_missing;
350 }
351 i_info->mca_topo_base_module_t.type = qh_type;
352 i_info->mca_topo_base_module_t.size = mqs_sizeof(qh_type);
353
354
355
356 ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc,
357 qh_type, mca_topo_base_module_t, mtc);
358 ompi_field_offset(i_info->mca_topo_base_module_t.offset.reorder,
359 qh_type, mca_topo_base_module_t, reorder);
360
361
362
363
364
365
366
367
368 missing_in_action = "mca_topo_base_comm_cart_2_2_0_t";
369 cart_type = mqs_find_type(image, missing_in_action, mqs_lang_c);
370 if (!cart_type) {
371 goto type_missing;
372 }
373 ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_cart.ndims,
374 cart_type, mca_topo_base_comm_cart_2_2_0_t,
375 ndims);
376 ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_cart.dims,
377 cart_type, mca_topo_base_comm_cart_2_2_0_t,
378 dims);
379 ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_cart.periods,
380 cart_type, mca_topo_base_comm_cart_2_2_0_t,
381 periods);
382 ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_cart.coords,
383 cart_type, mca_topo_base_comm_cart_2_2_0_t,
384 coords);
385 i_info->mca_topo_base_module_t.offset.mtc_cart.ndims += offset;
386 i_info->mca_topo_base_module_t.offset.mtc_cart.dims += offset;
387 i_info->mca_topo_base_module_t.offset.mtc_cart.periods += offset;
388 i_info->mca_topo_base_module_t.offset.mtc_cart.coords += offset;
389
390
391 missing_in_action = "mca_topo_base_comm_graph_2_2_0_t";
392 graph_type = mqs_find_type(image, missing_in_action, mqs_lang_c);
393 if (!graph_type) {
394 goto type_missing;
395 }
396 ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_graph.nnodes,
397 graph_type, mca_topo_base_comm_graph_2_2_0_t,
398 nnodes);
399 ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_graph.index,
400 graph_type, mca_topo_base_comm_graph_2_2_0_t,
401 index);
402 ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_graph.edges,
403 graph_type, mca_topo_base_comm_graph_2_2_0_t,
404 edges);
405 i_info->mca_topo_base_module_t.offset.mtc_graph.nnodes += offset;
406 i_info->mca_topo_base_module_t.offset.mtc_graph.index += offset;
407 i_info->mca_topo_base_module_t.offset.mtc_graph.edges += offset;
408
409
410 missing_in_action = "mca_topo_base_comm_dist_graph_2_2_0_t";
411 dist_graph_type = mqs_find_type(image, missing_in_action, mqs_lang_c);
412 if (!dist_graph_type) {
413 goto type_missing;
414 }
415 ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_dist_graph.in,
416 dist_graph_type, mca_topo_base_comm_dist_graph_2_2_0_t,
417 in);
418 ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_dist_graph.inw,
419 dist_graph_type, mca_topo_base_comm_dist_graph_2_2_0_t,
420 inw);
421 ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_dist_graph.out,
422 dist_graph_type, mca_topo_base_comm_dist_graph_2_2_0_t,
423 out);
424 ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_dist_graph.outw,
425 dist_graph_type, mca_topo_base_comm_dist_graph_2_2_0_t,
426 outw);
427 ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_dist_graph.indegree,
428 dist_graph_type, mca_topo_base_comm_dist_graph_2_2_0_t,
429 indegree);
430 ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_dist_graph.outdegree,
431 dist_graph_type, mca_topo_base_comm_dist_graph_2_2_0_t,
432 outdegree);
433 ompi_field_offset(i_info->mca_topo_base_module_t.offset.mtc_dist_graph.weighted,
434 dist_graph_type, mca_topo_base_comm_dist_graph_2_2_0_t,
435 weighted);
436 }
437 {
438 mqs_type* qh_type = mqs_find_type( image, "ompi_group_t", mqs_lang_c );
439 if( !qh_type ) {
440 missing_in_action = "ompi_group_t";
441 goto type_missing;
442 }
443 i_info->ompi_group_t.type = qh_type;
444 i_info->ompi_group_t.size = mqs_sizeof(qh_type);
445 ompi_field_offset(i_info->ompi_group_t.offset.grp_proc_count,
446 qh_type, ompi_group_t, grp_proc_count);
447 ompi_field_offset(i_info->ompi_group_t.offset.grp_proc_pointers,
448 qh_type, ompi_group_t, grp_proc_pointers);
449 ompi_field_offset(i_info->ompi_group_t.offset.grp_my_rank,
450 qh_type, ompi_group_t, grp_my_rank);
451 ompi_field_offset(i_info->ompi_group_t.offset.grp_flags,
452 qh_type, ompi_group_t, grp_flags);
453 }
454 {
455 mqs_type* qh_type = mqs_find_type( image, "ompi_status_public_t", mqs_lang_c );
456 if( !qh_type ) {
457 missing_in_action = "ompi_status_public_t";
458 goto type_missing;
459 }
460 i_info->ompi_status_public_t.type = qh_type;
461 i_info->ompi_status_public_t.size = mqs_sizeof(qh_type);
462 ompi_field_offset(i_info->ompi_status_public_t.offset.MPI_SOURCE,
463 qh_type, ompi_status_public_t, MPI_SOURCE);
464 ompi_field_offset(i_info->ompi_status_public_t.offset.MPI_TAG,
465 qh_type, ompi_status_public_t, MPI_TAG);
466 ompi_field_offset(i_info->ompi_status_public_t.offset.MPI_ERROR,
467 qh_type, ompi_status_public_t, MPI_ERROR);
468 ompi_field_offset(i_info->ompi_status_public_t.offset._ucount,
469 qh_type, ompi_status_public_t, _ucount);
470 ompi_field_offset(i_info->ompi_status_public_t.offset._cancelled,
471 qh_type, ompi_status_public_t, _cancelled);
472 }
473 {
474 mqs_type* qh_type = mqs_find_type( image, "ompi_datatype_t", mqs_lang_c );
475 if( !qh_type ) {
476 missing_in_action = "ompi_datatype_t";
477 goto type_missing;
478 }
479 i_info->ompi_datatype_t.type = qh_type;
480 i_info->ompi_datatype_t.size = mqs_sizeof(qh_type);
481 ompi_field_offset(i_info->ompi_datatype_t.offset.name,
482 qh_type, ompi_datatype_t, name);
483
484
485
486
487 {
488 int super_offset = 0;
489
490 ompi_field_offset(super_offset,
491 qh_type, ompi_datatype_t, super);
492
493 qh_type = mqs_find_type( image, "opal_datatype_t", mqs_lang_c );
494 if( !qh_type ) {
495 missing_in_action = "opal_datatype_t";
496 goto type_missing;
497 }
498 ompi_field_offset(i_info->ompi_datatype_t.offset.size,
499 qh_type, opal_datatype_t, size);
500 i_info->ompi_datatype_t.offset.size += super_offset;
501 }
502 }
503
504
505 *message = NULL;
506 return mqs_ok;
507
508 type_missing:
509
510
511
512
513
514 *message = missing_in_action;
515 fprintf(stderr, "WARNING: Open MPI is unable to find debugging information about the \"%s\" type. This can happen if Open MPI was built without debugging information, or was stripped after building.\n",
516 missing_in_action);
517 return err_missing_type;
518 }
519
520
521
522
523
524 mqs_taddr_t ompi_fetch_pointer (mqs_process *proc, mqs_taddr_t addr,
525 mpi_process_info *p_info)
526 {
527 int isize = p_info->sizes.pointer_size;
528 char buffer[8];
529 mqs_taddr_t res = 0;
530
531 if (mqs_ok == mqs_fetch_data (proc, addr, isize, buffer))
532 mqs_target_to_host (proc, buffer,
533 ((char *)&res) + (host_is_big_endian ? sizeof(mqs_taddr_t)-isize : 0),
534 isize);
535
536 return res;
537 }
538
539
540 mqs_tword_t ompi_fetch_int (mqs_process *proc, mqs_taddr_t addr,
541 mpi_process_info *p_info)
542 {
543 int isize = p_info->sizes.int_size;
544 char buffer[8];
545 mqs_tword_t res = 0;
546
547 if (mqs_ok == mqs_fetch_data (proc, addr, isize, buffer)) {
548 mqs_target_to_host (proc, buffer,
549 ((char *)&res) + (host_is_big_endian ? sizeof(mqs_tword_t)-isize : 0),
550 isize);
551 }
552 return res;
553 }
554
555
556 mqs_tword_t ompi_fetch_bool(mqs_process *proc, mqs_taddr_t addr,
557 mpi_process_info *p_info)
558 {
559 int isize = p_info->sizes.bool_size;
560 mqs_tword_t res = 0;
561
562 mqs_fetch_data (proc, addr, isize, &res);
563 return (0 == res ? 0 : 1);
564 }
565
566
567 mqs_taddr_t ompi_fetch_size_t(mqs_process *proc, mqs_taddr_t addr,
568 mpi_process_info *p_info)
569 {
570 int isize = p_info->sizes.size_t_size;
571 char buffer[8];
572 mqs_taddr_t res = 0;
573
574 if (mqs_ok == mqs_fetch_data (proc, addr, isize, buffer))
575 mqs_target_to_host (proc, buffer,
576 ((char *)&res) + (host_is_big_endian ? sizeof(mqs_taddr_t)-isize : 0),
577 isize);
578
579 return res;
580 }
581
582
583
584 int ompi_fetch_opal_pointer_array_info(mqs_process *proc, mqs_taddr_t addr,
585 mpi_process_info *p_info,
586 int *size, int *lowest_free,
587 int *number_free)
588 {
589 mqs_image *image = mqs_get_image(proc);
590 mpi_image_info *i_info = (mpi_image_info *) mqs_get_image_info(image);
591
592 *size = ompi_fetch_int(proc,
593 addr + i_info->opal_pointer_array_t.offset.size,
594 p_info);
595 *lowest_free = ompi_fetch_int(proc,
596 addr + i_info->opal_pointer_array_t.offset.lowest_free,
597 p_info);
598 *number_free = ompi_fetch_int(proc,
599 addr + i_info->opal_pointer_array_t.offset.number_free,
600 p_info);
601 return mqs_ok;
602 }
603
604
605
606 int ompi_fetch_opal_pointer_array_item(mqs_process *proc, mqs_taddr_t addr,
607 mpi_process_info *p_info, int index,
608 mqs_taddr_t *item)
609 {
610 mqs_image *image = mqs_get_image(proc);
611 mpi_image_info *i_info = (mpi_image_info *) mqs_get_image_info(image);
612 int size, lowest_free, number_free;
613 mqs_taddr_t base;
614
615 if (index < 0) {
616 return mqs_no_information;
617 }
618
619 ompi_fetch_opal_pointer_array_info(proc, addr, p_info, &size,
620 &lowest_free, &number_free);
621 if (index >= size) {
622 return mqs_no_information;
623 }
624
625 base = ompi_fetch_pointer(proc,
626 addr + i_info->opal_pointer_array_t.offset.addr,
627 p_info);
628 *item = ompi_fetch_pointer(proc,
629 base + index * p_info->sizes.pointer_size,
630 p_info);
631
632 return mqs_ok;
633 }
634
635 int ompi_get_lib_version(char * buf, int size) {
636 int ret;
637 ret = snprintf(buf, size-1, "Open MPI v%d.%d.%d%s%s%s%s%s%s%s%s%s",
638 OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION, OMPI_RELEASE_VERSION,
639 (strlen(OMPI_GREEK_VERSION) > 0)?OMPI_GREEK_VERSION:"",
640 (strlen(OPAL_PACKAGE_STRING) > 0)?", package: ":"",
641 (strlen(OPAL_PACKAGE_STRING) > 0)?OPAL_PACKAGE_STRING:"",
642 (strlen(OPAL_IDENT_STRING)> 0)?", ident: ":"",
643 (strlen(OPAL_IDENT_STRING)> 0)?OMPI_IDENT_STRING:"",
644 (strlen(OMPI_REPO_REV) > 0)?", repo rev: ":"",
645 (strlen(OMPI_REPO_REV) > 0)?OMPI_REPO_REV:"",
646 (strlen(OMPI_RELEASE_DATE) > 0)?", ":"",
647 (strlen(OMPI_RELEASE_DATE) > 0)?OMPI_RELEASE_DATE:"");
648 buf[size-1] = '\0';
649 return ret;
650 }