1
1
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2
2
/*
3
- * Copyright (c) 2018-2022 Triad National Security, LLC. All rights
3
+ * Copyright (c) 2018-2023 Triad National Security, LLC. All rights
4
4
* reserved.
5
5
* Copyright (c) 2022 Cisco Systems, Inc. All rights reserved.
6
6
* $COPYRIGHT$
18
18
#include "opal/util/show_help.h"
19
19
#include "opal/util/argv.h"
20
20
#include "opal/runtime/opal_params.h"
21
+ #include "opal/util/timings.h"
22
+ #include "opal/mca/allocator/base/base.h"
23
+ #include "opal/mca/rcache/base/base.h"
24
+ #include "opal/mca/mpool/base/base.h"
25
+ #include "opal/mca/smsc/base/base.h"
26
+ #include "opal/mca/mpool/base/mpool_base_tree.h"
27
+ #include "opal/mca/pmix/pmix-internal.h"
28
+ #include "opal/mca/pmix/base/base.h"
21
29
22
30
#include "ompi/mca/pml/pml.h"
23
31
#include "ompi/runtime/params.h"
33
41
#include "ompi/dpm/dpm.h"
34
42
#include "ompi/file/file.h"
35
43
#include "ompi/mpiext/mpiext.h"
44
+ #include "ompi/util/timings.h"
36
45
37
46
#include "ompi/mca/hook/base/base.h"
38
47
#include "ompi/mca/op/base/base.h"
39
- #include "opal/mca/allocator/base/base.h"
40
- #include "opal/mca/rcache/base/base.h"
41
- #include "opal/mca/mpool/base/base.h"
42
- #include "opal/mca/smsc/base/base.h"
43
48
#include "ompi/mca/bml/base/base.h"
44
49
#include "ompi/mca/pml/base/base.h"
45
50
#include "ompi/mca/coll/base/base.h"
46
51
#include "ompi/mca/osc/base/base.h"
47
52
#include "ompi/mca/part/base/base.h"
48
53
#include "ompi/mca/io/base/base.h"
49
54
#include "ompi/mca/topo/base/base.h"
50
- #include "opal/mca/pmix/base/base.h"
51
55
52
- #include "opal/mca/mpool/base/mpool_base_tree.h"
53
56
#include "ompi/mca/pml/base/pml_base_bsend.h"
54
- #include "ompi/util/timings.h"
55
- #include "opal/mca/pmix/pmix-internal.h"
56
57
57
58
ompi_predefined_instance_t ompi_mpi_instance_null = {{{{0 }}}};
58
59
@@ -341,7 +342,8 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
341
342
pmix_info_t info [2 ];
342
343
pmix_status_t rc ;
343
344
opal_pmix_lock_t mylock ;
344
- OMPI_TIMING_INIT (64 );
345
+
346
+ OPAL_TIMING_ENV_INIT (init_common );
345
347
346
348
ret = ompi_mpi_instance_retain ();
347
349
if (OPAL_UNLIKELY (OMPI_SUCCESS != ret )) {
@@ -382,13 +384,15 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
382
384
mca_base_var_set_value (ret , allvalue , 4 , MCA_BASE_VAR_SOURCE_DEFAULT , NULL );
383
385
}
384
386
385
- OMPI_TIMING_NEXT ( "initialization" );
387
+ OPAL_TIMING_ENV_NEXT ( init_common , "initialization" );
386
388
387
389
/* Setup RTE */
388
390
if (OMPI_SUCCESS != (ret = ompi_rte_init (& argc , & argv ))) {
389
391
return ompi_instance_print_error ("ompi_mpi_init: ompi_rte_init failed" , ret );
390
392
}
391
393
394
+ OPAL_TIMING_ENV_NEXT (init_common , "ompi_rte_init" );
395
+
392
396
/* open the ompi hook framework */
393
397
for (int i = 0 ; ompi_framework_dependencies [i ] ; ++ i ) {
394
398
ret = mca_base_framework_open (ompi_framework_dependencies [i ], 0 );
@@ -401,10 +405,6 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
401
405
}
402
406
}
403
407
404
- OMPI_TIMING_NEXT ("rte_init" );
405
- OMPI_TIMING_IMPORT_OPAL ("orte_ess_base_app_setup" );
406
- OMPI_TIMING_IMPORT_OPAL ("rte_init" );
407
-
408
408
ompi_rte_initialized = true;
409
409
/* if we are oversubscribed, then set yield_when_idle
410
410
* accordingly */
@@ -507,9 +507,6 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
507
507
return ompi_instance_print_error ("mca_pml_base_select() failed" , ret );
508
508
}
509
509
510
- OMPI_TIMING_IMPORT_OPAL ("orte_init" );
511
- OMPI_TIMING_NEXT ("rte_init-commit" );
512
-
513
510
/* exchange connection info - this function may also act as a barrier
514
511
* if data exchange is required. The modex occurs solely across procs
515
512
* in our job. If a barrier is required, the "modex" function will
@@ -520,19 +517,20 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
520
517
return ret ; /* TODO: need to fix this */
521
518
}
522
519
523
- OMPI_TIMING_NEXT ("commit" );
520
+ OPAL_TIMING_ENV_NEXT (init_common , "PMIx_Commit" );
521
+
524
522
#if (OPAL_ENABLE_TIMING )
525
523
if (OMPI_TIMING_ENABLED && !opal_pmix_base_async_modex &&
526
524
opal_pmix_collect_all_data && !opal_process_info .is_singleton ) {
527
525
if (PMIX_SUCCESS != (rc = PMIx_Fence (NULL , 0 , NULL , 0 ))) {
528
526
ret = opal_pmix_convert_status (rc );
529
527
return ompi_instance_print_error ("timing: pmix-barrier-1 failed" , ret );
530
528
}
531
- OMPI_TIMING_NEXT ( "pmix-barrier-1" );
529
+ OPAL_TIMING_ENV_NEXT ( init_common , "pmix-barrier-1" );
532
530
if (PMIX_SUCCESS != (rc = PMIx_Fence (NULL , 0 , NULL , 0 ))) {
533
531
return ompi_instance_print_error ("timing: pmix-barrier-2 failed" , ret );
534
532
}
535
- OMPI_TIMING_NEXT ( "pmix-barrier-2" );
533
+ OPAL_TIMING_ENV_NEXT ( init_common , "pmix-barrier-2" );
536
534
}
537
535
#endif
538
536
@@ -577,7 +575,7 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
577
575
}
578
576
}
579
577
580
- OMPI_TIMING_NEXT ( "modex" );
578
+ OPAL_TIMING_ENV_NEXT ( init_common , "modex" );
581
579
582
580
/* select buffered send allocator component to be used */
583
581
if (OMPI_SUCCESS != (ret = mca_pml_base_bsend_init ())) {
@@ -625,14 +623,6 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
625
623
return ompi_instance_print_error ("ompi_attr_create_predefined_keyvals() failed" , ret );
626
624
}
627
625
628
- if (mca_pml_base_requires_world ()) {
629
- /* need to set up comm world for this instance -- XXX -- FIXME -- probably won't always
630
- * be the case. */
631
- if (OMPI_SUCCESS != (ret = ompi_comm_init_mpi3 ())) {
632
- return ompi_instance_print_error ("ompi_comm_init_mpi3 () failed" , ret );
633
- }
634
- }
635
-
636
626
/* initialize file handles */
637
627
if (OMPI_SUCCESS != (ret = ompi_file_init ())) {
638
628
return ompi_instance_print_error ("ompi_file_init() failed" , ret );
@@ -709,47 +699,15 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
709
699
return ompi_instance_print_error ("ompi_mpi_init: ompi_comm_cid_init failed" , ret );
710
700
}
711
701
712
- /* Do we need to wait for a debugger? */
713
- ompi_rte_wait_for_debugger ();
714
-
715
- /* Next timing measurement */
716
- OMPI_TIMING_NEXT ("modex-barrier" );
717
-
718
- if (!opal_process_info .is_singleton ) {
719
- /* if we executed the above fence in the background, then
720
- * we have to wait here for it to complete. However, there
721
- * is no reason to do two barriers! */
722
- if (background_fence ) {
723
- OMPI_LAZY_WAIT_FOR_COMPLETION (active );
724
- } else if (!ompi_async_mpi_init ) {
725
- /* wait for everyone to reach this point - this is a hard
726
- * barrier requirement at this time, though we hope to relax
727
- * it at a later point */
728
- bool flag = false;
729
- active = true;
730
- OPAL_POST_OBJECT (& active );
731
- PMIX_INFO_LOAD (& info [0 ], PMIX_COLLECT_DATA , & flag , PMIX_BOOL );
732
- if (PMIX_SUCCESS != (rc = PMIx_Fence_nb (NULL , 0 , info , 1 ,
733
- fence_release , (void * )& active ))) {
734
- ret = opal_pmix_convert_status (rc );
735
- return ompi_instance_print_error ("PMIx_Fence_nb() failed" , ret );
736
- }
737
- OMPI_LAZY_WAIT_FOR_COMPLETION (active );
738
- }
739
- }
740
-
741
- /* check for timing request - get stop time and report elapsed
742
- time if so, then start the clock again */
743
- OMPI_TIMING_NEXT ("barrier" );
744
-
745
702
#if OPAL_ENABLE_PROGRESS_THREADS == 0
746
703
/* Start setting up the event engine for MPI operations. Don't
747
704
block in the event library, so that communications don't take
748
705
forever between procs in the dynamic code. This will increase
749
706
CPU utilization for the remainder of MPI_INIT when we are
750
707
blocking on RTE-level events, but may greatly reduce non-TCP
751
708
latency. */
752
- opal_progress_set_event_flag (OPAL_EVLOOP_NONBLOCK );
709
+ int old_event_flags = opal_progress_set_event_flag (0 );
710
+ opal_progress_set_event_flag (old_event_flags | OPAL_EVLOOP_NONBLOCK );
753
711
#endif
754
712
755
713
/* Undo OPAL calling opal_progress_event_users_increment() during
@@ -791,6 +749,10 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
791
749
OBJ_CONSTRUCT ( & ompi_mpi_f90_complex_hashtable , opal_hash_table_t );
792
750
opal_hash_table_init (& ompi_mpi_f90_complex_hashtable , FLT_MAX_10_EXP );
793
751
752
+ if (background_fence ) {
753
+ OMPI_LAZY_WAIT_FOR_COMPLETION (active );
754
+ }
755
+
794
756
return OMPI_SUCCESS ;
795
757
}
796
758
0 commit comments