Skip to content

v5: Fix singleton spawn #10716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion ompi/dpm/dpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1610,6 +1611,11 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[],
OPAL_LIST_DESTRUCT(&job_info);

if (ompi_singleton) {
/* The GDS 'hash' component is known to work for singleton, so
* recommend it. The user may set this envar to override the setting.
*/
setenv("PMIX_MCA_gds", "hash", 0);
/* Start the DVM */
rc = start_dvm(hostfiles, dash_host);
if (OPAL_SUCCESS != rc) {
if (NULL != pinfo) {
Expand All @@ -1624,6 +1630,16 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[],
}
return MPI_ERR_SPAWN;
}
/* tell it to forward output to us */
info = OBJ_NEW(opal_info_item_t);
PMIX_INFO_LOAD(&info->info, PMIX_FWD_STDOUT, NULL, PMIX_BOOL);
opal_list_append(&job_info, &info->super);
info = OBJ_NEW(opal_info_item_t);
PMIX_INFO_LOAD(&info->info, PMIX_FWD_STDERR, NULL, PMIX_BOOL);
opal_list_append(&job_info, &info->super);
info = OBJ_NEW(opal_info_item_t);
PMIX_INFO_LOAD(&info->info, PMIX_FWD_STDDIAG, NULL, PMIX_BOOL);
opal_list_append(&job_info, &info->super);
}
if (NULL != hostfiles) {
opal_argv_free(hostfiles);
Expand Down Expand Up @@ -2032,7 +2048,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();
Expand Down
16 changes: 9 additions & 7 deletions ompi/runtime/ompi_rte.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -843,19 +843,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) {
Expand Down