Skip to content

Commit 6d62fb0

Browse files
authored
Merge pull request #6874 from rhc54/cmr40/lsf
v4.0.x: Allow individual jobs to set map policy, override LSF bindfile
2 parents e547a2b + f0f25b6 commit 6d62fb0

File tree

3 files changed

+16
-23
lines changed

3 files changed

+16
-23
lines changed

orte/mca/ras/lsf/ras_lsf_module.c

Lines changed: 15 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
*
@@ -36,6 +36,7 @@
3636

3737
#include "orte/mca/rmaps/rmaps_types.h"
3838
#include "orte/mca/errmgr/errmgr.h"
39+
#include "orte/mca/rmaps/base/base.h"
3940
#include "orte/runtime/orte_globals.h"
4041
#include "orte/util/show_help.h"
4142

@@ -70,6 +71,7 @@ static int allocate(orte_job_t *jdata, opal_list_t *nodes)
7071
char *affinity_file;
7172
struct stat buf;
7273
char *ptr;
74+
bool directives_given = false;
7375

7476
/* get the list of allocated nodes */
7577
if ((num_nodes = lsb_getalloc(&nodelist)) < 0) {
@@ -112,8 +114,19 @@ static int allocate(orte_job_t *jdata, opal_list_t *nodes)
112114
/* release the nodelist from lsf */
113115
opal_argv_free(nodelist);
114116

117+
/* check to see if any mapping or binding directives were given */
118+
if (NULL != jdata && NULL != jdata->map) {
119+
if ((ORTE_MAPPING_GIVEN & ORTE_GET_MAPPING_DIRECTIVE(jdata->map->mapping)) ||
120+
OPAL_BINDING_POLICY_IS_SET(jdata->map->binding)) {
121+
directives_given = true;
122+
}
123+
} else if ((ORTE_MAPPING_GIVEN & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping)) ||
124+
OPAL_BINDING_POLICY_IS_SET(opal_hwloc_binding_policy)) {
125+
directives_given = true;
126+
}
127+
115128
/* check for an affinity file */
116-
if (NULL != (affinity_file = getenv("LSB_AFFINITY_HOSTFILE"))) {
129+
if (!directives_given && NULL != (affinity_file = getenv("LSB_AFFINITY_HOSTFILE"))) {
117130
/* check to see if the file is empty - if it is,
118131
* then affinity wasn't actually set for this job */
119132
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
@@ -556,6 +556,7 @@ static int check_modifiers(char *ck, orte_mapping_policy_t *tmp)
556556
for (i=0; NULL != ck2[i]; i++) {
557557
if (0 == strncasecmp(ck2[i], "span", strlen(ck2[i]))) {
558558
ORTE_SET_MAPPING_DIRECTIVE(*tmp, ORTE_MAPPING_SPAN);
559+
ORTE_SET_MAPPING_DIRECTIVE(*tmp, ORTE_MAPPING_GIVEN);
559560
found = true;
560561
} else if (0 == strncasecmp(ck2[i], "pe", strlen("pe"))) {
561562
/* 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
@@ -302,13 +302,6 @@ int pmix_server_spawn_fn(opal_process_name_t *requestor,
302302

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

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

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

0 commit comments

Comments
 (0)