7
7
* of Tennessee Research Foundation. All rights
8
8
* reserved.
9
9
* Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
10
+ * Copyright (c) 2024 NVIDIA Corporation. All rights reserved.
10
11
* $COPYRIGHT$
11
12
*
12
13
* Additional copyrights may follow
53
54
#include "ompi/mca/topo/base/base.h"
54
55
#include "opal/mca/pmix/base/base.h"
55
56
56
- #include "opal/mca/mpool/base/mpool_base_tree.h"
57
57
#include "ompi/mca/pml/base/pml_base_bsend.h"
58
58
#include "ompi/util/timings.h"
59
+ #include "opal/mca/mpool/base/mpool_base_tree.h"
59
60
#include "opal/mca/pmix/pmix-internal.h"
61
+ #include "opal/util/clock_gettime.h"
60
62
61
63
ompi_predefined_instance_t ompi_mpi_instance_null = {{{{0 }}}};
62
64
@@ -74,6 +76,14 @@ __opal_attribute_constructor__ static void instance_lock_init(void) {
74
76
/** MPI_Init instance */
75
77
ompi_instance_t * ompi_mpi_instance_default = NULL ;
76
78
79
+ /**
80
+ * @brief: Base timer initialization. All timers returned to the user via MPI_Wtime
81
+ * are relative to this timer. Setting it early in during the common
82
+ * initialization (world or session model) allows for measuring the cost of
83
+ * the MPI initialization.
84
+ */
85
+ struct timespec ompi_wtime_time_origin = {.tv_sec = 0 };
86
+
77
87
enum {
78
88
OMPI_INSTANCE_INITIALIZING = -1 ,
79
89
OMPI_INSTANCE_FINALIZING = -2 ,
@@ -358,6 +368,10 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
358
368
opal_pmix_lock_t mylock ;
359
369
OMPI_TIMING_INIT (64 );
360
370
371
+ // We intentionally don't use the OPAL timer framework here. See
372
+ // https://github.com/open-mpi/ompi/issues/3003 for more details.
373
+ (void ) opal_clock_gettime (& ompi_wtime_time_origin );
374
+
361
375
ret = ompi_mpi_instance_retain ();
362
376
if (OPAL_UNLIKELY (OMPI_SUCCESS != ret )) {
363
377
return ret ;
0 commit comments