1
1

Correctly parse socket:core syntax in rankfile

This commit was SVN r25848.
Этот коммит содержится в:
Ralph Castain 2012-02-01 01:50:05 +00:00
родитель 0eb24c80cf
Коммит a3ab70c53f

Просмотреть файл

@ -760,7 +760,7 @@ static int socket_core_to_cpu_set(char *socket_core_list,
hwloc_bitmap_t cpumask)
{
int rc=OPAL_SUCCESS, i;
char **socket_core;
char **socket_core, *corestr;
char **range;
int range_cnt;
int lower_range, upper_range;
@ -781,7 +781,7 @@ static int socket_core_to_cpu_set(char *socket_core_list,
}
/* as described in comment near top of file, hwloc isn't able
* to fiind cores on all platforms. Adjust the type here if
* to find cores on all platforms. Adjust the type here if
* required
*/
if (NULL == hwloc_get_obj_by_type(topo, HWLOC_OBJ_CORE, 0)) {
@ -791,7 +791,11 @@ static int socket_core_to_cpu_set(char *socket_core_list,
for (i=0; NULL != socket_core[i]; i++) {
if ('C' == socket_core[i][0] ||
'c' == socket_core[i][0]) {
if ('*' == socket_core[i][1]) {
corestr = &socket_core[i][1];
} else {
corestr = socket_core[i];
}
if ('*' == corestr[0]) {
/* set to all available logical cpus on this socket */
res = opal_hwloc_base_get_available_cpus(topo, socket);
hwloc_bitmap_copy(cpumask, res);
@ -799,7 +803,7 @@ static int socket_core_to_cpu_set(char *socket_core_list,
rc = OPAL_SUCCESS;
break;
} else {
range = opal_argv_split(&socket_core[i][1], '-'); /* strip the 'C' */
range = opal_argv_split(corestr, '-');
range_cnt = opal_argv_count(range);
/* see if a range was set or not */
switch (range_cnt) {
@ -846,11 +850,6 @@ static int socket_core_to_cpu_set(char *socket_core_list,
}
opal_argv_free(range);
}
} else {
/* unrecognized option */
rc = OPAL_ERR_NOT_SUPPORTED;
break;
}
}
opal_argv_free(socket_core);
@ -888,8 +887,13 @@ int opal_hwloc_base_slot_list_parse(const char *slot_str,
hwloc_bitmap_zero(cpumask);
/* loop across the items and accumulate the mask */
for (i=0; NULL != item[i]; i++) {
/* if they specified "socket" by starting with an S/s,
* or if they use socket:core notation, then parse the
* socket/core info
*/
if ('S' == item[i][0] ||
's' == item[i][0]) {
's' == item[i][0] ||
NULL != strchr(item[i], ':')) {
/* specified a socket */
if (NULL == strchr(item[i], ':')) {
/* binding just to the socket level, though
@ -902,11 +906,20 @@ int opal_hwloc_base_slot_list_parse(const char *slot_str,
}
} else {
/* binding to a socket/whatever specification */
if ('S' == item[i][0] ||
's' == item[i][0]) {
if (OPAL_SUCCESS != (rc = socket_core_to_cpu_set(&item[i][1], /* skip the 'S' */
topo, cpumask))) {
opal_argv_free(item);
return rc;
}
} else {
if (OPAL_SUCCESS != (rc = socket_core_to_cpu_set(item[i],
topo, cpumask))) {
opal_argv_free(item);
return rc;
}
}
}
} else {
/* just a core specification - see if one or a range was given */