Skip to content

Commit ea0dfc3

Browse files
committed
Allow individual jobs to set their map/rank/bind policies
Override the defaults when provided. Ignore LSF binding file if user overrides by specifying a policy. Fixes #6631 Signed-off-by: Ralph Castain <[email protected]>
1 parent 9bb1e16 commit ea0dfc3

File tree

3 files changed

+15
-23
lines changed

3 files changed

+15
-23
lines changed

orte/mca/ras/lsf/ras_lsf_module.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
1212
* Copyright (c) 2007-2017 Cisco Systems, Inc. All rights reserved
13-
* Copyright (c) 2014 Intel, Inc. All rights reserved
13+
* Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
1414
* Copyright (c) 2016 IBM Corporation. All rights reserved.
1515
* $COPYRIGHT$
1616
*
@@ -70,6 +70,7 @@ static int allocate(orte_job_t *jdata, opal_list_t *nodes)
7070
char *affinity_file;
7171
struct stat buf;
7272
char *ptr;
73+
bool directives_given = false;
7374

7475
/* get the list of allocated nodes */
7576
if ((num_nodes = lsb_getalloc(&nodelist)) < 0) {
@@ -112,8 +113,19 @@ static int allocate(orte_job_t *jdata, opal_list_t *nodes)
112113
/* release the nodelist from lsf */
113114
opal_argv_free(nodelist);
114115

116+
/* check to see if any mapping or binding directives were given */
117+
if (NULL != jdata && NULL != jdata->map) {
118+
if ((ORTE_MAPPING_GIVEN & ORTE_GET_MAPPING_DIRECTIVE(jdata->map->mapping)) ||
119+
OPAL_BINDING_POLICY_IS_SET(jdata->map->binding)) {
120+
directives_given = true;
121+
}
122+
} else if ((ORTE_MAPPING_GIVEN & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping)) ||
123+
OPAL_BINDING_POLICY_IS_SET(opal_hwloc_binding_policy) {
124+
directives_given = true;
125+
}
126+
115127
/* check for an affinity file */
116-
if (NULL != (affinity_file = getenv("LSB_AFFINITY_HOSTFILE"))) {
128+
if (!directives_given && NULL != (affinity_file = getenv("LSB_AFFINITY_HOSTFILE"))) {
117129
/* check to see if the file is empty - if it is,
118130
* then affinity wasn't actually set for this job */
119131
if (0 != stat(affinity_file, &buf)) {

orte/mca/rmaps/base/rmaps_base_frame.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@ static int check_modifiers(char *ck, orte_mapping_policy_t *tmp)
557557
for (i=0; NULL != ck2[i]; i++) {
558558
if (0 == strncasecmp(ck2[i], "span", strlen(ck2[i]))) {
559559
ORTE_SET_MAPPING_DIRECTIVE(*tmp, ORTE_MAPPING_SPAN);
560+
ORTE_SET_MAPPING_DIRECTIVE(*tmp, ORTE_MAPPING_GIVEN);
560561
found = true;
561562
} else if (0 == strncasecmp(ck2[i], "pe", strlen("pe"))) {
562563
/* break this at the = sign to get the number */

orte/orted/pmix/pmix_server_dyn.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,6 @@ int pmix_server_spawn_fn(opal_process_name_t *requestor,
304304

305305
/*** MAP-BY ***/
306306
} else if (0 == strcmp(info->key, OPAL_PMIX_MAPBY)) {
307-
if (ORTE_MAPPING_POLICY_IS_SET(jdata->map->mapping)) {
308-
/* not allowed to provide multiple mapping policies */
309-
orte_show_help("help-orte-rmaps-base.txt", "redefining-policy",
310-
true, "mapping", info->data.string,
311-
orte_rmaps_base_print_mapping(orte_rmaps_base.mapping));
312-
return ORTE_ERR_BAD_PARAM;
313-
}
314307
rc = orte_rmaps_base_set_mapping_policy(jdata, &jdata->map->mapping,
315308
NULL, info->data.string);
316309
if (ORTE_SUCCESS != rc) {
@@ -319,13 +312,6 @@ int pmix_server_spawn_fn(opal_process_name_t *requestor,
319312

320313
/*** RANK-BY ***/
321314
} else if (0 == strcmp(info->key, OPAL_PMIX_RANKBY)) {
322-
if (ORTE_RANKING_POLICY_IS_SET(jdata->map->ranking)) {
323-
/* not allowed to provide multiple ranking policies */
324-
orte_show_help("help-orte-rmaps-base.txt", "redefining-policy",
325-
true, "ranking", info->data.string,
326-
orte_rmaps_base_print_ranking(orte_rmaps_base.ranking));
327-
return ORTE_ERR_BAD_PARAM;
328-
}
329315
rc = orte_rmaps_base_set_ranking_policy(&jdata->map->ranking,
330316
jdata->map->mapping,
331317
info->data.string);
@@ -335,13 +321,6 @@ int pmix_server_spawn_fn(opal_process_name_t *requestor,
335321

336322
/*** BIND-TO ***/
337323
} else if (0 == strcmp(info->key, OPAL_PMIX_BINDTO)) {
338-
if (OPAL_BINDING_POLICY_IS_SET(jdata->map->binding)) {
339-
/* not allowed to provide multiple mapping policies */
340-
orte_show_help("help-opal-hwloc-base.txt", "redefining-policy", true,
341-
info->data.string,
342-
opal_hwloc_base_print_binding(opal_hwloc_binding_policy));
343-
return ORTE_ERR_BAD_PARAM;
344-
}
345324
rc = opal_hwloc_base_set_binding_policy(&jdata->map->binding,
346325
info->data.string);
347326
if (ORTE_SUCCESS != rc) {

0 commit comments

Comments
 (0)