Skip to content

Commit 9431868

Browse files
authored
Merge pull request #2909 from rhc54/cmr2x/singleton
Fix singleton operations
2 parents f41afb8 + 1fb31d7 commit 9431868

File tree

4 files changed

+28
-20
lines changed

4 files changed

+28
-20
lines changed

orte/mca/ess/singleton/ess_singleton_module.c

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
* All rights reserved.
1313
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
1414
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
15-
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
15+
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
1616
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
1717
* reserved.
18+
* Copyright (c) 2016 Research Organization for Information Science
19+
* and Technology (RIST). All rights reserved.
1820
* $COPYRIGHT$
1921
*
2022
* Additional copyrights may follow
@@ -74,7 +76,6 @@ static bool added_transport_keys=false;
7476
static bool added_num_procs = false;
7577
static bool added_app_ctx = false;
7678
static bool added_pmix_envs = false;
77-
static char *pmixenvars[4];
7879
static bool progress_thread_running = false;
7980

8081
static int fork_hnp(void);
@@ -83,9 +84,9 @@ static int rte_init(void)
8384
{
8485
int rc, ret;
8586
char *error = NULL;
86-
char *envar, *ev1, *ev2;
8787
uint64_t unique_key[2];
8888
char *string_key;
89+
char *envar;
8990
opal_value_t *kv;
9091
char *val;
9192
int u32, *u32ptr;
@@ -225,13 +226,17 @@ static int rte_init(void)
225226
* MPI-3 required info key
226227
*/
227228
if (NULL == getenv(OPAL_MCA_PREFIX"orte_ess_num_procs")) {
228-
asprintf(&ev1, OPAL_MCA_PREFIX"orte_ess_num_procs=%d", orte_process_info.num_procs);
229-
putenv(ev1);
229+
char * num_procs;
230+
asprintf(&num_procs, "%d", orte_process_info.num_procs);
231+
opal_setenv(OPAL_MCA_PREFIX"orte_ess_num_procs", num_procs, true, &environ);
232+
free(num_procs);
230233
added_num_procs = true;
231234
}
232235
if (NULL == getenv("OMPI_APP_CTX_NUM_PROCS")) {
233-
asprintf(&ev2, "OMPI_APP_CTX_NUM_PROCS=%d", orte_process_info.num_procs);
234-
putenv(ev2);
236+
char * num_procs;
237+
asprintf(&num_procs, "%d", orte_process_info.num_procs);
238+
opal_setenv("OMPI_APP_CTX_NUM_PROCS", num_procs, true, &environ);
239+
free(num_procs);
235240
added_app_ctx = true;
236241
}
237242

@@ -546,6 +551,8 @@ static int fork_hnp(void)
546551
exit(1);
547552

548553
} else {
554+
int count;
555+
549556
free(cmd);
550557
/* I am the parent - wait to hear something back and
551558
* report results
@@ -612,14 +619,13 @@ static int fork_hnp(void)
612619

613620
/* split the pmix_uri into its parts */
614621
argv = opal_argv_split(cptr, ',');
615-
if (4 != opal_argv_count(argv)) {
616-
opal_argv_free(argv);
617-
return ORTE_ERR_BAD_PARAM;
618-
}
622+
count = opal_argv_count(argv);
619623
/* push each piece into the environment */
620-
for (i=0; i < 4; i++) {
621-
pmixenvars[i] = strdup(argv[i]);
622-
putenv(pmixenvars[i]);
624+
for (i=0; i < count; i++) {
625+
char *c = strchr(argv[i], '=');
626+
assert(NULL != c);
627+
*c++ = '\0';
628+
opal_setenv(argv[i], c, true, &environ);
623629
}
624630
opal_argv_free(argv);
625631
added_pmix_envs = true;

orte/mca/odls/base/odls_base_default_fns.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Copyright (c) 2011-2015 Los Alamos National Security, LLC.
1515
* All rights reserved.
1616
* Copyright (c) 2011-2013 Cisco Systems, Inc. All rights reserved.
17-
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
17+
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
1818
* Copyright (c) 2014 Research Organization for Information Science
1919
* and Technology (RIST). All rights reserved.
2020
* Copyright (c) 2017 Mellanox Technologies Ltd. All rights reserved.
@@ -167,7 +167,8 @@ int orte_odls_base_default_get_add_procs_data(opal_buffer_t *data,
167167
* copy of all active jobs so the grpcomm collectives can
168168
* properly work should a proc from one of the other jobs
169169
* interact with this one */
170-
if (orte_get_attribute(&jdata->attributes, ORTE_JOB_LAUNCHED_DAEMONS, NULL, OPAL_BOOL)) {
170+
if (orte_get_attribute(&jdata->attributes, ORTE_JOB_LAUNCHED_DAEMONS, NULL, OPAL_BOOL) ||
171+
ORTE_JOBID_INVALID != jdata->originator.jobid) {
171172
OBJ_CONSTRUCT(&jobdata, opal_buffer_t);
172173
numjobs = 0;
173174
for (i=0; i < orte_job_data->size; i++) {

orte/mca/plm/base/plm_base_launch_support.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Copyright (c) 2009 Institut National de Recherche en Informatique
1414
* et Automatique. All rights reserved.
1515
* Copyright (c) 2011-2012 Los Alamos National Security, LLC.
16-
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
16+
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
1717
* Copyright (c) 2014-2015 Research Organization for Information Science
1818
* and Technology (RIST). All rights reserved.
1919
* Copyright (c) 2016 IBM Corporation. All rights reserved.
@@ -625,7 +625,7 @@ void orte_plm_base_post_launch(int fd, short args, void *cbdata)
625625
* it won't register and we need to send the response now.
626626
* Otherwise, it is an MPI job and we should wait for it
627627
* to register */
628-
if (!orte_get_attribute(&jdata->attributes, ORTE_JOB_NON_ORTE_JOB, NULL, OPAL_BOOL)) {
628+
if (orte_get_attribute(&jdata->attributes, ORTE_JOB_NON_ORTE_JOB, NULL, OPAL_BOOL)) {
629629
OPAL_OUTPUT_VERBOSE((5, orte_plm_base_framework.framework_output,
630630
"%s plm:base:launch job %s is not MPI",
631631
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),

orte/orted/orted_main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Copyright (c) 2009 Institut National de Recherche en Informatique
1616
* et Automatique. All rights reserved.
1717
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
18-
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
18+
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
1919
* Copyright (c) 2015 Research Organization for Information Science
2020
* and Technology (RIST). All rights reserved.
2121
* $COPYRIGHT$
@@ -537,6 +537,7 @@ int orte_daemon(int argc, char *argv[])
537537
app->app = strdup("singleton");
538538
app->num_procs = 1;
539539
opal_pointer_array_add(jdata->apps, app);
540+
jdata->num_apps = 1;
540541

541542
/* setup a proc object for the singleton - since we
542543
* -must- be the HNP, and therefore we stored our
@@ -591,7 +592,7 @@ int orte_daemon(int argc, char *argv[])
591592
/* create a string that contains our uri + sysinfo + PMIx server URI envars */
592593
orte_util_convert_sysinfo_to_string(&sysinfo, orte_local_cpu_type, orte_local_cpu_model);
593594
asprintf(&tmp, "%s[%s]%s", orte_process_info.my_daemon_uri, sysinfo, nptr);
594-
free(sysinfo);
595+
free(sysinfo);
595596
free(nptr);
596597

597598
/* pass that info to the singleton */

0 commit comments

Comments
 (0)