From 16a1fa679fb54e1a70dbec0bccc873afb9a3582d Mon Sep 17 00:00:00 2001 From: Joshua Hursey Date: Thu, 18 Aug 2022 16:14:54 -0400 Subject: [PATCH] Fix Singletons and Singleton Spawn * Fixes #10590 * Singletons will not have a PMIx value for `PMIX_LOCAL_PEERS` so make that optional instead of required. * `&` is being confused as an application argument in `prte` instead of the background character * Replace with `--daemonize` which is probably better anyway Signed-off-by: Joshua Hursey --- ompi/dpm/dpm.c | 3 ++- ompi/runtime/ompi_rte.c | 16 +++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ompi/dpm/dpm.c b/ompi/dpm/dpm.c index 032b27fefa5..c04496fc21a 100644 --- a/ompi/dpm/dpm.c +++ b/ompi/dpm/dpm.c @@ -23,6 +23,7 @@ * Copyright (c) 2021 Nanook Consulting. All rights reserved. * Copyright (c) 2018-2022 Triad National Security, LLC. All rights * reserved. + * Copyright (c) 2022 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -2032,7 +2033,7 @@ static int start_dvm(char **hostfiles, char **dash_host) opal_asprintf(&tmp, "%d", death_pipe[0]); opal_argv_append_nosize(&args, tmp); free(tmp); - opal_argv_append_nosize(&args, "&"); + opal_argv_append_nosize(&args, "--daemonize"); /* Fork off the child */ pid = fork(); diff --git a/ompi/runtime/ompi_rte.c b/ompi/runtime/ompi_rte.c index bf0f78103f5..9a390f31a33 100644 --- a/ompi/runtime/ompi_rte.c +++ b/ompi/runtime/ompi_rte.c @@ -15,7 +15,7 @@ * Copyright (c) 2020 Amazon.com, Inc. or its affiliates. All Rights * reserved. * Copyright (c) 2021 Nanook Consulting. All rights reserved. - * Copyright (c) 2021 IBM Corporation. All rights reserved. + * Copyright (c) 2021-2022 IBM Corporation. All rights reserved. * $COPYRIGHT$ */ #include "ompi_config.h" @@ -848,19 +848,21 @@ int ompi_rte_init(int *pargc, char ***pargv) /* retrieve the local peers - defaults to local node */ val = NULL; - OPAL_MODEX_RECV_VALUE(rc, PMIX_LOCAL_PEERS, - &pname, &val, PMIX_STRING); + OPAL_MODEX_RECV_VALUE_OPTIONAL(rc, PMIX_LOCAL_PEERS, + &pname, &val, PMIX_STRING); if (PMIX_SUCCESS == rc && NULL != val) { peers = opal_argv_split(val, ','); free(val); } else { - ret = opal_pmix_convert_status(rc); - error = "local peers"; - goto error; + peers = NULL; } /* if we were unable to retrieve the #local peers, set it here */ if (0 == opal_process_info.num_local_peers) { - opal_process_info.num_local_peers = opal_argv_count(peers) - 1; + if (NULL != peers) { + opal_process_info.num_local_peers = opal_argv_count(peers) - 1; + } else { + opal_process_info.num_local_peers = 1; + } } /* if my local rank if too high, then that's an error */ if (opal_process_info.num_local_peers < opal_process_info.my_local_rank) {