Skip to content

Commit 4527584

Browse files
committed
orted: fix tree-spawn when the node regex is too long
When the node regex is too long to be sent on the command line, retrieve it first from the parent, and then spawn the remote orted Signed-off-by: Gilles Gouaillardet <[email protected]>
1 parent 799152e commit 4527584

File tree

5 files changed

+94
-10
lines changed

5 files changed

+94
-10
lines changed

orte/mca/plm/base/plm_base_launch_support.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,16 +1565,19 @@ int orte_plm_base_orted_append_basic_args(int *argc, char ***argv,
15651565
ORTE_ERROR_LOG(rc);
15661566
return rc;
15671567
}
1568+
if (NULL != orte_node_regex) {
1569+
free(orte_node_regex);
1570+
}
1571+
orte_node_regex = param;
15681572
/* if this is too long, then we'll have to do it with
15691573
* a phone home operation instead */
15701574
if (strlen(param) < orte_plm_globals.node_regex_threshold) {
15711575
opal_argv_append(argc, argv, "-"OPAL_MCA_CMD_LINE_ID);
15721576
opal_argv_append(argc, argv, "orte_node_regex");
1573-
opal_argv_append(argc, argv, param);
1577+
opal_argv_append(argc, argv, orte_node_regex);
15741578
/* mark that the nidmap has been communicated */
15751579
orte_nidmap_communicated = true;
15761580
}
1577-
free(param);
15781581

15791582
if (!orte_static_ports && !orte_fwd_mpirun_port) {
15801583
/* if we are using static ports, or we are forwarding

orte/mca/plm/rsh/plm_rsh_module.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,6 @@ static int remote_spawn(opal_buffer_t *launch)
825825
prefix = NULL;
826826
}
827827
}
828-
829828
/* get the updated routing list */
830829
rtmod = orte_rml.get_routed(orte_coll_conduit);
831830
OBJ_CONSTRUCT(&coll, opal_list_t);

orte/mca/rml/base/rml_base_msg_handlers.c

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights
1414
* reserved.
1515
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
16+
* Copyright (c) 2017 Research Organization for Information Science
17+
* and Technology (RIST). All rights reserved.
1618
* $COPYRIGHT$
1719
*
1820
* Additional copyrights may follow
@@ -172,8 +174,32 @@ void orte_rml_base_process_msg(int fd, short flags, void *cbdata)
172174

173175
/* if this message is just to warmup the connection, then drop it */
174176
if (ORTE_RML_TAG_WARMUP_CONNECTION == msg->tag) {
175-
OBJ_RELEASE(msg);
176-
return;
177+
if (!orte_nidmap_communicated) {
178+
opal_buffer_t * buffer = OBJ_NEW(opal_buffer_t);
179+
int rc;
180+
if (NULL == buffer) {
181+
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
182+
return;
183+
}
184+
assert (NULL != orte_node_regex);
185+
186+
if (ORTE_SUCCESS != (rc = opal_dss.pack(buffer, &orte_node_regex, 1, OPAL_STRING))) {
187+
ORTE_ERROR_LOG(rc);
188+
OBJ_RELEASE(buffer);
189+
return;
190+
}
191+
192+
if (ORTE_SUCCESS != (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit,
193+
&msg->sender, buffer,
194+
ORTE_RML_TAG_NODE_REGEX_REPORT,
195+
orte_rml_send_callback, NULL))) {
196+
ORTE_ERROR_LOG(rc);
197+
OBJ_RELEASE(buffer);
198+
return;
199+
}
200+
OBJ_RELEASE(msg);
201+
return;
202+
}
177203
}
178204

179205
/* see if we have a waiting recv for this message */

orte/mca/rml/rml_types.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* reserved.
1414
* Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved.
1515
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
16+
* Copyright (c) 2017 Research Organization for Information Science
17+
* and Technology (RIST). All rights reserved.
1618
* $COPYRIGHT$
1719
*
1820
* Additional copyrights may follow
@@ -175,6 +177,9 @@ BEGIN_C_DECLS
175177
/* warmup connection - simply establishes the connection */
176178
#define ORTE_RML_TAG_WARMUP_CONNECTION 63
177179

180+
/* node regex report */
181+
#define ORTE_RML_TAG_NODE_REGEX_REPORT 64
182+
178183
#define ORTE_RML_TAG_MAX 100
179184

180185

