Skip to content

Commit 858586b

Browse files
authored
Merge pull request #6873 from rhc54/cmr31/lsf
v3.1.x: Allow individual jobs to set map policy, override LSF bindfile
2 parents b91779d + 7ebc42c commit 858586b

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
@@ -562,6 +562,7 @@ static int check_modifiers(char *ck, orte_mapping_policy_t *tmp)
562562
for (i=0; NULL != ck2[i]; i++) {
563563
if (0 == strncasecmp(ck2[i], "span", strlen(ck2[i]))) {
564564
ORTE_SET_MAPPING_DIRECTIVE(*tmp, ORTE_MAPPING_SPAN);
565+
ORTE_SET_MAPPING_DIRECTIVE(*tmp, ORTE_MAPPING_GIVEN);
565566
found = true;
566567
} else if (0 == strncasecmp(ck2[i], "pe", strlen("pe"))) {
567568
/* 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
@@ -282,13 +282,6 @@ int pmix_server_spawn_fn(opal_process_name_t *requestor,
282282

283283
/*** MAP-BY ***/
284284
} else if (0 == strcmp(info->key, OPAL_PMIX_MAPBY)) {
285-
if (ORTE_MAPPING_POLICY_IS_SET(jdata->map->mapping)) {
286-
/* not allowed to provide multiple mapping policies */
287-
orte_show_help("help-orte-rmaps-base.txt", "redefining-policy",
288-
true, "mapping", info->data.string,
289-
orte_rmaps_base_print_mapping(orte_rmaps_base.mapping));
290-
return ORTE_ERR_BAD_PARAM;
291-
}
292285
rc = orte_rmaps_base_set_mapping_policy(jdata, &jdata->map->mapping,
293286
NULL, info->data.string);
294287
if (ORTE_SUCCESS != rc) {
@@ -297,13 +290,6 @@ int pmix_server_spawn_fn(opal_process_name_t *requestor,
297290

298291
/*** RANK-BY ***/
299292
} else if (0 == strcmp(info->key, OPAL_PMIX_RANKBY)) {
300-
if (ORTE_RANKING_POLICY_IS_SET(jdata->map->ranking)) {
301-
/* not allowed to provide multiple ranking policies */
302-
orte_show_help("help-orte-rmaps-base.txt", "redefining-policy",
303-
true, "ranking", info->data.string,
304-
orte_rmaps_base_print_ranking(orte_rmaps_base.ranking));
305-
return ORTE_ERR_BAD_PARAM;
306-
}
307293
rc = orte_rmaps_base_set_ranking_policy(&jdata->map->ranking,
308294
jdata->map->mapping,
309295
info->data.string);
@@ -313,13 +299,6 @@ int pmix_server_spawn_fn(opal_process_name_t *requestor,
313299

314300
/*** BIND-TO ***/
315301
} else if (0 == strcmp(info->key, OPAL_PMIX_BINDTO)) {
316-
if (OPAL_BINDING_POLICY_IS_SET(jdata->map->binding)) {
317-
/* not allowed to provide multiple mapping policies */
318-
orte_show_help("help-opal-hwloc-base.txt", "redefining-policy", true,
319-
info->data.string,
320-
opal_hwloc_base_print_binding(opal_hwloc_binding_policy));
321-
return ORTE_ERR_BAD_PARAM;
322-
}
323302
rc = opal_hwloc_base_set_binding_policy(&jdata->map->binding,
324303
info->data.string);
325304
if (ORTE_SUCCESS != rc) {

0 commit comments

Comments
 (0)