Skip to content

Commit 4237f11

Browse files
author
rhc54
authored
Merge pull request #2225 from ggouaillardet/topic/port_in_hostfile
add support for port=<port> in a hostfile for plm/rsh
2 parents e78fcc4 + 1846c2d commit 4237f11

File tree

7 files changed

+42
-3
lines changed

7 files changed

+42
-3
lines changed

orte/mca/plm/rsh/plm_rsh_module.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,7 @@ static void launch_daemons(int fd, short args, void *cbdata)
990990
orte_plm_rsh_caddy_t *caddy;
991991
opal_list_t coll;
992992
char *username;
993+
int port, *portptr;
993994
orte_namelist_t *child;
994995

995996
/* if we are launching debugger daemons, then just go
@@ -1242,6 +1243,15 @@ static void launch_daemons(int fd, short args, void *cbdata)
12421243
caddy = OBJ_NEW(orte_plm_rsh_caddy_t);
12431244
caddy->argc = argc;
12441245
caddy->argv = opal_argv_copy(argv);
1246+
/* insert the alternate port if any */
1247+
portptr = &port;
1248+
if (orte_get_attribute(&node->attributes, ORTE_NODE_PORT, (void**)&portptr, OPAL_INT)) {
1249+
char portname[16];
1250+
/* for the sake of simplicity, insert "-p" <port> in the duplicated argv */
1251+
opal_argv_insert_element(&caddy->argv, node_name_index1+1, "-p");
1252+
snprintf (portname, 15, "%d", port);
1253+
opal_argv_insert_element(&caddy->argv, node_name_index1+2, portname);
1254+
}
12451255
caddy->daemon = node->daemon;
12461256
OBJ_RETAIN(caddy->daemon);
12471257
opal_list_append(&launch_list, &caddy->super);

orte/util/attr.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved
3-
* Copyright (c) 2014 Research Organization for Information Science
3+
* Copyright (c) 2014-2016 Research Organization for Information Science
44
* and Technology (RIST). All rights reserved.
55
* $COPYRIGHT$
66
*
@@ -173,6 +173,8 @@ const char *orte_attr_key_to_str(orte_attribute_key_t key)
173173

174174
case ORTE_NODE_USERNAME:
175175
return "NODE-USERNAME";
176+
case ORTE_NODE_PORT:
177+
return "NODE-PORT";
176178
case ORTE_NODE_LAUNCH_ID:
177179
return "NODE-LAUNCHID";
178180
case ORTE_NODE_HOSTID:

orte/util/attr.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/*
22
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved
3+
* Copyright (c) 2016 Research Organization for Information Science
4+
* and Technology (RIST). All rights reserved.
35
* $COPYRIGHT$
46
*
57
* Additional copyrights may follow
@@ -68,6 +70,7 @@ typedef uint8_t orte_node_flags_t;
6870
// we need to know the id of our "host" to help any procs on us to determine locality
6971
#define ORTE_NODE_ALIAS (ORTE_NODE_START_KEY + 4) // comma-separate list of alternate names for the node
7072
#define ORTE_NODE_SERIAL_NUMBER (ORTE_NODE_START_KEY + 5) // string - serial number: used if node is a coprocessor
73+
#define ORTE_NODE_PORT (ORTE_NODE_START_KEY + 6) // int32 - Alternate port to be passed to plm
7174

7275
#define ORTE_NODE_MAX_KEY 200
7376

orte/util/hostfile/help-hostfile.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# All rights reserved.
1313
# Copyright (c) 2012 Los Alamos National Security, LLC
1414
# All rights reserved.
15+
# Copyright (c) 2016 Research Organization for Information Science
16+
# and Technology (RIST). All rights reserved.
1517
# $COPYRIGHT$
1618
#
1719
# Additional copyrights may follow
@@ -24,6 +26,11 @@
2426
Open RTE was unable to open the hostfile:
2527
%s
2628
Check to make sure the path and filename are correct.
29+
[port]
30+
Open RTE detected a bad parameter in the hostfile:
31+
%s
32+
The port parameter is less than 0:
33+
port=%d
2734
[slots]
2835
Open RTE detected a bad parameter in the hostfile:
2936
%s

orte/util/hostfile/hostfile.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* reserved.
1414
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
1515
* Copyright (c) 2013-2014 Intel, Inc. All rights reserved.
16-
* Copyright (c) 2015 Research Organization for Information Science
16+
* Copyright (c) 2015-2016 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
1818
* Copyright (c) 2016 IBM Corporation. All rights reserved.
1919
* $COPYRIGHT$
@@ -341,6 +341,17 @@ static int hostfile_parse_line(int token, opal_list_t* updates,
341341
}
342342
break;
343343

344+
case ORTE_HOSTFILE_PORT:
345+
rc = hostfile_parse_int();
346+
if (rc < 0) {
347+
orte_show_help("help-hostfile.txt", "port",
348+
true,
349+
cur_hostfile_name, rc);
350+
return ORTE_ERROR;
351+
}
352+
orte_set_attribute(&node->attributes, ORTE_NODE_PORT, ORTE_ATTR_LOCAL, &rc, OPAL_INT);
353+
break;
354+
344355
case ORTE_HOSTFILE_COUNT:
345356
case ORTE_HOSTFILE_CPU:
346357
case ORTE_HOSTFILE_SLOTS:

orte/util/hostfile/hostfile_lex.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
13+
* Copyright (c) 2016 Research Organization for Information Science
14+
* and Technology (RIST). All rights reserved.
1315
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
1416
* $COPYRIGHT$
1517
*
@@ -78,5 +80,6 @@ extern orte_hostfile_value_t orte_util_hostfile_value;
7880
#define ORTE_HOSTFILE_CORES_PER_SOCKET 19
7981
/* ensure we can handle a rank_file input */
8082
#define ORTE_HOSTFILE_RANK 20
83+
#define ORTE_HOSTFILE_PORT 21
8184

8285
#endif

orte/util/hostfile/hostfile_lex.l

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Copyright (c) 2004-2005 The Regents of the University of California.
1515
* All rights reserved.
1616
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
17-
* Copyright (c) 2015 Research Organization for Information Science
17+
* Copyright (c) 2015-2016 Research Organization for Information Science
1818
* and Technology (RIST). All rights reserved.
1919
* $COPYRIGHT$
2020
*
@@ -127,6 +127,9 @@ username { orte_util_hostfile_value.sval = yytext;
127127
"user_name" { orte_util_hostfile_value.sval = yytext;
128128
return ORTE_HOSTFILE_USERNAME; }
129129

130+
port { orte_util_hostfile_value.sval = yytext;
131+
return ORTE_HOSTFILE_PORT; }
132+
130133
boards { orte_util_hostfile_value.sval = yytext;
131134
return ORTE_HOSTFILE_BOARDS; }
132135

0 commit comments

Comments
 (0)