This source file includes following definitions.
- ompi_mpi_register_params
- ompi_show_all_mca_params
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 #include "ompi_config.h"
30
31 #include <string.h>
32 #include <time.h>
33
34 #include "ompi/constants.h"
35 #include "ompi/datatype/ompi_datatype.h"
36 #include "ompi/runtime/mpiruntime.h"
37 #include "ompi/runtime/params.h"
38 #include "ompi/mca/rte/rte.h"
39
40 #include "opal/mca/pmix/base/base.h"
41 #include "opal/util/argv.h"
42 #include "opal/util/output.h"
43 #include "opal/util/show_help.h"
44 #include "opal/runtime/opal.h"
45 #include "opal/runtime/opal_params.h"
46
47
48
49
50
51
52
53
54
55 bool ompi_mpi_param_check = true;
56 bool ompi_debug_show_handle_leaks = false;
57 int ompi_debug_show_mpi_alloc_mem_leaks = 0;
58 bool ompi_debug_no_free_handles = false;
59 bool ompi_mpi_show_mca_params = false;
60 char *ompi_mpi_show_mca_params_file = NULL;
61 bool ompi_mpi_keep_fqdn_hostnames = false;
62 bool ompi_have_sparse_group_storage = OPAL_INT_TO_BOOL(OMPI_GROUP_SPARSE);
63 bool ompi_use_sparse_group_storage = OPAL_INT_TO_BOOL(OMPI_GROUP_SPARSE);
64
65 bool ompi_mpi_yield_when_idle = false;
66 int ompi_mpi_event_tick_rate = -1;
67 char *ompi_mpi_show_mca_params_string = NULL;
68 bool ompi_mpi_have_sparse_group_storage = !!(OMPI_GROUP_SPARSE);
69 bool ompi_mpi_preconnect_mpi = false;
70
71 bool ompi_async_mpi_init = false;
72 bool ompi_async_mpi_finalize = false;
73
74 #define OMPI_ADD_PROCS_CUTOFF_DEFAULT 0
75 uint32_t ompi_add_procs_cutoff = OMPI_ADD_PROCS_CUTOFF_DEFAULT;
76 bool ompi_mpi_dynamics_enabled = true;
77
78 char *ompi_mpi_spc_attach_string = NULL;
79 bool ompi_mpi_spc_dump_enabled = false;
80
81 static bool show_default_mca_params = false;
82 static bool show_file_mca_params = false;
83 static bool show_enviro_mca_params = false;
84 static bool show_override_mca_params = false;
85 static bool ompi_mpi_oversubscribe = false;
86
87 int ompi_mpi_register_params(void)
88 {
89 int value;
90
91
92
93
94 ompi_mpi_param_check = !!(MPI_PARAM_CHECK);
95 (void) mca_base_var_register("ompi", "mpi", NULL, "param_check",
96 "Whether you want MPI API parameters checked at run-time or not. Possible values are 0 (no checking) and 1 (perform checking at run-time)",
97 MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
98 OPAL_INFO_LVL_9,
99 MCA_BASE_VAR_SCOPE_READONLY,
100 &ompi_mpi_param_check);
101 if (ompi_mpi_param_check && !MPI_PARAM_CHECK) {
102 opal_show_help("help-mpi-runtime.txt",
103 "mpi-param-check-enabled-but-compiled-out",
104 true);
105 ompi_mpi_param_check = false;
106 }
107
108
109
110
111
112 ompi_mpi_oversubscribe = false;
113 (void) mca_base_var_register("ompi", "mpi", NULL, "oversubscribe",
114 "Internal MCA parameter set by the runtime environment when oversubscribing nodes",
115 MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
116 OPAL_INFO_LVL_9,
117 MCA_BASE_VAR_SCOPE_READONLY,
118 &ompi_mpi_oversubscribe);
119 ompi_mpi_yield_when_idle = ompi_mpi_oversubscribe;
120 (void) mca_base_var_register("ompi", "mpi", NULL, "yield_when_idle",
121 "Yield the processor when waiting for MPI communication (for MPI processes, will default to 1 when oversubscribing nodes)",
122 MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
123 OPAL_INFO_LVL_5,
124 MCA_BASE_VAR_SCOPE_READONLY,
125 &ompi_mpi_yield_when_idle);
126
127 ompi_mpi_event_tick_rate = -1;
128 (void) mca_base_var_register("ompi", "mpi", NULL, "event_tick_rate",
129 "How often to progress TCP communications (0 = never, otherwise specified in microseconds)",
130 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
131 OPAL_INFO_LVL_9,
132 MCA_BASE_VAR_SCOPE_READONLY,
133 &ompi_mpi_event_tick_rate);
134
135
136 ompi_debug_show_handle_leaks = false;
137 (void) mca_base_var_register("ompi", "mpi", NULL, "show_handle_leaks",
138 "Whether MPI_FINALIZE shows all MPI handles that were not freed or not",
139 MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
140 OPAL_INFO_LVL_9,
141 MCA_BASE_VAR_SCOPE_READONLY,
142 &ompi_debug_show_handle_leaks);
143
144
145
146
147 ompi_debug_no_free_handles = false;
148 (void) mca_base_var_register("ompi", "mpi", NULL, "no_free_handles",
149 "Whether to actually free MPI objects when their handles are freed",
150 MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
151 OPAL_INFO_LVL_9,
152 MCA_BASE_VAR_SCOPE_READONLY,
153 &ompi_debug_no_free_handles);
154 if (ompi_debug_no_free_handles) {
155 ompi_mpi_param_check = true;
156 if (!MPI_PARAM_CHECK) {
157 opal_output(0, "WARNING: MCA parameter mpi_no_free_handles set to true, but MPI");
158 opal_output(0, "WARNING: parameter checking has been compiled out of Open MPI.");
159 opal_output(0, "WARNING: mpi_no_free_handles is therefore only partially effective!");
160 }
161 }
162
163
164 ompi_debug_show_mpi_alloc_mem_leaks = 0;
165 (void) mca_base_var_register("ompi", "mpi", NULL, "show_mpi_alloc_mem_leaks",
166 "If >0, MPI_FINALIZE will show up to this many instances of memory allocated by MPI_ALLOC_MEM that was not freed by MPI_FREE_MEM",
167 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
168 OPAL_INFO_LVL_9,
169 MCA_BASE_VAR_SCOPE_READONLY,
170 &ompi_debug_show_mpi_alloc_mem_leaks);
171
172
173 ompi_mpi_show_mca_params_string = NULL;
174 (void) mca_base_var_register("ompi", "mpi", NULL, "show_mca_params",
175 "Whether to show all MCA parameter values during MPI_INIT or not (good for reproducability of MPI jobs "
176 "for debug purposes). Accepted values are all, default, file, api, and enviro - or a comma "
177 "delimited combination of them",
178 MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
179 OPAL_INFO_LVL_9,
180 MCA_BASE_VAR_SCOPE_READONLY,
181 &ompi_mpi_show_mca_params_string);
182 if (NULL != ompi_mpi_show_mca_params_string) {
183 char **args;
184 int i;
185
186 ompi_mpi_show_mca_params = true;
187 args = opal_argv_split(ompi_mpi_show_mca_params_string, ',');
188 if (NULL == args) {
189 opal_output(0, "WARNING: could not parse mpi_show_mca_params request - defaulting to show \"all\"");
190 show_default_mca_params = true;
191 show_file_mca_params = true;
192 show_enviro_mca_params = true;
193 show_override_mca_params = true;
194 } else {
195 for (i=0; NULL != args[i]; i++) {
196 if (0 == strcasecmp(args[i], "all") || 0 == strcmp(args[i], "1")) {
197 show_default_mca_params = true;
198 show_file_mca_params = true;
199 show_enviro_mca_params = true;
200 show_override_mca_params = true;
201 } else if (0 == strcasecmp(args[i], "default")) {
202 show_default_mca_params = true;
203 } else if (0 == strcasecmp(args[i], "file")) {
204 show_file_mca_params = true;
205 } else if (0 == strncasecmp(args[i], "env", 3)) {
206 show_enviro_mca_params = true;
207 } else if (0 == strcasecmp(args[i], "api")) {
208 show_override_mca_params = true;
209 }
210 }
211 opal_argv_free(args);
212 }
213 }
214
215
216 (void) mca_base_var_register("ompi", "mpi", NULL, "show_mca_params_file",
217 "If mpi_show_mca_params is true, setting this string to a valid filename tells Open MPI to dump all the MCA parameter values into a file suitable for reading via the mca_param_files parameter (good for reproducability of MPI jobs)",
218 MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
219 OPAL_INFO_LVL_9,
220 MCA_BASE_VAR_SCOPE_READONLY,
221 &ompi_mpi_show_mca_params_file);
222
223
224
225 ompi_mpi_preconnect_mpi = false;
226 value = mca_base_var_register("ompi", "mpi", NULL, "preconnect_mpi",
227 "Whether to force MPI processes to fully "
228 "wire-up the MPI connections between MPI "
229 "processes during "
230 "MPI_INIT (vs. making connections lazily -- "
231 "upon the first MPI traffic between each "
232 "process peer pair)",
233 MCA_BASE_VAR_TYPE_BOOL, NULL, 0,
234 MCA_BASE_VAR_FLAG_INTERNAL,
235 OPAL_INFO_LVL_9,
236 MCA_BASE_VAR_SCOPE_READONLY,
237 &ompi_mpi_preconnect_mpi);
238 mca_base_var_register_synonym(value, "ompi", "mpi", NULL, "preconnect_all",
239 MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
240
241
242 (void) mca_base_var_register("ompi", "mpi", NULL, "have_sparse_group_storage",
243 "Whether this Open MPI installation supports storing of data in MPI groups in \"sparse\" formats (good for extremely large process count MPI jobs that create many communicators/groups)",
244 MCA_BASE_VAR_TYPE_BOOL, NULL, 0,
245 MCA_BASE_VAR_FLAG_DEFAULT_ONLY,
246 OPAL_INFO_LVL_9,
247 MCA_BASE_VAR_SCOPE_CONSTANT,
248 &ompi_mpi_have_sparse_group_storage);
249
250 ompi_use_sparse_group_storage = ompi_mpi_have_sparse_group_storage;
251 (void) mca_base_var_register("ompi", "mpi", NULL, "use_sparse_group_storage",
252 "Whether to use \"sparse\" storage formats for MPI groups (only relevant if mpi_have_sparse_group_storage is 1)",
253 MCA_BASE_VAR_TYPE_BOOL, NULL, 0,
254 ompi_mpi_have_sparse_group_storage ? 0 : MCA_BASE_VAR_FLAG_DEFAULT_ONLY,
255 OPAL_INFO_LVL_9,
256 ompi_mpi_have_sparse_group_storage ? MCA_BASE_VAR_SCOPE_READONLY : MCA_BASE_VAR_SCOPE_CONSTANT,
257 &ompi_use_sparse_group_storage);
258 if (ompi_use_sparse_group_storage && !ompi_mpi_have_sparse_group_storage) {
259 opal_show_help("help-mpi-runtime.txt",
260 "sparse groups enabled but compiled out",
261 true);
262 ompi_use_sparse_group_storage = false;
263 }
264
265 value = mca_base_var_find ("opal", "opal", NULL, "cuda_support");
266 if (0 <= value) {
267 mca_base_var_register_synonym(value, "ompi", "mpi", NULL, "cuda_support",
268 MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
269 }
270
271 value = mca_base_var_find ("opal", "opal", NULL, "built_with_cuda_support");
272 if (0 <= value) {
273 mca_base_var_register_synonym(value, "ompi", "mpi", NULL, "built_with_cuda_support", 0);
274 }
275
276 if (opal_cuda_support && !opal_built_with_cuda_support) {
277 opal_show_help("help-mpi-runtime.txt", "no cuda support",
278 true);
279 ompi_rte_abort(1, NULL);
280 }
281
282 ompi_add_procs_cutoff = OMPI_ADD_PROCS_CUTOFF_DEFAULT;
283 (void) mca_base_var_register ("ompi", "mpi", NULL, "add_procs_cutoff",
284 "Maximum world size for pre-allocating resources for all "
285 "remote processes. Increasing this limit may improve "
286 "communication performance at the cost of memory usage",
287 MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL,
288 0, 0, OPAL_INFO_LVL_3, MCA_BASE_VAR_SCOPE_LOCAL,
289 &ompi_add_procs_cutoff);
290
291 ompi_mpi_dynamics_enabled = true;
292 (void) mca_base_var_register("ompi", "mpi", NULL, "dynamics_enabled",
293 "Is the MPI dynamic process functionality enabled (e.g., MPI_COMM_SPAWN)? Default is yes, but certain transports and/or environments may disable it.",
294 MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
295 OPAL_INFO_LVL_4,
296 MCA_BASE_VAR_SCOPE_READONLY,
297 &ompi_mpi_dynamics_enabled);
298
299 ompi_async_mpi_init = false;
300 (void) mca_base_var_register("ompi", "async", "mpi", "init",
301 "Do not perform a barrier at the end of MPI_Init",
302 MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
303 OPAL_INFO_LVL_9,
304 MCA_BASE_VAR_SCOPE_READONLY,
305 &ompi_async_mpi_init);
306
307 ompi_async_mpi_finalize = false;
308 (void) mca_base_var_register("ompi", "async", "mpi", "finalize",
309 "Do not perform a barrier at the beginning of MPI_Finalize",
310 MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
311 OPAL_INFO_LVL_9,
312 MCA_BASE_VAR_SCOPE_READONLY,
313 &ompi_async_mpi_finalize);
314
315 value = mca_base_var_find ("opal", "opal", NULL, "abort_delay");
316 if (0 <= value) {
317 (void) mca_base_var_register_synonym(value, "ompi", "mpi", NULL, "abort_delay",
318 MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
319 }
320
321 value = mca_base_var_find ("opal", "opal", NULL, "abort_print_stack");
322 if (0 <= value) {
323 (void) mca_base_var_register_synonym(value, "ompi", "mpi", NULL, "abort_print_stack",
324 MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
325 }
326
327 ompi_mpi_spc_attach_string = NULL;
328 (void) mca_base_var_register("ompi", "mpi", NULL, "spc_attach",
329 "A comma delimeted string listing the software-based performance counters (SPCs) to enable.",
330 MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
331 OPAL_INFO_LVL_4,
332 MCA_BASE_VAR_SCOPE_READONLY,
333 &ompi_mpi_spc_attach_string);
334
335 ompi_mpi_spc_dump_enabled = false;
336 (void) mca_base_var_register("ompi", "mpi", NULL, "spc_dump_enabled",
337 "A boolean value for whether (true) or not (false) to enable dumping SPC counters in MPI_Finalize.",
338 MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
339 OPAL_INFO_LVL_4,
340 MCA_BASE_VAR_SCOPE_READONLY,
341 &ompi_mpi_spc_dump_enabled);
342
343 return OMPI_SUCCESS;
344 }
345
346 int ompi_show_all_mca_params(int32_t rank, int requested, char *nodename) {
347 const mca_base_var_t *var;
348 int var_count, i, ret;
349 FILE *fp = NULL;
350 time_t timestamp;
351 char **var_dump;
352
353 if (rank != 0) {
354 return OMPI_SUCCESS;
355 }
356
357 timestamp = time(NULL);
358
359
360 if (NULL != ompi_mpi_show_mca_params_file &&
361 0 != strlen(ompi_mpi_show_mca_params_file)) {
362 if ( NULL == (fp = fopen(ompi_mpi_show_mca_params_file, "w")) ) {
363 opal_output(0, "Unable to open file <%s> to write MCA parameters", ompi_mpi_show_mca_params_file);
364 return OMPI_ERR_FILE_OPEN_FAILURE;
365 }
366 fprintf(fp, "#\n");
367 fprintf(fp, "# This file was automatically generated on %s", ctime(×tamp));
368 fprintf(fp, "# by MPI_COMM_WORLD rank %d (out of a total of %d) on %s\n", rank, requested, nodename );
369 fprintf(fp, "#\n");
370 }
371
372 var_count = mca_base_var_get_count ();
373 for (i = 0 ; i < var_count ; ++i) {
374 ret = mca_base_var_get (i, &var);
375 if (OPAL_SUCCESS != ret) {
376 continue;
377 }
378
379
380 if (MCA_BASE_VAR_FLAG_INTERNAL & var->mbv_flags) {
381 continue;
382 }
383
384
385
386
387 if (MCA_BASE_VAR_SOURCE_DEFAULT == var->mbv_source && !show_default_mca_params) {
388 continue;
389 }
390
391
392
393
394 if ((MCA_BASE_VAR_SOURCE_FILE == var->mbv_source ||
395 MCA_BASE_VAR_SOURCE_OVERRIDE == var->mbv_source) &&
396 !show_file_mca_params) {
397 continue;
398 }
399
400
401
402
403 if (MCA_BASE_VAR_SOURCE_ENV == var->mbv_source && !show_enviro_mca_params) {
404 continue;
405 }
406
407
408
409
410 if (MCA_BASE_VAR_SOURCE_OVERRIDE == var->mbv_source && !show_override_mca_params) {
411 continue;
412 }
413
414 ret = mca_base_var_dump (i, &var_dump, MCA_BASE_VAR_DUMP_SIMPLE);
415 if (OPAL_SUCCESS != ret) {
416 continue;
417 }
418
419
420 if (NULL != ompi_mpi_show_mca_params_file &&
421 0 != strlen(ompi_mpi_show_mca_params_file)) {
422 fprintf(fp, "%s\n", var_dump[0]);
423 } else {
424 opal_output(0, "%s\n", var_dump[0]);
425 }
426 free (var_dump[0]);
427 free (var_dump);
428 }
429
430
431 if (NULL != ompi_mpi_show_mca_params_file &&
432 0 != strlen(ompi_mpi_show_mca_params_file)) {
433 fclose(fp);
434 }
435
436 return OMPI_SUCCESS;
437 }