Skip to content

Commit 40424c9

Browse files
committed
orte/util/hostfile: add the port=<port> option
add the option to pass an alternate port to plm for example node0 port=2222 directs the plm (via the ORTE_NODE_PORT) attribute to use the non default port 2222 (e.g. ssh -p 2222 node0 ...)
1 parent 73ea878 commit 40424c9

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

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)