Correctly parse socket:core syntax in rankfile
This commit was SVN r25848.
Этот коммит содержится в:
родитель
0eb24c80cf
Коммит
a3ab70c53f
@ -760,7 +760,7 @@ static int socket_core_to_cpu_set(char *socket_core_list,
|
|||||||
hwloc_bitmap_t cpumask)
|
hwloc_bitmap_t cpumask)
|
||||||
{
|
{
|
||||||
int rc=OPAL_SUCCESS, i;
|
int rc=OPAL_SUCCESS, i;
|
||||||
char **socket_core;
|
char **socket_core, *corestr;
|
||||||
char **range;
|
char **range;
|
||||||
int range_cnt;
|
int range_cnt;
|
||||||
int lower_range, upper_range;
|
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
|
/* 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
|
* required
|
||||||
*/
|
*/
|
||||||
if (NULL == hwloc_get_obj_by_type(topo, HWLOC_OBJ_CORE, 0)) {
|
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++) {
|
for (i=0; NULL != socket_core[i]; i++) {
|
||||||
if ('C' == socket_core[i][0] ||
|
if ('C' == socket_core[i][0] ||
|
||||||
'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 */
|
/* set to all available logical cpus on this socket */
|
||||||
res = opal_hwloc_base_get_available_cpus(topo, socket);
|
res = opal_hwloc_base_get_available_cpus(topo, socket);
|
||||||
hwloc_bitmap_copy(cpumask, res);
|
hwloc_bitmap_copy(cpumask, res);
|
||||||
@ -799,7 +803,7 @@ static int socket_core_to_cpu_set(char *socket_core_list,
|
|||||||
rc = OPAL_SUCCESS;
|
rc = OPAL_SUCCESS;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
range = opal_argv_split(&socket_core[i][1], '-'); /* strip the 'C' */
|
range = opal_argv_split(corestr, '-');
|
||||||
range_cnt = opal_argv_count(range);
|
range_cnt = opal_argv_count(range);
|
||||||
/* see if a range was set or not */
|
/* see if a range was set or not */
|
||||||
switch (range_cnt) {
|
switch (range_cnt) {
|
||||||
@ -846,11 +850,6 @@ static int socket_core_to_cpu_set(char *socket_core_list,
|
|||||||
}
|
}
|
||||||
opal_argv_free(range);
|
opal_argv_free(range);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
/* unrecognized option */
|
|
||||||
rc = OPAL_ERR_NOT_SUPPORTED;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
opal_argv_free(socket_core);
|
opal_argv_free(socket_core);
|
||||||
|
|
||||||
@ -888,8 +887,13 @@ int opal_hwloc_base_slot_list_parse(const char *slot_str,
|
|||||||
hwloc_bitmap_zero(cpumask);
|
hwloc_bitmap_zero(cpumask);
|
||||||
/* loop across the items and accumulate the mask */
|
/* loop across the items and accumulate the mask */
|
||||||
for (i=0; NULL != item[i]; i++) {
|
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] ||
|
if ('S' == item[i][0] ||
|
||||||
's' == item[i][0]) {
|
's' == item[i][0] ||
|
||||||
|
NULL != strchr(item[i], ':')) {
|
||||||
/* specified a socket */
|
/* specified a socket */
|
||||||
if (NULL == strchr(item[i], ':')) {
|
if (NULL == strchr(item[i], ':')) {
|
||||||
/* binding just to the socket level, though
|
/* binding just to the socket level, though
|
||||||
@ -902,11 +906,20 @@ int opal_hwloc_base_slot_list_parse(const char *slot_str,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* binding to a socket/whatever specification */
|
/* 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' */
|
if (OPAL_SUCCESS != (rc = socket_core_to_cpu_set(&item[i][1], /* skip the 'S' */
|
||||||
topo, cpumask))) {
|
topo, cpumask))) {
|
||||||
opal_argv_free(item);
|
opal_argv_free(item);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (OPAL_SUCCESS != (rc = socket_core_to_cpu_set(item[i],
|
||||||
|
topo, cpumask))) {
|
||||||
|
opal_argv_free(item);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* just a core specification - see if one or a range was given */
|
/* just a core specification - see if one or a range was given */
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user