11/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
22/*
3- * Copyright (c) 2018-2023 Triad National Security, LLC. All rights
3+ * Copyright (c) 2018-2022 Triad National Security, LLC. All rights
44 * reserved.
55 * Copyright (c) 2022 Cisco Systems, Inc. All rights reserved.
66 * Copyright (c) 2022 The University of Tennessee and The University
2121#include "opal/util/show_help.h"
2222#include "opal/util/argv.h"
2323#include "opal/runtime/opal_params.h"
24- #include "opal/util/timings.h"
25- #include "opal/mca/allocator/base/base.h"
26- #include "opal/mca/rcache/base/base.h"
27- #include "opal/mca/mpool/base/base.h"
28- #include "opal/mca/smsc/base/base.h"
29- #include "opal/mca/mpool/base/mpool_base_tree.h"
30- #include "opal/mca/pmix/pmix-internal.h"
31- #include "opal/mca/pmix/base/base.h"
3224
3325#include "ompi/mca/pml/pml.h"
3426#include "ompi/runtime/params.h"
4436#include "ompi/dpm/dpm.h"
4537#include "ompi/file/file.h"
4638#include "ompi/mpiext/mpiext.h"
47- #include "ompi/util/timings.h"
4839
4940#include "ompi/mca/hook/base/base.h"
5041#include "ompi/mca/op/base/base.h"
42+ #include "opal/mca/allocator/base/base.h"
43+ #include "opal/mca/rcache/base/base.h"
44+ #include "opal/mca/mpool/base/base.h"
45+ #include "opal/mca/smsc/base/base.h"
5146#include "ompi/mca/bml/base/base.h"
5247#include "ompi/mca/pml/base/base.h"
5348#include "ompi/mca/coll/base/base.h"
5449#include "ompi/mca/osc/base/base.h"
5550#include "ompi/mca/part/base/base.h"
5651#include "ompi/mca/io/base/base.h"
5752#include "ompi/mca/topo/base/base.h"
53+ #include "opal/mca/pmix/base/base.h"
5854
55+ #include "opal/mca/mpool/base/mpool_base_tree.h"
5956#include "ompi/mca/pml/base/pml_base_bsend.h"
57+ #include "ompi/util/timings.h"
58+ #include "opal/mca/pmix/pmix-internal.h"
6059
6160ompi_predefined_instance_t ompi_mpi_instance_null = {{{{0 }}}};
6261
@@ -345,8 +344,7 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
345344 pmix_info_t info [2 ];
346345 pmix_status_t rc ;
347346 opal_pmix_lock_t mylock ;
348-
349- OPAL_TIMING_ENV_INIT (init_common );
347+ OMPI_TIMING_INIT (64 );
350348
351349 ret = ompi_mpi_instance_retain ();
352350 if (OPAL_UNLIKELY (OMPI_SUCCESS != ret )) {
@@ -387,15 +385,13 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
387385 mca_base_var_set_value (ret , allvalue , 4 , MCA_BASE_VAR_SOURCE_DEFAULT , NULL );
388386 }
389387
390- OPAL_TIMING_ENV_NEXT ( init_common , "initialization" );
388+ OMPI_TIMING_NEXT ( "initialization" );
391389
392390 /* Setup RTE */
393391 if (OMPI_SUCCESS != (ret = ompi_rte_init (& argc , & argv ))) {
394392 return ompi_instance_print_error ("ompi_mpi_init: ompi_rte_init failed" , ret );
395393 }
396394
397- OPAL_TIMING_ENV_NEXT (init_common , "ompi_rte_init" );
398-
399395 /* open the ompi hook framework */
400396 for (int i = 0 ; ompi_framework_dependencies [i ] ; ++ i ) {
401397 ret = mca_base_framework_open (ompi_framework_dependencies [i ], 0 );
@@ -408,6 +404,10 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
408404 }
409405 }
410406
407+ OMPI_TIMING_NEXT ("rte_init" );
408+ OMPI_TIMING_IMPORT_OPAL ("orte_ess_base_app_setup" );
409+ OMPI_TIMING_IMPORT_OPAL ("rte_init" );
410+
411411 ompi_rte_initialized = true;
412412 /* if we are oversubscribed, then set yield_when_idle
413413 * accordingly */
@@ -509,6 +509,9 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
509509 return ompi_instance_print_error ("mca_pml_base_select() failed" , ret );
510510 }
511511
512+ OMPI_TIMING_IMPORT_OPAL ("orte_init" );
513+ OMPI_TIMING_NEXT ("rte_init-commit" );
514+
512515 /* exchange connection info - this function may also act as a barrier
513516 * if data exchange is required. The modex occurs solely across procs
514517 * in our job. If a barrier is required, the "modex" function will
@@ -519,20 +522,19 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
519522 return ret ; /* TODO: need to fix this */
520523 }
521524
522- OPAL_TIMING_ENV_NEXT (init_common , "PMIx_Commit" );
523-
525+ OMPI_TIMING_NEXT ("commit" );
524526#if (OPAL_ENABLE_TIMING )
525527 if (OMPI_TIMING_ENABLED && !opal_pmix_base_async_modex &&
526528 opal_pmix_collect_all_data && !opal_process_info .is_singleton ) {
527529 if (PMIX_SUCCESS != (rc = PMIx_Fence (NULL , 0 , NULL , 0 ))) {
528530 ret = opal_pmix_convert_status (rc );
529531 return ompi_instance_print_error ("timing: pmix-barrier-1 failed" , ret );
530532 }
531- OPAL_TIMING_ENV_NEXT ( init_common , "pmix-barrier-1" );
533+ OMPI_TIMING_NEXT ( "pmix-barrier-1" );
532534 if (PMIX_SUCCESS != (rc = PMIx_Fence (NULL , 0 , NULL , 0 ))) {
533535 return ompi_instance_print_error ("timing: pmix-barrier-2 failed" , ret );
534536 }
535- OPAL_TIMING_ENV_NEXT ( init_common , "pmix-barrier-2" );
537+ OMPI_TIMING_NEXT ( "pmix-barrier-2" );
536538 }
537539#endif
538540
@@ -577,7 +579,7 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
577579 }
578580 }
579581
580- OPAL_TIMING_ENV_NEXT ( init_common , "modex" );
582+ OMPI_TIMING_NEXT ( "modex" );
581583
582584 /* select buffered send allocator component to be used */
583585 if (OMPI_SUCCESS != (ret = mca_pml_base_bsend_init ())) {
@@ -625,6 +627,14 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
625627 return ompi_instance_print_error ("ompi_attr_create_predefined_keyvals() failed" , ret );
626628 }
627629
630+ if (mca_pml_base_requires_world ()) {
631+ /* need to set up comm world for this instance -- XXX -- FIXME -- probably won't always
632+ * be the case. */
633+ if (OMPI_SUCCESS != (ret = ompi_comm_init_mpi3 ())) {
634+ return ompi_instance_print_error ("ompi_comm_init_mpi3 () failed" , ret );
635+ }
636+ }
637+
628638 /* initialize file handles */
629639 if (OMPI_SUCCESS != (ret = ompi_file_init ())) {
630640 return ompi_instance_print_error ("ompi_file_init() failed" , ret );
@@ -701,12 +711,11 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
701711 return ompi_instance_print_error ("ompi_mpi_init: ompi_comm_cid_init failed" , ret );
702712 }
703713
704- if (OMPI_SUCCESS != (ret = ompi_comm_init_mpi3 ())) {
705- return ompi_instance_print_error ("ompi_comm_init_mpi3 () failed" , ret );
706- }
714+ /* Do we need to wait for a debugger? */
715+ ompi_rte_wait_for_debugger ();
707716
708717 /* Next timing measurement */
709- OPAL_TIMING_ENV_NEXT ( init_common , "modex-barrier" );
718+ OMPI_TIMING_NEXT ( "modex-barrier" );
710719
711720 if (!opal_process_info .is_singleton ) {
712721 /* if we executed the above fence in the background, then
@@ -731,7 +740,9 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
731740 }
732741 }
733742
734- OPAL_TIMING_ENV_NEXT (init_common , "barrier" );
743+ /* check for timing request - get stop time and report elapsed
744+ time if so, then start the clock again */
745+ OMPI_TIMING_NEXT ("barrier" );
735746
736747#if OPAL_ENABLE_PROGRESS_THREADS == 0
737748 /* Start setting up the event engine for MPI operations. Don't
@@ -740,8 +751,7 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
740751 CPU utilization for the remainder of MPI_INIT when we are
741752 blocking on RTE-level events, but may greatly reduce non-TCP
742753 latency. */
743- int old_event_flags = opal_progress_set_event_flag (0 );
744- opal_progress_set_event_flag (old_event_flags | OPAL_EVLOOP_NONBLOCK );
754+ opal_progress_set_event_flag (OPAL_EVLOOP_NONBLOCK );
745755#endif
746756
747757 /* Undo OPAL calling opal_progress_event_users_increment() during
0 commit comments