Fix launch_id matching of -hosts
Need to check the entire value instead of just the last N digits. Otherwise, "-host 15" will match nid0015, nid0115, and any other launch id ending in 15 It appears strtol can return either a NULL or a zero-length string, so check for both cases Signed-off-by: Ralph Castain <rhc@open-mpi.org>
Этот коммит содержится в:
родитель
5c64c0bc3b
Коммит
22c88f5ab5
@ -11,7 +11,7 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2011-2012 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -266,6 +266,7 @@ void orte_ras_base_allocate(int fd, short args, void *cbdata)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL != orte_rankfile) {
|
||||
OPAL_OUTPUT_VERBOSE((5, orte_ras_base_framework.framework_output,
|
||||
"%s ras:base:allocate parsing rankfile %s",
|
||||
@ -386,7 +387,7 @@ void orte_ras_base_allocate(int fd, short args, void *cbdata)
|
||||
"%s ras:base:allocate nothing found in rankfile - inserting current node",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
||||
|
||||
addlocal:
|
||||
addlocal:
|
||||
/* if nothing was found by any of the above methods, then we have no
|
||||
* earthly idea what to do - so just add the local host
|
||||
*/
|
||||
@ -420,13 +421,13 @@ void orte_ras_base_allocate(int fd, short args, void *cbdata)
|
||||
}
|
||||
OBJ_DESTRUCT(&nodes);
|
||||
|
||||
DISPLAY:
|
||||
DISPLAY:
|
||||
/* shall we display the results? */
|
||||
if (4 < opal_output_get_verbosity(orte_ras_base_framework.framework_output)) {
|
||||
orte_ras_base_display_alloc();
|
||||
}
|
||||
|
||||
next_state:
|
||||
next_state:
|
||||
/* are we to report this event? */
|
||||
if (orte_report_events) {
|
||||
if (ORTE_SUCCESS != (rc = orte_util_comm_report_event(ORTE_COMM_EVENT_ALLOCATE))) {
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "orte_config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "orte/constants.h"
|
||||
#include "orte/types.h"
|
||||
@ -515,25 +516,31 @@ int orte_util_filter_dash_host_nodes(opal_list_t *nodes,
|
||||
/* we are looking for a specific node on the list. The
|
||||
* parser will have substituted our local name for any
|
||||
* alias, so we only have to do a strcmp here. */
|
||||
lmn = strtol(mapped_nodes[i], &cptr, 10);
|
||||
if (orte_managed_allocation && NULL != cptr) {
|
||||
/* if we are only given a number, then we only test the
|
||||
* number of matching characters starting from the rear
|
||||
* of the mapped_nodes entry. This allows support for
|
||||
* launch_id-based environments. For example, a hostname
|
||||
* of "nid0015" can be referenced by "--host 15" */
|
||||
lmn = strlen(mapped_nodes[i]);
|
||||
} else {
|
||||
lmn = 0;
|
||||
}
|
||||
cptr = NULL;
|
||||
lmn = strtoul(mapped_nodes[i], &cptr, 10);
|
||||
item = opal_list_get_first(nodes);
|
||||
while (item != opal_list_get_end(nodes)) {
|
||||
next = opal_list_get_next(item); /* save this position */
|
||||
node = (orte_node_t*)item;
|
||||
/* search -host list to see if this one is found */
|
||||
if (0 < lmn) {
|
||||
lst = strlen(node->name);
|
||||
test = strncmp(node->name + lst - lmn, mapped_nodes[i], lmn);
|
||||
if (orte_managed_allocation &&
|
||||
(NULL == cptr || 0 == strlen(cptr))) {
|
||||
/* if we are only given a number, then we test the
|
||||
* value against the number in the node name. This allows support for
|
||||
* launch_id-based environments. For example, a hostname
|
||||
* of "nid0015" can be referenced by "--host 15" */
|
||||
for (j=strlen(node->name)-1; 0 < j; j--) {
|
||||
if (!isdigit(node->name[j])) {
|
||||
j++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j >= (int)(strlen(node->name) - 1)) {
|
||||
test = 0;
|
||||
} else {
|
||||
lst = strtoul(&node->name[j], NULL, 10);
|
||||
test = (lmn == lst) ? 0 : 1;
|
||||
}
|
||||
} else {
|
||||
test = strcmp(node->name, mapped_nodes[i]);
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user