Skip to content

Commit cb7b060

Browse files
authored
Merge pull request #11064 from hppritcha/move_singleton_to_opal
singleton: add field to opal_process_info
2 parents c2e208c + 11f42a4 commit cb7b060

File tree

9 files changed

+34
-21
lines changed

9 files changed

+34
-21
lines changed

ompi/dpm/dpm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[],
16101610
}
16111611
OPAL_LIST_DESTRUCT(&job_info);
16121612

1613-
if (ompi_singleton) {
1613+
if (opal_process_info.is_singleton) {
16141614
/* The GDS 'hash' component is known to work for singleton, so
16151615
* recommend it. The user may set this envar to override the setting.
16161616
*/
@@ -2154,7 +2154,7 @@ static int start_dvm(char **hostfiles, char **dash_host)
21542154
PMIx_Commit();
21552155

21562156
/* we are no longer a singleton */
2157-
ompi_singleton = false;
2157+
opal_process_info.is_singleton = false;
21582158

21592159
return OMPI_SUCCESS;
21602160
}

ompi/instance/instance.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
523523
OMPI_TIMING_NEXT("commit");
524524
#if (OPAL_ENABLE_TIMING)
525525
if (OMPI_TIMING_ENABLED && !opal_pmix_base_async_modex &&
526-
opal_pmix_collect_all_data && !ompi_singleton) {
526+
opal_pmix_collect_all_data && !opal_process_info.is_singleton) {
527527
if (PMIX_SUCCESS != (rc = PMIx_Fence(NULL, 0, NULL, 0))) {
528528
ret = opal_pmix_convert_status(rc);
529529
return ompi_instance_print_error ("timing: pmix-barrier-1 failed", ret);
@@ -536,7 +536,7 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
536536
}
537537
#endif
538538

539-
if (!ompi_singleton) {
539+
if (! opal_process_info.is_singleton) {
540540
if (opal_pmix_base_async_modex) {
541541
/* if we are doing an async modex, but we are collecting all
542542
* data, then execute the non-blocking modex in the background.
@@ -715,7 +715,7 @@ static int ompi_mpi_instance_init_common (int argc, char **argv)
715715
/* Next timing measurement */
716716
OMPI_TIMING_NEXT("modex-barrier");
717717

718-
if (!ompi_singleton) {
718+
if (!opal_process_info.is_singleton) {
719719
/* if we executed the above fence in the background, then
720720
* we have to wait here for it to complete. However, there
721721
* is no reason to do two barriers! */

ompi/interlib/interlib.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* Copyright (c) 2015-2020 Intel, Inc. All rights reserved.
1818
* Copyright (c) 2017 IBM Corporation. All rights reserved.
1919
* Copyright (c) 2021 Nanook Consulting. All rights reserved.
20+
* Copyright (c) 2022 Triad National Security, LLC. All rights
21+
* reserved.
2022
* $COPYRIGHT$
2123
*
2224
* Additional copyrights may follow
@@ -29,6 +31,7 @@
2931
#include <string.h>
3032

3133
#include "opal/mca/pmix/pmix-internal.h"
34+
#include "opal/util/proc.h"
3235
#include "ompi/runtime/ompi_rte.h"
3336
#include "ompi/interlib/interlib.h"
3437

@@ -122,7 +125,7 @@ int ompi_interlib_declare(int threadlevel, char *version)
122125
PMIX_INFO_DESTRUCT(&info[3]);
123126
/* account for our refcount on pmix_init */
124127
PMIx_Finalize(NULL, 0);
125-
if (ompi_singleton && PMIX_ERR_UNREACH == rc) {
128+
if (opal_process_info.is_singleton && PMIX_ERR_UNREACH == rc) {
126129
ret = OMPI_SUCCESS;
127130
} else {
128131
ret = opal_pmix_convert_status(rc);

ompi/runtime/ompi_mpi_finalize.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* Copyright (c) 2016 Research Organization for Information Science
2121
* and Technology (RIST). All rights reserved.
2222
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
23-
* Copyright (c) 2019 Triad National Security, LLC. All rights
23+
* Copyright (c) 2019-2022 Triad National Security, LLC. All rights
2424
* reserved.
2525
* Copyright (c) 2020 Amazon.com, Inc. or its affiliates.
2626
* All Rights reserved.
@@ -272,7 +272,7 @@ int ompi_mpi_finalize(void)
272272
del_procs behavior around May of 2014 (see
273273
https://svn.open-mpi.org/trac/ompi/ticket/4669#comment:4 for
274274
more details). */
275-
if (!ompi_async_mpi_finalize && !ompi_singleton) {
275+
if (!ompi_async_mpi_finalize && !opal_process_info.is_singleton) {
276276
active = true;
277277
OPAL_POST_OBJECT(&active);
278278
/* Note that use of the non-blocking PMIx fence will

ompi/runtime/ompi_mpi_init.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* Copyright (c) 2020 Amazon.com, Inc. or its affiliates.
2828
* All Rights reserved.
2929
* Copyright (c) 2021 Nanook Consulting. All rights reserved.
30-
* Copyright (c) 2021 Triad National Security, LLC. All rights
30+
* Copyright (c) 2021-2022 Triad National Security, LLC. All rights
3131
* reserved.
3232
* $COPYRIGHT$
3333
*
@@ -394,7 +394,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided,
394394

395395
#if (OPAL_ENABLE_TIMING)
396396
if (OMPI_TIMING_ENABLED && !opal_pmix_base_async_modex &&
397-
opal_pmix_collect_all_data && !ompi_singleton) {
397+
opal_pmix_collect_all_data && !opal_process_info.is_singleton) {
398398
if (PMIX_SUCCESS != (rc = PMIx_Fence(NULL, 0, NULL, 0))) {
399399
ret = opal_pmix_convert_status(rc);
400400
error = "timing: pmix-barrier-1 failed";
@@ -410,7 +410,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided,
410410
}
411411
#endif
412412

413-
if (!ompi_singleton) {
413+
if (!opal_process_info.is_singleton) {
414414
if (opal_pmix_base_async_modex) {
415415
/* if we are doing an async modex, but we are collecting all
416416
* data, then execute the non-blocking modex in the background.
@@ -494,7 +494,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided,
494494
/* Next timing measurement */
495495
OMPI_TIMING_NEXT("modex-barrier");
496496

497-
if (!ompi_singleton) {
497+
if (!opal_process_info.is_singleton) {
498498
/* if we executed the above fence in the background, then
499499
* we have to wait here for it to complete. However, there
500500
* is no reason to do two barriers! */

ompi/runtime/ompi_rte.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* reserved.
99
* Copyright (c) 2014-2018 Cisco Systems, Inc. All rights reserved
1010
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
11-
* Copyright (c) 2018-2020 Triad National Security, LLC. All rights
11+
* Copyright (c) 2018-2022 Triad National Security, LLC. All rights
1212
* reserved.
1313
* Copyright (c) 2019 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
@@ -61,7 +61,6 @@
6161
/* storage to support OMPI */
6262
opal_process_name_t pmix_name_wildcard = {UINT32_MAX-1, UINT32_MAX-1};
6363
opal_process_name_t pmix_name_invalid = {UINT32_MAX, UINT32_MAX};
64-
bool ompi_singleton = false;
6564

6665
static int _setup_top_session_dir(char **sdir);
6766
static int _setup_job_session_dir(char **sdir);
@@ -541,6 +540,7 @@ int ompi_rte_init(int *pargc, char ***pargv)
541540
pmix_value_t pval;
542541
pmix_status_t rc;
543542
char **tmp;
543+
bool singleton = false;
544544

545545
u32ptr = &u32;
546546
u16ptr = &u16;
@@ -586,7 +586,7 @@ int ompi_rte_init(int *pargc, char ***pargv)
586586
opal_show_help("help-mpi-runtime.txt", "no-pmix-but", false, size);
587587
}
588588
}
589-
ompi_singleton = true;
589+
singleton = true;
590590
} else {
591591
/* we cannot run - this could be due to being direct launched
592592
* without the required PMI support being built, so print
@@ -605,6 +605,11 @@ int ompi_rte_init(int *pargc, char ***pargv)
605605
OPAL_PROC_MY_NAME.vpid = pname.vpid;
606606
opal_process_info.my_name.jobid = OPAL_PROC_MY_NAME.jobid;
607607
opal_process_info.my_name.vpid = OPAL_PROC_MY_NAME.vpid;
608+
if (singleton) {
609+
opal_process_info.is_singleton = true;
610+
} else {
611+
opal_process_info.is_singleton = false;
612+
}
608613

609614

610615
/* set our hostname */
@@ -623,7 +628,7 @@ int ompi_rte_init(int *pargc, char ***pargv)
623628
OPAL_MODEX_RECV_VALUE_OPTIONAL(rc, PMIX_LOCAL_RANK,
624629
&opal_process_info.my_name, &u16ptr, PMIX_UINT16);
625630
if (PMIX_SUCCESS != rc) {
626-
if (ompi_singleton) {
631+
if (opal_process_info.is_singleton) {
627632
/* just assume 0 */
628633
u16 = 0;
629634
} else {
@@ -638,7 +643,7 @@ int ompi_rte_init(int *pargc, char ***pargv)
638643
OPAL_MODEX_RECV_VALUE_OPTIONAL(rc, PMIX_NODE_RANK,
639644
&opal_process_info.my_name, &u16ptr, PMIX_UINT16);
640645
if (PMIX_SUCCESS != rc) {
641-
if (ompi_singleton) {
646+
if (opal_process_info.is_singleton) {
642647
/* just assume 0 */
643648
u16 = 0;
644649
} else {
@@ -657,7 +662,7 @@ int ompi_rte_init(int *pargc, char ***pargv)
657662
OPAL_MODEX_RECV_VALUE_OPTIONAL(rc, PMIX_JOB_SIZE,
658663
&pname, &u32ptr, PMIX_UINT32);
659664
if (PMIX_SUCCESS != rc) {
660-
if (ompi_singleton) {
665+
if ( opal_process_info.is_singleton) {
661666
/* just assume 1 */
662667
u32 = 1;
663668
} else {
@@ -672,7 +677,7 @@ int ompi_rte_init(int *pargc, char ***pargv)
672677
OPAL_MODEX_RECV_VALUE_OPTIONAL(rc, PMIX_UNIV_SIZE,
673678
&pname, &u32ptr, PMIX_UINT32);
674679
if (PMIX_SUCCESS != rc) {
675-
if (ompi_singleton) {
680+
if (opal_process_info.is_singleton) {
676681
/* just assume 1 */
677682
u32 = 1;
678683
} else {

ompi/runtime/ompi_rte.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Copyright (c) 2014-2020 Intel, Inc. All rights reserved.
77
* Copyright (c) 2019 Research Organization for Information Science
88
* and Technology (RIST). All rights reserved.
9-
* Copyright (c) 2020 Triad National Security, LLC. All rights
9+
* Copyright (c) 2020-2022 Triad National Security, LLC. All rights
1010
* reserved.
1111
* Copyright (c) 2020 Amazon.com, Inc. or its affiliates. All Rights
1212
* reserved.
@@ -259,7 +259,6 @@ OMPI_DECLSPEC void ompi_rte_abort_peers(opal_process_name_t *procs,
259259
OMPI_DECLSPEC int ompi_rte_init(int *argc, char ***argv);
260260
OMPI_DECLSPEC int ompi_rte_finalize(void);
261261
OMPI_DECLSPEC void ompi_rte_wait_for_debugger(void);
262-
OMPI_DECLSPEC extern bool ompi_singleton;
263262

264263
/* In a few places, we need to barrier until something happens
265264
* that changes a flag to indicate we can release - e.g., waiting

opal/util/proc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
* reserved.
1212
* Copyright (c) 2020 Amazon.com, Inc. or its affiliates. All Rights
1313
* reserved.
14+
* Copyright (c) 2022 Triad National Security, LLC. All rights
15+
* reserved.
1416
* $COPYRIGHT$
1517
*
1618
* Additional copyrights may follow
@@ -54,6 +56,7 @@ opal_process_info_t opal_process_info = {
5456
.reincarnation = 0,
5557
.proc_is_bound = false,
5658
.initial_errhandler = NULL,
59+
.is_singleton = false,
5760
};
5861

5962
static opal_proc_t opal_local_proc = {{.opal_list_next = NULL, .opal_list_prev = NULL},

opal/util/proc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
* Copyright (c) 2020 Amazon.com, Inc. or its affiliates. All Rights
1111
* reserved.
1212
* Copyright (c) 2021 Nanook Consulting. All rights reserved.
13+
* Copyright (c) 2022 Triad National Security, LLC. All rights
14+
* reserved.
1315
* $COPYRIGHT$
1416
*
1517
* Additional copyrights may follow
@@ -130,6 +132,7 @@ typedef struct opal_process_info_t {
130132
uint32_t reincarnation;
131133
bool proc_is_bound;
132134
char *initial_errhandler;
135+
bool is_singleton; /**<note this value can transition from false to true in some cases */
133136
} opal_process_info_t;
134137
OPAL_DECLSPEC extern opal_process_info_t opal_process_info;
135138

0 commit comments

Comments
 (0)