1
1

orted: fix spawn in singleton mode

in singleton mode, have the spawn'ed orted invoke orte_pre_condition_transports()
and send the transport key back to the singleton
Этот коммит содержится в:
Gilles Gouaillardet 2016-09-19 13:37:08 +09:00
родитель 6c1e25b76e
Коммит e7ae6975d0
2 изменённых файлов: 18 добавлений и 18 удалений

Просмотреть файл

@ -85,9 +85,7 @@ static int rte_init(void)
{ {
int rc, ret; int rc, ret;
char *error = NULL; char *error = NULL;
char *envar, *ev1, *ev2; char *ev1, *ev2;
uint64_t unique_key[2];
char *string_key;
opal_value_t *kv; opal_value_t *kv;
char *val; char *val;
int u32, *u32ptr; int u32, *u32ptr;
@ -265,19 +263,7 @@ static int rte_init(void)
* we can use the jobfam and stepid as unique keys * we can use the jobfam and stepid as unique keys
* because they are unique values assigned by the RM * because they are unique values assigned by the RM
*/ */
if (NULL == getenv(OPAL_MCA_PREFIX"orte_precondition_transports")) { assert (NULL != getenv(OPAL_MCA_PREFIX"orte_precondition_transports"));
unique_key[0] = ORTE_JOB_FAMILY(ORTE_PROC_MY_NAME->jobid);
unique_key[1] = ORTE_LOCAL_JOBID(ORTE_PROC_MY_NAME->jobid);
if (NULL == (string_key = orte_pre_condition_transports_print(unique_key))) {
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
return ORTE_ERR_OUT_OF_RESOURCE;
}
asprintf(&envar, OPAL_MCA_PREFIX"orte_precondition_transports=%s", string_key);
putenv(envar);
added_transport_keys = true;
/* cannot free the envar as that messes up our environ */
free(string_key);
}
/* retrieve our topology */ /* retrieve our topology */
OPAL_MODEX_RECV_VALUE(ret, OPAL_PMIX_LOCAL_TOPO, OPAL_MODEX_RECV_VALUE(ret, OPAL_PMIX_LOCAL_TOPO,

Просмотреть файл

@ -17,7 +17,7 @@
* et Automatique. All rights reserved. * et Automatique. All rights reserved.
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved. * Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
@ -74,6 +74,7 @@
#include "orte/util/nidmap.h" #include "orte/util/nidmap.h"
#include "orte/util/parse_options.h" #include "orte/util/parse_options.h"
#include "orte/mca/rml/base/rml_contact.h" #include "orte/mca/rml/base/rml_contact.h"
#include "orte/util/pre_condition_transports.h"
#include "orte/mca/errmgr/errmgr.h" #include "orte/mca/errmgr/errmgr.h"
#include "orte/mca/ess/ess.h" #include "orte/mca/ess/ess.h"
@ -526,7 +527,7 @@ int orte_daemon(int argc, char *argv[])
orte_node_t *node; orte_node_t *node;
orte_app_context_t *app; orte_app_context_t *app;
char *tmp, *nptr, *sysinfo; char *tmp, *nptr, *sysinfo;
char **singenv=NULL; char **singenv=NULL, *string_key, *env_str;
/* setup the singleton's job */ /* setup the singleton's job */
jdata = OBJ_NEW(orte_job_t); jdata = OBJ_NEW(orte_job_t);
@ -587,6 +588,9 @@ int orte_daemon(int argc, char *argv[])
proc->app_idx = 0; proc->app_idx = 0;
ORTE_FLAG_SET(proc, ORTE_PROC_FLAG_LOCAL); ORTE_FLAG_SET(proc, ORTE_PROC_FLAG_LOCAL);
/* set the ORTE_JOB_TRANSPORT_KEY from the environment */
orte_pre_condition_transports(jdata);
/* register the singleton's nspace with our PMIx server */ /* register the singleton's nspace with our PMIx server */
if (ORTE_SUCCESS != (ret = orte_pmix_server_register_nspace(jdata))) { if (ORTE_SUCCESS != (ret = orte_pmix_server_register_nspace(jdata))) {
ORTE_ERROR_LOG(ret); ORTE_ERROR_LOG(ret);
@ -597,6 +601,16 @@ int orte_daemon(int argc, char *argv[])
ORTE_ERROR_LOG(ret); ORTE_ERROR_LOG(ret);
goto DONE; goto DONE;
} }
/* append the transport key to the envars needed by the singleton */
if (!orte_get_attribute(&jdata->attributes, ORTE_JOB_TRANSPORT_KEY, (void**)&string_key, OPAL_STRING) || NULL == string_key) {
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
goto DONE;
}
asprintf(&env_str, OPAL_MCA_PREFIX"orte_precondition_transports=%s", string_key);
opal_argv_append_nosize(&singenv, env_str);
free(env_str);
nptr = opal_argv_join(singenv, ','); nptr = opal_argv_join(singenv, ',');
opal_argv_free(singenv); opal_argv_free(singenv);
/* create a string that contains our uri + sysinfo + PMIx server URI envars */ /* create a string that contains our uri + sysinfo + PMIx server URI envars */