This source file includes following definitions.
- _process_name_print_for_opal
- _process_name_compare
- _convert_string_to_process_name
- _convert_process_name_to_string
- ompi_mpi_thread_level
- ompi_register_mca_variables
- fence_release
- ompi_mpi_init
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 #include "ompi_config.h"
35
36 #ifdef HAVE_SYS_TIME_H
37 #include <sys/time.h>
38 #endif
39 #include <pthread.h>
40 #ifdef HAVE_UNISTD_H
41 #include <unistd.h>
42 #endif
43
44 #include "mpi.h"
45 #include "opal/class/opal_list.h"
46 #include "opal/mca/base/base.h"
47 #include "opal/mca/hwloc/base/base.h"
48 #include "opal/runtime/opal_progress.h"
49 #include "opal/threads/threads.h"
50 #include "opal/util/arch.h"
51 #include "opal/util/argv.h"
52 #include "opal/util/output.h"
53 #include "opal/util/error.h"
54 #include "opal/util/stacktrace.h"
55 #include "opal/util/show_help.h"
56 #include "opal/runtime/opal.h"
57 #include "opal/mca/event/event.h"
58 #include "opal/mca/allocator/base/base.h"
59 #include "opal/mca/rcache/base/base.h"
60 #include "opal/mca/rcache/rcache.h"
61 #include "opal/mca/mpool/base/base.h"
62 #include "opal/mca/btl/base/base.h"
63 #include "opal/mca/pmix/base/base.h"
64 #include "opal/util/timings.h"
65 #include "opal/util/opal_environ.h"
66
67 #include "ompi/constants.h"
68 #include "ompi/mpi/fortran/base/constants.h"
69 #include "ompi/runtime/mpiruntime.h"
70 #include "ompi/runtime/params.h"
71 #include "ompi/communicator/communicator.h"
72 #include "ompi/info/info.h"
73 #include "ompi/errhandler/errcode.h"
74 #include "ompi/errhandler/errhandler.h"
75 #include "ompi/interlib/interlib.h"
76 #include "ompi/request/request.h"
77 #include "ompi/message/message.h"
78 #include "ompi/op/op.h"
79 #include "ompi/mca/op/op.h"
80 #include "ompi/mca/op/base/base.h"
81 #include "ompi/file/file.h"
82 #include "ompi/attribute/attribute.h"
83 #include "ompi/mca/pml/pml.h"
84 #include "ompi/mca/bml/bml.h"
85 #include "ompi/mca/pml/base/base.h"
86 #include "ompi/mca/bml/base/base.h"
87 #include "ompi/mca/osc/base/base.h"
88 #include "ompi/mca/coll/base/base.h"
89 #include "ompi/mca/io/io.h"
90 #include "ompi/mca/io/base/base.h"
91 #include "ompi/mca/rte/rte.h"
92 #include "ompi/mca/rte/base/base.h"
93 #include "ompi/debuggers/debuggers.h"
94 #include "ompi/proc/proc.h"
95 #include "ompi/mca/pml/base/pml_base_bsend.h"
96 #include "ompi/dpm/dpm.h"
97 #include "ompi/mpiext/mpiext.h"
98 #include "ompi/mca/hook/base/base.h"
99 #include "ompi/util/timings.h"
100
101 #if OPAL_ENABLE_FT_CR == 1
102 #include "ompi/mca/crcp/crcp.h"
103 #include "ompi/mca/crcp/base/base.h"
104 #endif
105 #include "ompi/runtime/ompi_cr.h"
106
107
108 #ifdef HAVE___MALLOC_INITIALIZE_HOOK
109 #include "opal/mca/memory/base/base.h"
110
111
112
113
114 OPAL_DECLSPEC void (*__malloc_initialize_hook) (void) =
115 opal_memory_base_malloc_init_hook;
116 #endif
117
118
119
120
121 #include <float.h>
122
123 #if OPAL_CC_USE_PRAGMA_IDENT
124 #pragma ident OMPI_IDENT_STRING
125 #elif OPAL_CC_USE_IDENT
126 #ident OMPI_IDENT_STRING
127 #endif
128 const char ompi_version_string[] = OMPI_IDENT_STRING;
129
130
131
132
133
134 opal_atomic_int32_t ompi_mpi_state = OMPI_MPI_STATE_NOT_INITIALIZED;
135 volatile bool ompi_rte_initialized = false;
136
137 bool ompi_mpi_thread_multiple = false;
138 int ompi_mpi_thread_requested = MPI_THREAD_SINGLE;
139 int ompi_mpi_thread_provided = MPI_THREAD_SINGLE;
140
141 opal_thread_t *ompi_mpi_main_thread = NULL;
142
143
144
145
146
147
148
149 ompi_predefined_datatype_t *ompi_mpi_character_addr = &ompi_mpi_character;
150 ompi_predefined_datatype_t *ompi_mpi_logical_addr = &ompi_mpi_logical;
151 ompi_predefined_datatype_t *ompi_mpi_logical1_addr = &ompi_mpi_logical1;
152 ompi_predefined_datatype_t *ompi_mpi_logical2_addr = &ompi_mpi_logical2;
153 ompi_predefined_datatype_t *ompi_mpi_logical4_addr = &ompi_mpi_logical4;
154 ompi_predefined_datatype_t *ompi_mpi_logical8_addr = &ompi_mpi_logical8;
155 ompi_predefined_datatype_t *ompi_mpi_integer_addr = &ompi_mpi_integer;
156 ompi_predefined_datatype_t *ompi_mpi_integer1_addr = &ompi_mpi_integer1;
157 ompi_predefined_datatype_t *ompi_mpi_integer2_addr = &ompi_mpi_integer2;
158 ompi_predefined_datatype_t *ompi_mpi_integer4_addr = &ompi_mpi_integer4;
159 ompi_predefined_datatype_t *ompi_mpi_integer8_addr = &ompi_mpi_integer8;
160 ompi_predefined_datatype_t *ompi_mpi_integer16_addr = &ompi_mpi_integer16;
161 ompi_predefined_datatype_t *ompi_mpi_real_addr = &ompi_mpi_real;
162 ompi_predefined_datatype_t *ompi_mpi_real2_addr = &ompi_mpi_real2;
163 ompi_predefined_datatype_t *ompi_mpi_real4_addr = &ompi_mpi_real4;
164 ompi_predefined_datatype_t *ompi_mpi_real8_addr = &ompi_mpi_real8;
165 ompi_predefined_datatype_t *ompi_mpi_real16_addr = &ompi_mpi_real16;
166 ompi_predefined_datatype_t *ompi_mpi_dblprec_addr = &ompi_mpi_dblprec;
167 ompi_predefined_datatype_t *ompi_mpi_cplex_addr = &ompi_mpi_cplex;
168 ompi_predefined_datatype_t *ompi_mpi_complex4_addr = &ompi_mpi_complex4;
169 ompi_predefined_datatype_t *ompi_mpi_complex8_addr = &ompi_mpi_complex8;
170 ompi_predefined_datatype_t *ompi_mpi_complex16_addr = &ompi_mpi_complex16;
171 ompi_predefined_datatype_t *ompi_mpi_complex32_addr = &ompi_mpi_complex32;
172 ompi_predefined_datatype_t *ompi_mpi_dblcplex_addr = &ompi_mpi_dblcplex;
173 ompi_predefined_datatype_t *ompi_mpi_2real_addr = &ompi_mpi_2real;
174 ompi_predefined_datatype_t *ompi_mpi_2dblprec_addr = &ompi_mpi_2dblprec;
175 ompi_predefined_datatype_t *ompi_mpi_2integer_addr = &ompi_mpi_2integer;
176
177 struct ompi_status_public_t *ompi_mpi_status_ignore_addr =
178 (ompi_status_public_t *) 0;
179 struct ompi_status_public_t *ompi_mpi_statuses_ignore_addr =
180 (ompi_status_public_t *) 0;
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219 #if OMPI_BUILD_FORTRAN_BINDINGS
220 # if OMPI_FORTRAN_CAPS
221 MPI_Fint *MPI_F_STATUS_IGNORE = (MPI_Fint*) &MPI_FORTRAN_STATUS_IGNORE;
222 MPI_Fint *MPI_F_STATUSES_IGNORE = (MPI_Fint*) &MPI_FORTRAN_STATUSES_IGNORE;
223 # elif OMPI_FORTRAN_PLAIN
224 MPI_Fint *MPI_F_STATUS_IGNORE = (MPI_Fint*) &mpi_fortran_status_ignore;
225 MPI_Fint *MPI_F_STATUSES_IGNORE = (MPI_Fint*) &mpi_fortran_statuses_ignore;
226 # elif OMPI_FORTRAN_SINGLE_UNDERSCORE
227 MPI_Fint *MPI_F_STATUS_IGNORE = (MPI_Fint*) &mpi_fortran_status_ignore_;
228 MPI_Fint *MPI_F_STATUSES_IGNORE = (MPI_Fint*) &mpi_fortran_statuses_ignore_;
229 # elif OMPI_FORTRAN_DOUBLE_UNDERSCORE
230 MPI_Fint *MPI_F_STATUS_IGNORE = (MPI_Fint*) &mpi_fortran_status_ignore__;
231 MPI_Fint *MPI_F_STATUSES_IGNORE = (MPI_Fint*) &mpi_fortran_statuses_ignore__;
232 # else
233 # error Unrecognized Fortran name mangling scheme
234 # endif
235 #else
236 MPI_Fint *MPI_F_STATUS_IGNORE = NULL;
237 MPI_Fint *MPI_F_STATUSES_IGNORE = NULL;
238 #endif
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266 #include "mpif-c-constants.h"
267
268
269
270
271 opal_hash_table_t ompi_mpi_f90_integer_hashtable = {{0}};
272 opal_hash_table_t ompi_mpi_f90_real_hashtable = {{0}};
273 opal_hash_table_t ompi_mpi_f90_complex_hashtable = {{0}};
274
275
276
277
278
279
280
281
282 opal_list_t ompi_registered_datareps = {{0}};
283
284 bool ompi_enable_timing = false;
285 extern bool ompi_mpi_yield_when_idle;
286 extern int ompi_mpi_event_tick_rate;
287
288
289
290
291
292 static char*
293 _process_name_print_for_opal(const opal_process_name_t procname)
294 {
295 ompi_process_name_t* rte_name = (ompi_process_name_t*)&procname;
296 return OMPI_NAME_PRINT(rte_name);
297 }
298
299 static int
300 _process_name_compare(const opal_process_name_t p1, const opal_process_name_t p2)
301 {
302 ompi_process_name_t* o1 = (ompi_process_name_t*)&p1;
303 ompi_process_name_t* o2 = (ompi_process_name_t*)&p2;
304 return ompi_rte_compare_name_fields(OMPI_RTE_CMP_ALL, o1, o2);
305 }
306
307 static int _convert_string_to_process_name(opal_process_name_t *name,
308 const char* name_string)
309 {
310 return ompi_rte_convert_string_to_process_name(name, name_string);
311 }
312
313 static int _convert_process_name_to_string(char** name_string,
314 const opal_process_name_t *name)
315 {
316 return ompi_rte_convert_process_name_to_string(name_string, name);
317 }
318
319 void ompi_mpi_thread_level(int requested, int *provided)
320 {
321
322
323
324
325
326
327
328
329
330 ompi_mpi_thread_requested = requested;
331
332 ompi_mpi_thread_provided = *provided = requested;
333
334 if (!ompi_mpi_main_thread) {
335 ompi_mpi_main_thread = opal_thread_get_self();
336 }
337
338 ompi_mpi_thread_multiple = (ompi_mpi_thread_provided ==
339 MPI_THREAD_MULTIPLE);
340 }
341
342 static int ompi_register_mca_variables(void)
343 {
344 int ret;
345
346
347 if (OMPI_SUCCESS != (ret = ompi_mpi_register_params())) {
348 return ret;
349 }
350
351
352
353
354
355 ompi_enable_timing = false;
356 (void) mca_base_var_register("ompi", "ompi", NULL, "timing",
357 "Request that critical timing loops be measured",
358 MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
359 OPAL_INFO_LVL_9,
360 MCA_BASE_VAR_SCOPE_READONLY,
361 &ompi_enable_timing);
362
363 return OMPI_SUCCESS;
364 }
365
366 static void fence_release(int status, void *cbdata)
367 {
368 volatile bool *active = (volatile bool*)cbdata;
369 OPAL_ACQUIRE_OBJECT(active);
370 *active = false;
371 OPAL_POST_OBJECT(active);
372 }
373
374 int ompi_mpi_init(int argc, char **argv, int requested, int *provided,
375 bool reinit_ok)
376 {
377 int ret;
378 ompi_proc_t** procs;
379 size_t nprocs;
380 char *error = NULL;
381 ompi_errhandler_errtrk_t errtrk;
382 opal_list_t info;
383 opal_value_t *kv;
384 volatile bool active;
385 bool background_fence = false;
386
387 OMPI_TIMING_INIT(64);
388
389 ompi_hook_base_mpi_init_top(argc, argv, requested, provided);
390
391
392 int32_t expected = OMPI_MPI_STATE_NOT_INITIALIZED;
393 int32_t desired = OMPI_MPI_STATE_INIT_STARTED;
394 opal_atomic_wmb();
395 if (!opal_atomic_compare_exchange_strong_32(&ompi_mpi_state, &expected,
396 desired)) {
397
398
399
400 if (expected >= OMPI_MPI_STATE_FINALIZE_STARTED) {
401 opal_show_help("help-mpi-runtime.txt",
402 "mpi_init: already finalized", true);
403 return MPI_ERR_OTHER;
404 } else if (expected >= OMPI_MPI_STATE_INIT_STARTED) {
405
406
407
408
409 if (reinit_ok) {
410 while (ompi_mpi_state < OMPI_MPI_STATE_INIT_COMPLETED) {
411 usleep(1);
412 }
413 return MPI_SUCCESS;
414 }
415
416 opal_show_help("help-mpi-runtime.txt",
417 "mpi_init: invoked multiple times", true);
418 return MPI_ERR_OTHER;
419 }
420 }
421
422
423
424
425
426
427
428 ompi_mpi_thread_level(requested, provided);
429
430
431 if (OPAL_SUCCESS != (ret = opal_init_util(&argc, &argv))) {
432 error = "ompi_mpi_init: opal_init_util failed";
433 goto error;
434 }
435 OMPI_TIMING_IMPORT_OPAL("opal_init_util");
436
437
438
439 if (*provided != MPI_THREAD_SINGLE) {
440 opal_set_using_threads(true);
441 }
442
443
444 opal_process_name_print = _process_name_print_for_opal;
445 opal_compare_proc = _process_name_compare;
446 opal_convert_string_to_process_name = _convert_string_to_process_name;
447 opal_convert_process_name_to_string = _convert_process_name_to_string;
448 opal_proc_for_name = ompi_proc_for_name;
449
450
451 if (OPAL_SUCCESS != (ret = ompi_register_mca_variables())) {
452 error = "ompi_mpi_init: ompi_register_mca_variables failed";
453 goto error;
454 }
455
456 if (OPAL_SUCCESS != (ret = opal_arch_set_fortran_logical_size(sizeof(ompi_fortran_logical_t)))) {
457 error = "ompi_mpi_init: opal_arch_set_fortran_logical_size failed";
458 goto error;
459 }
460
461
462
463
464
465
466
467
468
469 ret = mca_base_var_find("opal", "event", "*", "event_include");
470 if (ret >= 0) {
471 char *allvalue = "all";
472
473
474
475
476
477
478
479
480
481
482
483
484 mca_base_var_set_value(ret, allvalue, 4, MCA_BASE_VAR_SOURCE_DEFAULT, NULL);
485 }
486
487
488 if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_hook_base_framework, 0))) {
489 error = "ompi_hook_base_open() failed";
490 goto error;
491 }
492
493 ompi_hook_base_mpi_init_top_post_opal(argc, argv, requested, provided);
494
495
496 OMPI_TIMING_NEXT("initialization");
497
498
499
500
501
502
503 if (NULL == getenv("OMPI_COMMAND") && NULL != argv && NULL != argv[0]) {
504 opal_setenv("OMPI_COMMAND", argv[0], true, &environ);
505 }
506 if (NULL == getenv("OMPI_ARGV") && 1 < argc) {
507 char *tmp;
508 tmp = opal_argv_join(&argv[1], ' ');
509 opal_setenv("OMPI_ARGV", tmp, true, &environ);
510 free(tmp);
511 }
512
513
514 if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_rte_base_framework, 0))) {
515 error = "ompi_rte_base_open() failed";
516 goto error;
517 }
518
519
520
521 if (OMPI_SUCCESS != (ret = ompi_rte_init(NULL, NULL))) {
522 error = "ompi_mpi_init: ompi_rte_init failed";
523 goto error;
524 }
525 OMPI_TIMING_NEXT("rte_init");
526 OMPI_TIMING_IMPORT_OPAL("orte_ess_base_app_setup");
527 OMPI_TIMING_IMPORT_OPAL("rte_init");
528
529 ompi_rte_initialized = true;
530
531
532 errtrk.status = OPAL_ERROR;
533 errtrk.active = true;
534
535 OBJ_CONSTRUCT(&info, opal_list_t);
536 kv = OBJ_NEW(opal_value_t);
537 kv->key = strdup(OPAL_PMIX_EVENT_HDLR_PREPEND);
538 opal_list_append(&info, &kv->super);
539
540 kv = OBJ_NEW(opal_value_t);
541 kv->key = strdup(OPAL_PMIX_EVENT_HDLR_NAME);
542 kv->type = OPAL_STRING;
543 kv->data.string = strdup("MPI-Default");
544 opal_list_append(&info, &kv->super);
545 opal_pmix.register_evhandler(NULL, &info, ompi_errhandler_callback,
546 ompi_errhandler_registration_callback,
547 (void*)&errtrk);
548 OMPI_LAZY_WAIT_FOR_COMPLETION(errtrk.active);
549
550 OPAL_LIST_DESTRUCT(&info);
551 if (OPAL_SUCCESS != errtrk.status) {
552 error = "Error handler registration";
553 ret = errtrk.status;
554 goto error;
555 }
556
557
558
559 if (OMPI_SUCCESS != (ret = ompi_interlib_declare(*provided, OMPI_IDENT_STRING))) {
560 error = "ompi_interlib_declare";
561 goto error;
562 }
563
564
565
566
567
568 if (OMPI_SUCCESS != (ret = ompi_datatype_init())) {
569 error = "ompi_datatype_init() failed";
570 goto error;
571 }
572
573
574 if (OMPI_SUCCESS != (ret = ompi_proc_init())) {
575 error = "mca_proc_init() failed";
576 goto error;
577 }
578
579
580
581
582
583 if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_op_base_framework, 0))) {
584 error = "ompi_op_base_open() failed";
585 goto error;
586 }
587 if (OMPI_SUCCESS !=
588 (ret = ompi_op_base_find_available(OPAL_ENABLE_PROGRESS_THREADS,
589 ompi_mpi_thread_multiple))) {
590 error = "ompi_op_base_find_available() failed";
591 goto error;
592 }
593 if (OMPI_SUCCESS != (ret = ompi_op_init())) {
594 error = "ompi_op_init() failed";
595 goto error;
596 }
597
598
599
600 if (OMPI_SUCCESS != (ret = mca_base_framework_open(&opal_allocator_base_framework, 0))) {
601 error = "mca_allocator_base_open() failed";
602 goto error;
603 }
604 if (OMPI_SUCCESS != (ret = mca_base_framework_open(&opal_rcache_base_framework, 0))) {
605 error = "mca_rcache_base_open() failed";
606 goto error;
607 }
608 if (OMPI_SUCCESS != (ret = mca_base_framework_open(&opal_mpool_base_framework, 0))) {
609 error = "mca_mpool_base_open() failed";
610 goto error;
611 }
612 if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_bml_base_framework, 0))) {
613 error = "mca_bml_base_open() failed";
614 goto error;
615 }
616 if (OMPI_SUCCESS != (ret = mca_bml_base_init (1, ompi_mpi_thread_multiple))) {
617 error = "mca_bml_base_init() failed";
618 goto error;
619 }
620 if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_pml_base_framework, 0))) {
621 error = "mca_pml_base_open() failed";
622 goto error;
623 }
624 if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_coll_base_framework, 0))) {
625 error = "mca_coll_base_open() failed";
626 goto error;
627 }
628
629 if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_osc_base_framework, 0))) {
630 error = "ompi_osc_base_open() failed";
631 goto error;
632 }
633
634 #if OPAL_ENABLE_FT_CR == 1
635 if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_crcp_base_framework, 0))) {
636 error = "ompi_crcp_base_open() failed";
637 goto error;
638 }
639 #endif
640
641
642
643
644
645
646
647
648
649 if (OMPI_SUCCESS !=
650 (ret = mca_pml_base_select(OPAL_ENABLE_PROGRESS_THREADS,
651 ompi_mpi_thread_multiple))) {
652 error = "mca_pml_base_select() failed";
653 goto error;
654 }
655
656 OMPI_TIMING_IMPORT_OPAL("orte_init");
657 OMPI_TIMING_NEXT("rte_init-commit");
658
659
660
661
662
663 opal_pmix.commit();
664 OMPI_TIMING_NEXT("commit");
665 #if (OPAL_ENABLE_TIMING)
666 if (OMPI_TIMING_ENABLED && !opal_pmix_base_async_modex &&
667 opal_pmix_collect_all_data) {
668 if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) {
669 error = "timing: pmix-barrier-1 failed";
670 goto error;
671 }
672 OMPI_TIMING_NEXT("pmix-barrier-1");
673 if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) {
674 error = "timing: pmix-barrier-2 failed";
675 goto error;
676 }
677 OMPI_TIMING_NEXT("pmix-barrier-2");
678 }
679 #endif
680
681
682
683
684
685
686
687
688
689
690
691
692 if (NULL != opal_pmix.fence_nb) {
693 if (opal_pmix_base_async_modex && opal_pmix_collect_all_data) {
694
695
696 background_fence = true;
697 active = true;
698 OPAL_POST_OBJECT(&active);
699 if( OMPI_SUCCESS != (ret = opal_pmix.fence_nb(NULL, true,
700 fence_release,
701 (void*)&active))) {
702 error = "opal_pmix.fence_nb() failed";
703 goto error;
704 }
705
706 } else if (!opal_pmix_base_async_modex) {
707
708 active = true;
709 OPAL_POST_OBJECT(&active);
710 if( OMPI_SUCCESS != (ret = opal_pmix.fence_nb(NULL,
711 opal_pmix_collect_all_data, fence_release, (void*)&active))) {
712 error = "opal_pmix.fence_nb() failed";
713 goto error;
714 }
715
716 OMPI_LAZY_WAIT_FOR_COMPLETION(active);
717 }
718
719 } else if (!opal_pmix_base_async_modex || opal_pmix_collect_all_data) {
720 if( OMPI_SUCCESS != (ret = opal_pmix.fence(NULL,
721 opal_pmix_collect_all_data))) {
722 error = "opal_pmix.fence() failed";
723 goto error;
724 }
725 }
726
727 OMPI_TIMING_NEXT("modex");
728
729
730 if( OMPI_SUCCESS !=
731 (ret = mca_pml_base_bsend_init(ompi_mpi_thread_multiple))) {
732 error = "mca_pml_base_bsend_init() failed";
733 goto error;
734 }
735
736 if (OMPI_SUCCESS !=
737 (ret = mca_coll_base_find_available(OPAL_ENABLE_PROGRESS_THREADS,
738 ompi_mpi_thread_multiple))) {
739 error = "mca_coll_base_find_available() failed";
740 goto error;
741 }
742
743 if (OMPI_SUCCESS !=
744 (ret = ompi_osc_base_find_available(OPAL_ENABLE_PROGRESS_THREADS,
745 ompi_mpi_thread_multiple))) {
746 error = "ompi_osc_base_find_available() failed";
747 goto error;
748 }
749
750 #if OPAL_ENABLE_FT_CR == 1
751 if (OMPI_SUCCESS != (ret = ompi_crcp_base_select() ) ) {
752 error = "ompi_crcp_base_select() failed";
753 goto error;
754 }
755 #endif
756
757
758
759
760
761
762 if (OMPI_SUCCESS != (ret = ompi_request_init())) {
763 error = "ompi_request_init() failed";
764 goto error;
765 }
766
767 if (OMPI_SUCCESS != (ret = ompi_message_init())) {
768 error = "ompi_message_init() failed";
769 goto error;
770 }
771
772
773 if (OMPI_SUCCESS != (ret = ompi_mpiinfo_init())) {
774 error = "ompi_info_init() failed";
775 goto error;
776 }
777
778
779 if (OMPI_SUCCESS != (ret = ompi_errhandler_init())) {
780 error = "ompi_errhandler_init() failed";
781 goto error;
782 }
783
784
785 if (OMPI_SUCCESS != (ret = ompi_mpi_errcode_init())) {
786 error = "ompi_mpi_errcode_init() failed";
787 goto error;
788 }
789
790
791 if (OMPI_SUCCESS != (ret = ompi_errcode_intern_init())) {
792 error = "ompi_errcode_intern_init() failed";
793 goto error;
794 }
795
796
797 if (OMPI_SUCCESS != (ret = ompi_group_init())) {
798 error = "ompi_group_init() failed";
799 goto error;
800 }
801
802
803 if (OMPI_SUCCESS != (ret = ompi_comm_init())) {
804 error = "ompi_comm_init() failed";
805 goto error;
806 }
807
808
809 if (OMPI_SUCCESS != (ret = ompi_file_init())) {
810 error = "ompi_file_init() failed";
811 goto error;
812 }
813
814
815 if (OMPI_SUCCESS != (ret = ompi_win_init())) {
816 error = "ompi_win_init() failed";
817 goto error;
818 }
819
820
821 if (OMPI_SUCCESS != (ret = ompi_attr_init())) {
822 error = "ompi_attr_init() failed";
823 goto error;
824 }
825
826
827
828
829 if (OMPI_SUCCESS != (ret = ompi_proc_complete_init())) {
830 error = "ompi_proc_complete_init failed";
831 goto error;
832 }
833
834
835 ret = MCA_PML_CALL(enable(true));
836 if( OMPI_SUCCESS != ret ) {
837 error = "PML control failed";
838 goto error;
839 }
840
841
842
843
844 if (mca_pml_base_requires_world ()) {
845 if (NULL == (procs = ompi_proc_world (&nprocs))) {
846 error = "ompi_proc_get_allocated () failed";
847 goto error;
848 }
849 } else {
850
851
852 if (NULL == (procs = ompi_proc_get_allocated (&nprocs))) {
853 error = "ompi_proc_get_allocated () failed";
854 goto error;
855 }
856 }
857 ret = MCA_PML_CALL(add_procs(procs, nprocs));
858 free(procs);
859
860
861
862 if (OMPI_ERR_UNREACH == ret) {
863 opal_show_help("help-mpi-runtime.txt",
864 "mpi_init:startup:pml-add-procs-fail", true);
865 error = NULL;
866 goto error;
867 } else if (OMPI_SUCCESS != ret) {
868 error = "PML add procs failed";
869 goto error;
870 }
871
872 MCA_PML_CALL(add_comm(&ompi_mpi_comm_world.comm));
873 MCA_PML_CALL(add_comm(&ompi_mpi_comm_self.comm));
874
875
876
877
878 if (ompi_mpi_show_mca_params) {
879 ompi_show_all_mca_params(ompi_mpi_comm_world.comm.c_my_rank,
880 nprocs,
881 ompi_process_info.nodename);
882 }
883
884
885 ompi_rte_wait_for_debugger();
886
887
888 OMPI_TIMING_NEXT("modex-barrier");
889
890
891
892
893 if (background_fence) {
894 OMPI_LAZY_WAIT_FOR_COMPLETION(active);
895 } else if (!ompi_async_mpi_init) {
896
897
898
899 if (NULL != opal_pmix.fence_nb) {
900 active = true;
901 OPAL_POST_OBJECT(&active);
902 if (OMPI_SUCCESS != (ret = opal_pmix.fence_nb(NULL, false,
903 fence_release, (void*)&active))) {
904 error = "opal_pmix.fence_nb() failed";
905 goto error;
906 }
907 OMPI_LAZY_WAIT_FOR_COMPLETION(active);
908 } else {
909 if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, false))) {
910 error = "opal_pmix.fence() failed";
911 goto error;
912 }
913 }
914 }
915
916
917
918 OMPI_TIMING_NEXT("barrier");
919
920 #if OPAL_ENABLE_PROGRESS_THREADS == 0
921
922
923
924
925
926
927 opal_progress_set_event_flag(OPAL_EVLOOP_NONBLOCK);
928 #endif
929
930
931
932
933
934 if (OMPI_SUCCESS != (ret = ompi_init_preconnect_mpi())) {
935 error = "ompi_mpi_do_preconnect_all() failed";
936 goto error;
937 }
938
939
940 if (OMPI_SUCCESS != (ret = ompi_dpm_init())) {
941 error = "ompi_dpm_init() failed";
942 goto error;
943 }
944
945
946
947
948
949
950
951 if (OMPI_SUCCESS != ( ret = ompi_comm_cid_init ())) {
952 error = "ompi_mpi_init: ompi_comm_cid_init failed";
953 goto error;
954 }
955
956
957
958
959
960 if (OMPI_SUCCESS !=
961 (ret = mca_coll_base_comm_select(MPI_COMM_WORLD))) {
962 error = "mca_coll_base_comm_select(MPI_COMM_WORLD) failed";
963 goto error;
964 }
965
966 if (OMPI_SUCCESS !=
967 (ret = mca_coll_base_comm_select(MPI_COMM_SELF))) {
968 error = "mca_coll_base_comm_select(MPI_COMM_SELF) failed";
969 goto error;
970 }
971
972
973
974
975 if (OMPI_SUCCESS != (ret = ompi_dpm_dyn_init())) {
976 error = "ompi_dpm_dyn_init() failed";
977 goto error;
978 }
979
980
981
982
983
984
985 if (OMPI_SUCCESS != (ret = ompi_cr_init())) {
986 error = "ompi_cr_init";
987 goto error;
988 }
989
990
991
992
993
994
995 opal_progress_event_users_decrement();
996
997
998 opal_progress_set_yield_when_idle(ompi_mpi_yield_when_idle);
999
1000
1001 if (ompi_mpi_event_tick_rate >= 0) {
1002 opal_progress_set_event_poll_rate(ompi_mpi_event_tick_rate);
1003 }
1004
1005
1006
1007
1008
1009
1010 if (OMPI_SUCCESS != (ret = ompi_mpiext_init())) {
1011 error = "ompi_mpiext_init";
1012 goto error;
1013 }
1014
1015
1016 error:
1017 if (ret != OMPI_SUCCESS) {
1018
1019 if (NULL != error && OMPI_ERR_SILENT != ret) {
1020 const char *err_msg = opal_strerror(ret);
1021 opal_show_help("help-mpi-runtime.txt",
1022 "mpi_init:startup:internal-failure", true,
1023 "MPI_INIT", "MPI_INIT", error, err_msg, ret);
1024 }
1025 ompi_hook_base_mpi_init_error(argc, argv, requested, provided);
1026 OMPI_TIMING_FINALIZE;
1027 return ret;
1028 }
1029
1030
1031 OBJ_CONSTRUCT(&ompi_registered_datareps, opal_list_t);
1032
1033
1034
1035
1036 OBJ_CONSTRUCT( &ompi_mpi_f90_integer_hashtable, opal_hash_table_t);
1037 opal_hash_table_init(&ompi_mpi_f90_integer_hashtable, 16 );
1038
1039 OBJ_CONSTRUCT( &ompi_mpi_f90_real_hashtable, opal_hash_table_t);
1040 opal_hash_table_init(&ompi_mpi_f90_real_hashtable, FLT_MAX_10_EXP);
1041
1042 OBJ_CONSTRUCT( &ompi_mpi_f90_complex_hashtable, opal_hash_table_t);
1043 opal_hash_table_init(&ompi_mpi_f90_complex_hashtable, FLT_MAX_10_EXP);
1044
1045
1046 opal_atomic_wmb();
1047 opal_atomic_swap_32(&ompi_mpi_state, OMPI_MPI_STATE_INIT_COMPLETED);
1048
1049
1050
1051 OMPI_TIMING_NEXT("barrier-finish");
1052 OMPI_TIMING_OUT;
1053 OMPI_TIMING_FINALIZE;
1054
1055 ompi_hook_base_mpi_init_bottom(argc, argv, requested, provided);
1056
1057 return MPI_SUCCESS;
1058 }