This source file includes following definitions.
- orte_info_do_params
- orte_info_show_mca_group_params
- orte_info_show_mca_params
- orte_info_do_path
- orte_info_show_path
- orte_info_do_arch
- orte_info_do_hostname
- orte_info_do_config
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 #include "orte_config.h"
28
29 #include <string.h>
30 #include <ctype.h>
31 #ifdef HAVE_UNISTD_H
32 #include <unistd.h>
33 #endif
34 #ifdef HAVE_SYS_PARAM_H
35 #include <sys/param.h>
36 #endif
37 #ifdef HAVE_NETDB_H
38 #include <netdb.h>
39 #endif
40
41 #include MCA_timer_IMPLEMENTATION_HEADER
42 #include "opal/include/opal/version.h"
43 #include "opal/mca/installdirs/installdirs.h"
44 #include "opal/class/opal_value_array.h"
45 #include "opal/class/opal_pointer_array.h"
46 #include "opal/util/printf.h"
47 #include "opal/memoryhooks/memory.h"
48 #include "opal/opal_portable_platform.h"
49
50 #include "orte/util/show_help.h"
51
52
53 #include "orte/tools/orte-info/orte-info.h"
54
55
56
57
58
59
60 const char *orte_info_component_all = "all";
61 const char *orte_info_param_all = "all";
62
63 const char *orte_info_path_prefix = "prefix";
64 const char *orte_info_path_bindir = "bindir";
65 const char *orte_info_path_libdir = "libdir";
66 const char *orte_info_path_incdir = "incdir";
67 const char *orte_info_path_mandir = "mandir";
68 const char *orte_info_path_pkglibdir = "pkglibdir";
69 const char *orte_info_path_sysconfdir = "sysconfdir";
70 const char *orte_info_path_exec_prefix = "exec_prefix";
71 const char *orte_info_path_sbindir = "sbindir";
72 const char *orte_info_path_libexecdir = "libexecdir";
73 const char *orte_info_path_datarootdir = "datarootdir";
74 const char *orte_info_path_datadir = "datadir";
75 const char *orte_info_path_sharedstatedir = "sharedstatedir";
76 const char *orte_info_path_localstatedir = "localstatedir";
77 const char *orte_info_path_infodir = "infodir";
78 const char *orte_info_path_pkgdatadir = "pkgdatadir";
79 const char *orte_info_path_pkgincludedir = "pkgincludedir";
80
81 void orte_info_do_params(bool want_all_in, bool want_internal)
82 {
83 int count;
84 char *type, *component, *str;
85 bool found;
86 int i;
87 bool want_all = false;
88
89 orte_info_components_open();
90
91 if (want_all_in) {
92 want_all = true;
93 } else {
94
95
96
97 count = opal_cmd_line_get_ninsts(orte_info_cmd_line, "param");
98 for (i = 0; i < count; ++i) {
99 type = opal_cmd_line_get_param(orte_info_cmd_line, "param", (int)i, 0);
100 if (0 == strcmp(orte_info_type_all, type)) {
101 want_all = true;
102 break;
103 }
104 }
105 }
106
107
108 if (want_all) {
109 for (i = 0; i < mca_types.size; ++i) {
110 if (NULL == (type = (char *)opal_pointer_array_get_item(&mca_types, i))) {
111 continue;
112 }
113 orte_info_show_mca_params(type, orte_info_component_all, want_internal);
114 }
115 } else {
116 for (i = 0; i < count; ++i) {
117 type = opal_cmd_line_get_param(orte_info_cmd_line, "param", (int)i, 0);
118 component = opal_cmd_line_get_param(orte_info_cmd_line, "param", (int)i, 1);
119
120 for (found = false, i = 0; i < mca_types.size; ++i) {
121 if (NULL == (str = (char *)opal_pointer_array_get_item(&mca_types, i))) {
122 continue;
123 }
124 if (0 == strcmp(str, type)) {
125 found = true;
126 break;
127 }
128 }
129
130 if (!found) {
131 char *usage = opal_cmd_line_get_usage_msg(orte_info_cmd_line);
132 orte_show_help("help-orte-info.txt", "not-found", true, type);
133 free(usage);
134 exit(1);
135 }
136
137 orte_info_show_mca_params(type, component, want_internal);
138 }
139 }
140 }
141
142 static void orte_info_show_mca_group_params(const mca_base_var_group_t *group, bool want_internal)
143 {
144 const mca_base_var_t *var;
145 const int *variables;
146 int ret, i, j, count;
147 const int *groups;
148 char **strings;
149
150 variables = OPAL_VALUE_ARRAY_GET_BASE(&group->group_vars, const int);
151 count = opal_value_array_get_size((opal_value_array_t *)&group->group_vars);
152
153 for (i = 0 ; i < count ; ++i) {
154 ret = mca_base_var_get(variables[i], &var);
155 if (OPAL_SUCCESS != ret || ((var->mbv_flags & MCA_BASE_VAR_FLAG_INTERNAL) &&
156 !want_internal)) {
157 continue;
158 }
159
160 ret = mca_base_var_dump(variables[i], &strings, !orte_info_pretty ? MCA_BASE_VAR_DUMP_PARSABLE : MCA_BASE_VAR_DUMP_READABLE);
161 if (OPAL_SUCCESS != ret) {
162 continue;
163 }
164
165 for (j = 0 ; strings[j] ; ++j) {
166 if (0 == j && orte_info_pretty) {
167 char *message;
168
169 opal_asprintf (&message, "MCA %s", group->group_framework);
170 orte_info_out(message, message, strings[j]);
171 free(message);
172 } else {
173 orte_info_out("", "", strings[j]);
174 }
175 free(strings[j]);
176 }
177 free(strings);
178 }
179
180 groups = OPAL_VALUE_ARRAY_GET_BASE(&group->group_subgroups, const int);
181 count = opal_value_array_get_size((opal_value_array_t *)&group->group_subgroups);
182
183 for (i = 0 ; i < count ; ++i) {
184 ret = mca_base_var_group_get(groups[i], &group);
185 if (OPAL_SUCCESS != ret) {
186 continue;
187 }
188 orte_info_show_mca_group_params(group, want_internal);
189 }
190 }
191
192 void orte_info_show_mca_params(const char *type, const char *component,
193 bool want_internal)
194 {
195 const mca_base_var_group_t *group;
196 int ret;
197
198 if (0 == strcmp (component, "all")) {
199 ret = mca_base_var_group_find("*", type, NULL);
200 if (0 > ret) {
201 return;
202 }
203
204 (void) mca_base_var_group_get(ret, &group);
205
206 orte_info_show_mca_group_params(group, want_internal);
207 } else {
208 ret = mca_base_var_group_find("*", type, component);
209 if (0 > ret) {
210 return;
211 }
212
213 (void) mca_base_var_group_get(ret, &group);
214 orte_info_show_mca_group_params(group, want_internal);
215 }
216 }
217
218 void orte_info_do_path(bool want_all, opal_cmd_line_t *cmd_line)
219 {
220 int i, count;
221 char *scope;
222
223
224 count = opal_cmd_line_get_ninsts(cmd_line, "path");
225 for (i = 0; i < count; ++i) {
226 scope = opal_cmd_line_get_param(cmd_line, "path", i, 0);
227 if (0 == strcmp("all", scope)) {
228 want_all = true;
229 break;
230 }
231 }
232
233 if (want_all) {
234 orte_info_show_path(orte_info_path_prefix, opal_install_dirs.prefix);
235 orte_info_show_path(orte_info_path_exec_prefix, opal_install_dirs.exec_prefix);
236 orte_info_show_path(orte_info_path_bindir, opal_install_dirs.bindir);
237 orte_info_show_path(orte_info_path_sbindir, opal_install_dirs.sbindir);
238 orte_info_show_path(orte_info_path_libdir, opal_install_dirs.libdir);
239 orte_info_show_path(orte_info_path_incdir, opal_install_dirs.includedir);
240 orte_info_show_path(orte_info_path_mandir, opal_install_dirs.mandir);
241 orte_info_show_path(orte_info_path_pkglibdir, opal_install_dirs.opallibdir);
242 orte_info_show_path(orte_info_path_libexecdir, opal_install_dirs.libexecdir);
243 orte_info_show_path(orte_info_path_datarootdir, opal_install_dirs.datarootdir);
244 orte_info_show_path(orte_info_path_datadir, opal_install_dirs.datadir);
245 orte_info_show_path(orte_info_path_sysconfdir, opal_install_dirs.sysconfdir);
246 orte_info_show_path(orte_info_path_sharedstatedir, opal_install_dirs.sharedstatedir);
247 orte_info_show_path(orte_info_path_localstatedir, opal_install_dirs.localstatedir);
248 orte_info_show_path(orte_info_path_infodir, opal_install_dirs.infodir);
249 orte_info_show_path(orte_info_path_pkgdatadir, opal_install_dirs.opaldatadir);
250 orte_info_show_path(orte_info_path_pkglibdir, opal_install_dirs.opallibdir);
251 orte_info_show_path(orte_info_path_pkgincludedir, opal_install_dirs.opalincludedir);
252 } else {
253 count = opal_cmd_line_get_ninsts(cmd_line, "path");
254 for (i = 0; i < count; ++i) {
255 scope = opal_cmd_line_get_param(cmd_line, "path", i, 0);
256
257 if (0 == strcmp(orte_info_path_prefix, scope)) {
258 orte_info_show_path(orte_info_path_prefix, opal_install_dirs.prefix);
259 } else if (0 == strcmp(orte_info_path_bindir, scope)) {
260 orte_info_show_path(orte_info_path_bindir, opal_install_dirs.bindir);
261 } else if (0 == strcmp(orte_info_path_libdir, scope)) {
262 orte_info_show_path(orte_info_path_libdir, opal_install_dirs.libdir);
263 } else if (0 == strcmp(orte_info_path_incdir, scope)) {
264 orte_info_show_path(orte_info_path_incdir, opal_install_dirs.includedir);
265 } else if (0 == strcmp(orte_info_path_mandir, scope)) {
266 orte_info_show_path(orte_info_path_mandir, opal_install_dirs.mandir);
267 } else if (0 == strcmp(orte_info_path_pkglibdir, scope)) {
268 orte_info_show_path(orte_info_path_pkglibdir, opal_install_dirs.opallibdir);
269 } else if (0 == strcmp(orte_info_path_sysconfdir, scope)) {
270 orte_info_show_path(orte_info_path_sysconfdir, opal_install_dirs.sysconfdir);
271 } else if (0 == strcmp(orte_info_path_exec_prefix, scope)) {
272 orte_info_show_path(orte_info_path_exec_prefix, opal_install_dirs.exec_prefix);
273 } else if (0 == strcmp(orte_info_path_sbindir, scope)) {
274 orte_info_show_path(orte_info_path_sbindir, opal_install_dirs.sbindir);
275 } else if (0 == strcmp(orte_info_path_libexecdir, scope)) {
276 orte_info_show_path(orte_info_path_libexecdir, opal_install_dirs.libexecdir);
277 } else if (0 == strcmp(orte_info_path_datarootdir, scope)) {
278 orte_info_show_path(orte_info_path_datarootdir, opal_install_dirs.datarootdir);
279 } else if (0 == strcmp(orte_info_path_datadir, scope)) {
280 orte_info_show_path(orte_info_path_datadir, opal_install_dirs.datadir);
281 } else if (0 == strcmp(orte_info_path_sharedstatedir, scope)) {
282 orte_info_show_path(orte_info_path_sharedstatedir, opal_install_dirs.sharedstatedir);
283 } else if (0 == strcmp(orte_info_path_localstatedir, scope)) {
284 orte_info_show_path(orte_info_path_localstatedir, opal_install_dirs.localstatedir);
285 } else if (0 == strcmp(orte_info_path_infodir, scope)) {
286 orte_info_show_path(orte_info_path_infodir, opal_install_dirs.infodir);
287 } else if (0 == strcmp(orte_info_path_pkgdatadir, scope)) {
288 orte_info_show_path(orte_info_path_pkgdatadir, opal_install_dirs.opaldatadir);
289 } else if (0 == strcmp(orte_info_path_pkgincludedir, scope)) {
290 orte_info_show_path(orte_info_path_pkgincludedir, opal_install_dirs.opalincludedir);
291 } else {
292 char *usage = opal_cmd_line_get_usage_msg(cmd_line);
293 orte_show_help("help-orte-info.txt", "usage", true, usage);
294 free(usage);
295 exit(1);
296 }
297 }
298 }
299 }
300
301
302 void orte_info_show_path(const char *type, const char *value)
303 {
304 char *pretty, *path;
305
306 pretty = strdup(type);
307 pretty[0] = toupper(pretty[0]);
308
309 opal_asprintf(&path, "path:%s", type);
310 orte_info_out(pretty, path, value);
311 free(pretty);
312 free(path);
313 }
314
315
316 void orte_info_do_arch()
317 {
318 orte_info_out("Configured architecture", "config:arch", OPAL_ARCH);
319 }
320
321
322 void orte_info_do_hostname()
323 {
324 orte_info_out("Configure host", "config:host", OPAL_CONFIGURE_HOST);
325 }
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340 void orte_info_do_config(bool want_all)
341 {
342 char *heterogeneous;
343 char *memprofile;
344 char *memdebug;
345 char *debug;
346 char *threads;
347 char *have_dl;
348 char *orterun_prefix_by_default;
349 char *wtime_support;
350 char *symbol_visibility;
351 char *ft_support;
352
353
354 heterogeneous = OPAL_ENABLE_HETEROGENEOUS_SUPPORT ? "yes" : "no";
355 memprofile = OPAL_ENABLE_MEM_PROFILE ? "yes" : "no";
356 memdebug = OPAL_ENABLE_MEM_DEBUG ? "yes" : "no";
357 debug = OPAL_ENABLE_DEBUG ? "yes" : "no";
358 have_dl = OPAL_HAVE_DL_SUPPORT ? "yes" : "no";
359 orterun_prefix_by_default = ORTE_WANT_ORTERUN_PREFIX_BY_DEFAULT ? "yes" : "no";
360 wtime_support = OPAL_TIMER_USEC_NATIVE ? "native" : "gettimeofday";
361 symbol_visibility = OPAL_C_HAVE_VISIBILITY ? "yes" : "no";
362
363
364 opal_asprintf(&threads, "%s (OPAL: yes, ORTE progress: yes, Event lib: yes)",
365 "posix");
366
367 opal_asprintf(&ft_support, "%s (checkpoint thread: %s)",
368 OPAL_ENABLE_FT ? "yes" : "no", OPAL_ENABLE_FT_THREAD ? "yes" : "no");;
369
370
371 orte_info_out("Configured by", "config:user", OPAL_CONFIGURE_USER);
372 orte_info_out("Configured on", "config:timestamp", OPAL_CONFIGURE_DATE);
373 orte_info_out("Configure host", "config:host", OPAL_CONFIGURE_HOST);
374 orte_info_out("Configure command line", "config:cli", OPAL_CONFIGURE_CLI);
375
376 orte_info_out("Built by", "build:user", OMPI_BUILD_USER);
377 orte_info_out("Built on", "build:timestamp", OMPI_BUILD_DATE);
378 orte_info_out("Built host", "build:host", OMPI_BUILD_HOST);
379
380 orte_info_out("C compiler", "compiler:c:command", OPAL_CC);
381 orte_info_out("C compiler absolute", "compiler:c:absolute", OPAL_CC_ABSOLUTE);
382 orte_info_out("C compiler family name", "compiler:c:familyname", _STRINGIFY(OPAL_BUILD_PLATFORM_COMPILER_FAMILYNAME));
383 orte_info_out("C compiler version", "compiler:c:version", _STRINGIFY(OPAL_BUILD_PLATFORM_COMPILER_VERSION_STR));
384
385 if (want_all) {
386 orte_info_out_int("C char size", "compiler:c:sizeof:char", sizeof(char));
387
388
389
390
391
392
393
394 orte_info_out_int("C bool size", "compiler:c:sizeof:bool", sizeof(bool));
395 orte_info_out_int("C short size", "compiler:c:sizeof:short", sizeof(short));
396 orte_info_out_int("C int size", "compiler:c:sizeof:int", sizeof(int));
397 orte_info_out_int("C long size", "compiler:c:sizeof:long", sizeof(long));
398 orte_info_out_int("C float size", "compiler:c:sizeof:float", sizeof(float));
399 orte_info_out_int("C double size", "compiler:c:sizeof:double", sizeof(double));
400 orte_info_out_int("C pointer size", "compiler:c:sizeof:pointer", sizeof(void *));
401 orte_info_out_int("C char align", "compiler:c:align:char", OPAL_ALIGNMENT_CHAR);
402 orte_info_out("C bool align", "compiler:c:align:bool", "skipped");
403 orte_info_out_int("C int align", "compiler:c:align:int", OPAL_ALIGNMENT_INT);
404 orte_info_out_int("C float align", "compiler:c:align:float", OPAL_ALIGNMENT_FLOAT);
405 orte_info_out_int("C double align", "compiler:c:align:double", OPAL_ALIGNMENT_DOUBLE);
406 }
407
408 orte_info_out("Thread support", "option:threads", threads);
409
410 if (want_all) {
411
412
413 orte_info_out("Build CFLAGS", "option:build:cflags", OMPI_BUILD_CFLAGS);
414 orte_info_out("Build LDFLAGS", "option:build:ldflags", OMPI_BUILD_LDFLAGS);
415 orte_info_out("Build LIBS", "option:build:libs", OMPI_BUILD_LIBS);
416
417 orte_info_out("Wrapper extra CFLAGS", "option:wrapper:extra_cflags",
418 WRAPPER_EXTRA_CFLAGS);
419 orte_info_out("Wrapper extra LDFLAGS", "option:wrapper:extra_ldflags",
420 WRAPPER_EXTRA_LDFLAGS);
421 orte_info_out("Wrapper extra LIBS", "option:wrapper:extra_libs",
422 WRAPPER_EXTRA_LIBS);
423 }
424 free(threads);
425
426 orte_info_out("Internal debug support", "option:debug", debug);
427 orte_info_out("Memory profiling support", "option:mem-profile", memprofile);
428 orte_info_out("Memory debugging support", "option:mem-debug", memdebug);
429 orte_info_out("dl support", "option:dlopen", have_dl);
430 orte_info_out("Heterogeneous support", "options:heterogeneous", heterogeneous);
431 orte_info_out("orterun default --prefix", "orterun:prefix_by_default",
432 orterun_prefix_by_default);
433 orte_info_out("MPI_WTIME support", "options:mpi-wtime", wtime_support);
434 orte_info_out("Symbol vis. support", "options:visibility", symbol_visibility);
435
436 orte_info_out("FT Checkpoint support", "options:ft_support", ft_support);
437 free(ft_support);
438
439 }