orte/orted/orted_main.c

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,14 @@ static void pipe_closed(int fd, short flags, void *arg);
117117
static void rollup(int status, orte_process_name_t* sender,
118118
opal_buffer_t *buffer,
119119
orte_rml_tag_t tag, void *cbdata);
120+
static void node_regex_report(int status, orte_process_name_t* sender,
121+
opal_buffer_t *buffer,
122+
orte_rml_tag_t tag, void *cbdata);
123+
static void report_orted(void);
124+
120125
static opal_buffer_t *bucket, *mybucket = NULL;
121126
static int ncollected = 0;
127+
static bool node_regex_waiting = false;
122128

123129
static char *orte_parent_uri = NULL;
124130

@@ -734,6 +740,11 @@ int orte_daemon(int argc, char *argv[])
734740
* a little time in the launch phase by "warming up" the
735741
* connection to our parent while we wait for our children */
736742
buffer = OBJ_NEW(opal_buffer_t); // zero-byte message
743+
if (NULL == orte_node_regex) {
744+
orte_rml.recv_buffer_nb(ORTE_PROC_MY_PARENT, ORTE_RML_TAG_NODE_REGEX_REPORT,
745+
ORTE_RML_PERSISTENT, node_regex_report, &node_regex_waiting);
746+
node_regex_waiting = true;
747+
}
737748
if (0 > (ret = orte_rml.send_buffer_nb(orte_mgmt_conduit,
738749
ORTE_PROC_MY_PARENT, buffer,
739750
ORTE_RML_TAG_WARMUP_CONNECTION,
@@ -969,8 +980,10 @@ int orte_daemon(int argc, char *argv[])
969980
i += 2;
970981
}
971982
}
972-
/* now launch any child daemons of ours */
973-
orte_plm.remote_spawn(orte_tree_launch_cmd);
983+
if (NULL != orte_node_regex) {
984+
/* now launch any child daemons of ours */
985+
orte_plm.remote_spawn(orte_tree_launch_cmd);
986+
}
974987
}
975988

976989
if (orte_debug_daemons_flag) {
@@ -1052,8 +1065,6 @@ static void rollup(int status, orte_process_name_t* sender,
10521065
opal_buffer_t *buffer,
10531066
orte_rml_tag_t tag, void *cbdata)
10541067
{
1055-
int nreqd;
1056-
char *rtmod;
10571068
int ret;
10581069
orte_process_name_t child;
10591070
int32_t i, flag, cnt;
@@ -1095,10 +1106,17 @@ static void rollup(int status, orte_process_name_t* sender,
10951106
}
10961107

10971108
report:
1109+
report_orted();
1110+
}
1111+
1112+
static void report_orted() {
1113+
char *rtmod;
1114+
int nreqd, ret;
1115+
10981116
/* get the number of children */
10991117
rtmod = orte_rml.get_routed(orte_mgmt_conduit);
11001118
nreqd = orte_routed.num_routes(rtmod) + 1;
1101-
if (nreqd == ncollected && NULL != mybucket) {
1119+
if (nreqd == ncollected && NULL != mybucket && !node_regex_waiting) {
11021120
/* add the collection of our children's buckets to ours */
11031121
opal_dss.copy_payload(mybucket, bucket);
11041122
OBJ_RELEASE(bucket);
@@ -1112,3 +1130,36 @@ static void rollup(int status, orte_process_name_t* sender,
11121130
}
11131131
}
11141132
}
1133+
1134+
static void node_regex_report(int status, orte_process_name_t* sender,
1135+
opal_buffer_t *buffer,
1136+
orte_rml_tag_t tag, void *cbdata) {
1137+
int rc, n=1;
1138+
char * regex;
1139+
assert(NULL == orte_node_regex);
1140+
bool * active = (bool *)cbdata;
1141+
1142+
/* extract the node regex if needed, and update the routing tree */
1143+
n = 1;
1144+
if (ORTE_SUCCESS != (rc = opal_dss.unpack(buffer, &regex, &n, OPAL_STRING))) {
1145+
ORTE_ERROR_LOG(rc);
1146+
return;
1147+
}
1148+
orte_node_regex = regex;
1149+
1150+
if (ORTE_SUCCESS != (rc = orte_util_nidmap_parse(orte_node_regex))) {
1151+
ORTE_ERROR_LOG(rc);
1152+
return;
1153+
}
1154+
1155+
/* update the routing tree so any tree spawn operation
1156+
* properly gets the number of children underneath us */
1157+
orte_routed.update_routing_plan(NULL);
1158+
1159+
*active = false;
1160+
1161+
/* now launch any child daemons of ours */
1162+
orte_plm.remote_spawn(orte_tree_launch_cmd);
1163+
1164+
report_orted();
1165+
}

0 commit comments

Comments
 (0)