Skip to content

Commit 0bfdc00

Browse files
author
Ralph Castain
committed
Extend the -host:N syntax to accept "*" or "auto" to indicate "auto-detect the #cpus and set #slots to that value"
Signed-off-by: Ralph Castain <[email protected]>
1 parent d3907de commit 0bfdc00

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

orte/util/dash_host/dash_host.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,14 @@ int orte_util_add_dash_host_nodes(opal_list_t *nodes,
194194
if (NULL != (cptr = strchr(mini_map[i], ':'))) {
195195
*cptr = '\0';
196196
++cptr;
197-
if ('*' == *cptr) {
198-
slots = 0;
197+
if ('*' == *cptr || 0 == strcmp(cptr, "auto")) {
198+
/* auto-detect #slots */
199+
slots = -1;
200+
slots_given = false;
199201
} else {
200202
slots = strtol(cptr, NULL, 10);
203+
slots_given = true;
201204
}
202-
slots_given = true;
203205
}
204206

205207
/* check for local name */
@@ -257,6 +259,9 @@ int orte_util_add_dash_host_nodes(opal_list_t *nodes,
257259
if (0 < slots) {
258260
ORTE_FLAG_SET(node, ORTE_NODE_FLAG_SLOTS_GIVEN);
259261
}
262+
} else if (slots < 0) {
263+
node->slots = 0;
264+
ORTE_FLAG_UNSET(node, ORTE_NODE_FLAG_SLOTS_GIVEN);
260265
} else {
261266
node->slots = 1;
262267
ORTE_FLAG_SET(node, ORTE_NODE_FLAG_SLOTS_GIVEN);

0 commit comments

Comments
 (0)