Skip to content

Commit 186059c

Browse files
author
Ralph Castain
authored
Merge pull request #2803 from rhc54/topic/host
Revamp -host and -cpu-list options per f2f meeting
2 parents c6595c2 + ef86707 commit 186059c

File tree

15 files changed

+60
-73
lines changed

15 files changed

+60
-73
lines changed

opal/mca/hwloc/base/base.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
3-
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
3+
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
44
* $COPYRIGHT$
55
*
66
* Additional copyrights may follow
@@ -57,8 +57,7 @@ opal_hwloc_print_buffers_t *opal_hwloc_get_print_buffer(void);
5757
extern char* opal_hwloc_print_null;
5858
OPAL_DECLSPEC char* opal_hwloc_base_print_locality(opal_hwloc_locality_t locality);
5959

60-
OPAL_DECLSPEC extern char *opal_hwloc_base_slot_list;
61-
OPAL_DECLSPEC extern char *opal_hwloc_base_cpu_set;
60+
OPAL_DECLSPEC extern char *opal_hwloc_base_cpu_list;
6261
OPAL_DECLSPEC extern hwloc_cpuset_t opal_hwloc_base_given_cpus;
6362
OPAL_DECLSPEC extern char *opal_hwloc_base_topo_file;
6463

@@ -192,7 +191,7 @@ OPAL_DECLSPEC bool opal_hwloc_base_single_cpu(hwloc_cpuset_t cpuset);
192191
* Provide a utility to parse a slot list against the local
193192
* cpus of given type, and produce a cpuset for the described binding
194193
*/
195-
OPAL_DECLSPEC int opal_hwloc_base_slot_list_parse(const char *slot_str,
194+
OPAL_DECLSPEC int opal_hwloc_base_cpu_list_parse(const char *slot_str,
196195
hwloc_topology_t topo,
197196
opal_hwloc_resource_type_t rtype,
198197
hwloc_cpuset_t cpumask);

opal/mca/hwloc/base/hwloc_base_frame.c

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2011-2014 Cisco Systems, Inc. All rights reserved.
3-
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
3+
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
44
* Copyright (c) 2016 Research Organization for Information Science
55
* and Technology (RIST). All rights reserved.
66
* $COPYRIGHT$
@@ -44,8 +44,7 @@ hwloc_cpuset_t opal_hwloc_base_given_cpus=NULL;
4444
opal_hwloc_base_map_t opal_hwloc_base_map = OPAL_HWLOC_BASE_MAP_NONE;
4545
opal_hwloc_base_mbfa_t opal_hwloc_base_mbfa = OPAL_HWLOC_BASE_MBFA_WARN;
4646
opal_binding_policy_t opal_hwloc_binding_policy=0;
47-
char *opal_hwloc_base_slot_list=NULL;
48-
char *opal_hwloc_base_cpu_set=NULL;
47+
char *opal_hwloc_base_cpu_list=NULL;
4948
bool opal_hwloc_report_bindings=false;
5049
hwloc_obj_type_t opal_hwloc_levels[] = {
5150
HWLOC_OBJ_MACHINE,
@@ -87,7 +86,7 @@ static bool opal_hwloc_base_bind_to_socket = false;
8786
static int opal_hwloc_base_register(mca_base_register_flag_t flags)
8887
{
8988
mca_base_var_enum_t *new_enum;
90-
int ret;
89+
int ret, varid;
9190

9291
/* hwloc_base_mbind_policy */
9392

@@ -142,17 +141,13 @@ static int opal_hwloc_base_register(mca_base_register_flag_t flags)
142141
MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, OPAL_INFO_LVL_9,
143142
MCA_BASE_VAR_SCOPE_READONLY, &opal_hwloc_report_bindings);
144143

145-
opal_hwloc_base_slot_list = NULL;
146-
(void) mca_base_var_register("opal", "hwloc", "base", "slot_list",
147-
"List of processor IDs to bind processes to [default=NULL]",
148-
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, OPAL_INFO_LVL_9,
149-
MCA_BASE_VAR_SCOPE_READONLY, &opal_hwloc_base_slot_list);
150-
151-
opal_hwloc_base_cpu_set = NULL;
152-
(void) mca_base_var_register("opal", "hwloc", "base", "cpu_set",
153-
"Comma-separated list of ranges specifying logical cpus allocated to this job [default: none]",
154-
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, OPAL_INFO_LVL_9,
155-
MCA_BASE_VAR_SCOPE_READONLY, &opal_hwloc_base_cpu_set);
144+
opal_hwloc_base_cpu_list = NULL;
145+
varid = mca_base_var_register("opal", "hwloc", "base", "cpu_list",
146+
"Comma-separated list of ranges specifying logical cpus to be used by these processes [default: none]",
147+
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, OPAL_INFO_LVL_9,
148+
MCA_BASE_VAR_SCOPE_READONLY, &opal_hwloc_base_cpu_list);
149+
mca_base_var_register_synonym (varid, "opal", "hwloc", "base", "slot_list", MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
150+
mca_base_var_register_synonym (varid, "opal", "hwloc", "base", "cpu_set", MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
156151

157152
/* declare hwthreads as independent cpus */
158153
opal_hwloc_use_hwthreads_as_cpus = false;
@@ -217,27 +212,14 @@ static int opal_hwloc_base_open(mca_base_open_flag_t flags)
217212
}
218213

219214
/* did the user provide a slot list? */
220-
if (NULL != opal_hwloc_base_slot_list) {
221-
/* if we already were given a policy, then this is an error */
222-
if (OPAL_BINDING_POLICY_IS_SET(opal_hwloc_binding_policy)) {
223-
opal_show_help("help-opal-hwloc-base.txt", "redefining-policy", true,
224-
"socket", opal_hwloc_base_print_binding(opal_hwloc_binding_policy));
225-
return OPAL_ERR_SILENT;
226-
}
215+
if (NULL != opal_hwloc_base_cpu_list) {
216+
/* it is okay if a binding policy was already given - just ensure that
217+
* we do bind to the given cpus if provided, otherwise this would be
218+
* ignored if someone didn't also specify a binding policy
219+
*/
227220
OPAL_SET_BINDING_POLICY(opal_hwloc_binding_policy, OPAL_BIND_TO_CPUSET);
228221
}
229222

230-
/* cpu allocation specification */
231-
if (NULL != opal_hwloc_base_cpu_set) {
232-
if (!OPAL_BINDING_POLICY_IS_SET(opal_hwloc_binding_policy)) {
233-
/* it is okay if a binding policy was already given - just ensure that
234-
* we do bind to the given cpus if provided, otherwise this would be
235-
* ignored if someone didn't also specify a binding policy
236-
*/
237-
OPAL_SET_BINDING_POLICY(opal_hwloc_binding_policy, OPAL_BIND_TO_CPUSET);
238-
}
239-
}
240-
241223
/* if we are binding to hwthreads, then we must use hwthreads as cpus */
242224
if (OPAL_GET_BINDING_POLICY(opal_hwloc_binding_policy) == OPAL_BIND_TO_HWTHREAD) {
243225
opal_hwloc_use_hwthreads_as_cpus = true;

opal/mca/hwloc/base/hwloc_base_util.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
1414
* Copyright (c) 2012-2015 Los Alamos National Security, LLC.
1515
* All rights reserved.
16-
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
16+
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
1717
* Copyright (c) 2015-2016 Research Organization for Information Science
1818
* and Technology (RIST). All rights reserved.
1919
* $COPYRIGHT$
@@ -85,7 +85,7 @@ hwloc_obj_t opal_hwloc_base_get_pu(hwloc_topology_t topo,
8585
OPAL_OUTPUT_VERBOSE((5, opal_hwloc_base_framework.framework_output,
8686
"physical cpu %d %s found in cpuset %s",
8787
lid, (NULL == obj) ? "not" : "is",
88-
(NULL == opal_hwloc_base_cpu_set) ? "None" : opal_hwloc_base_cpu_set));
88+
(NULL == opal_hwloc_base_cpu_list) ? "None" : opal_hwloc_base_cpu_list));
8989
/* we now need to shift upward to the core including this PU */
9090
if (NULL != obj && HWLOC_OBJ_CORE == obj_type) {
9191
obj = obj->parent;
@@ -101,7 +101,7 @@ hwloc_obj_t opal_hwloc_base_get_pu(hwloc_topology_t topo,
101101
OPAL_OUTPUT_VERBOSE((5, opal_hwloc_base_framework.framework_output,
102102
"logical cpu %d %s found in cpuset %s",
103103
lid, (NULL == obj) ? "not" : "is",
104-
(NULL == opal_hwloc_base_cpu_set) ? "None" : opal_hwloc_base_cpu_set));
104+
(NULL == opal_hwloc_base_cpu_list) ? "None" : opal_hwloc_base_cpu_list));
105105

106106
/* Found the right core (or PU). Return the object */
107107
return obj;
@@ -132,7 +132,7 @@ int opal_hwloc_base_filter_cpus(hwloc_topology_t topo)
132132
}
133133

134134
/* process any specified default cpu set against this topology */
135-
if (NULL == opal_hwloc_base_cpu_set) {
135+
if (NULL == opal_hwloc_base_cpu_list) {
136136
/* get the root available cpuset */
137137
avail = hwloc_bitmap_alloc();
138138
hwloc_bitmap_and(avail, root->online_cpuset, root->allowed_cpuset);
@@ -142,7 +142,7 @@ int opal_hwloc_base_filter_cpus(hwloc_topology_t topo)
142142
OPAL_OUTPUT_VERBOSE((5, opal_hwloc_base_framework.framework_output,
143143
"hwloc:base: filtering cpuset"));
144144
/* find the specified logical cpus */
145-
ranges = opal_argv_split(opal_hwloc_base_cpu_set, ',');
145+
ranges = opal_argv_split(opal_hwloc_base_cpu_list, ',');
146146
avail = hwloc_bitmap_alloc();
147147
hwloc_bitmap_zero(avail);
148148
res = hwloc_bitmap_alloc();
@@ -550,7 +550,7 @@ static void df_search_cores(hwloc_obj_t obj, unsigned int *cnt)
550550
data = OBJ_NEW(opal_hwloc_obj_data_t);
551551
obj->userdata = (void*)data;
552552
}
553-
if (NULL == opal_hwloc_base_cpu_set) {
553+
if (NULL == opal_hwloc_base_cpu_list) {
554554
if (!hwloc_bitmap_intersects(obj->cpuset, obj->allowed_cpuset)) {
555555
/*
556556
* do not count not allowed cores (e.g. cores with zero allowed PU)
@@ -1250,7 +1250,7 @@ static int socket_core_to_cpu_set(char *socket_core_list,
12501250
return rc;
12511251
}
12521252

1253-
int opal_hwloc_base_slot_list_parse(const char *slot_str,
1253+
int opal_hwloc_base_cpu_list_parse(const char *slot_str,
12541254
hwloc_topology_t topo,
12551255
opal_hwloc_resource_type_t rtype,
12561256
hwloc_cpuset_t cpumask)

orte/mca/ess/base/ess_base_fns.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
1313
* Copyright (c) 2011-2012 Los Alamos National Security, LLC.
1414
* All rights reserved.
15-
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
15+
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
1616
* Copyright (c) 2014 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
1818
* $COPYRIGHT$
@@ -149,7 +149,7 @@ int orte_ess_base_proc_binding(void)
149149
*/
150150
hwloc_bitmap_zero(cpus);
151151
if (OPAL_BIND_TO_CPUSET == OPAL_GET_BINDING_POLICY(opal_hwloc_binding_policy)) {
152-
if (OPAL_SUCCESS != (ret = opal_hwloc_base_slot_list_parse(opal_hwloc_base_slot_list,
152+
if (OPAL_SUCCESS != (ret = opal_hwloc_base_cpu_list_parse(opal_hwloc_base_cpu_list,
153153
opal_hwloc_topology,
154154
OPAL_HWLOC_LOGICAL, cpus))) {
155155
error = "Setting processor affinity failed";

orte/mca/rmaps/base/rmaps_base_binding.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ static int bind_in_place(orte_job_t *jdata,
585585

586586
static int bind_to_cpuset(orte_job_t *jdata)
587587
{
588-
/* bind each process to opal_hwloc_base_cpu_set */
588+
/* bind each process to opal_hwloc_base_cpu_list */
589589
int i, j;
590590
orte_job_map_t *map;
591591
orte_node_t *node;
@@ -596,9 +596,9 @@ static int bind_to_cpuset(orte_job_t *jdata)
596596
char *cpu_bitmap;
597597

598598
opal_output_verbose(5, orte_rmaps_base_framework.framework_output,
599-
"mca:rmaps: bind job %s to cpuset %s",
599+
"mca:rmaps: bind job %s to cpus %s",
600600
ORTE_JOBID_PRINT(jdata->jobid),
601-
opal_hwloc_base_cpu_set);
601+
opal_hwloc_base_cpu_list);
602602
/* initialize */
603603
map = jdata->map;
604604

orte/mca/rmaps/rank_file/rmaps_rank_file.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ static int orte_rmaps_rf_map(orte_job_t *jdata)
199199
/* get the rankfile entry for this rank */
200200
if (NULL == (rfmap = (orte_rmaps_rank_file_map_t*)opal_pointer_array_get_item(&rankmap, rank))) {
201201
/* if we were give a default slot-list, then use it */
202-
if (NULL != opal_hwloc_base_slot_list) {
203-
slots = opal_hwloc_base_slot_list;
202+
if (NULL != opal_hwloc_base_cpu_list) {
203+
slots = opal_hwloc_base_cpu_list;
204204
/* take the next node off of the available list */
205205
node = NULL;
206206
OPAL_LIST_FOREACH(nd, &node_list, orte_node_t) {
@@ -318,7 +318,7 @@ static int orte_rmaps_rf_map(orte_job_t *jdata)
318318
}
319319
bitmap = hwloc_bitmap_alloc();
320320
/* parse the slot_list to find the socket and core */
321-
if (ORTE_SUCCESS != (rc = opal_hwloc_base_slot_list_parse(slots, node->topology->topo, rtype, bitmap))) {
321+
if (ORTE_SUCCESS != (rc = opal_hwloc_base_cpu_list_parse(slots, node->topology->topo, rtype, bitmap))) {
322322
ORTE_ERROR_LOG(rc);
323323
hwloc_bitmap_free(bitmap);
324324
goto error;

orte/mca/rmaps/rank_file/rmaps_rank_file_component.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* All rights reserved.
1313
* Copyright (c) 2008 Voltaire. All rights reserved
1414
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
15-
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
15+
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
1616
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
1717
* reserved.
1818
* $COPYRIGHT$
@@ -106,7 +106,7 @@ static int orte_rmaps_rank_file_register(void)
106106
static int orte_rmaps_rank_file_open(void)
107107
{
108108
/* ensure we flag mapping by user */
109-
if (NULL != opal_hwloc_base_slot_list || NULL != orte_rankfile) {
109+
if (NULL != opal_hwloc_base_cpu_list || NULL != orte_rankfile) {
110110
if (ORTE_MAPPING_GIVEN & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping)) {
111111
/* if a non-default mapping is already specified, then we
112112
* have an error

orte/mca/rmaps/seq/rmaps_seq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ static int orte_rmaps_seq_map(orte_job_t *jdata)
460460
/* setup the bitmap */
461461
bitmap = hwloc_bitmap_alloc();
462462
/* parse the slot_list to find the socket and core */
463-
if (ORTE_SUCCESS != (rc = opal_hwloc_base_slot_list_parse(sq->cpuset, node->topology->topo, rtype, bitmap))) {
463+
if (ORTE_SUCCESS != (rc = opal_hwloc_base_cpu_list_parse(sq->cpuset, node->topology->topo, rtype, bitmap))) {
464464
ORTE_ERROR_LOG(rc);
465465
hwloc_bitmap_free(bitmap);
466466
goto error;

orte/mca/schizo/ompi/schizo_ompi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ static opal_cmd_line_init_t cmd_line_init[] = {
317317
"Whether to report process bindings to stderr" },
318318

319319
/* slot list option */
320-
{ "hwloc_base_slot_list", '\0', "slot-list", "slot-list", 1,
321-
&orte_cmd_options.slot_list, OPAL_CMD_LINE_TYPE_STRING,
320+
{ "hwloc_base_cpu_list", '\0', "cpu-list", "cpu-list", 1,
321+
&orte_cmd_options.cpu_list, OPAL_CMD_LINE_TYPE_STRING,
322322
"List of processor IDs to bind processes to [default=NULL]"},
323323

324324
/* generalized pattern mapping option */

orte/orted/orted_submit.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -880,8 +880,8 @@ int orte_submit_job(char *argv[], int *index,
880880
if (orte_cmd_options.report_bindings) {
881881
orte_set_attribute(&jdata->attributes, ORTE_JOB_REPORT_BINDINGS, ORTE_ATTR_GLOBAL, NULL, OPAL_BOOL);
882882
}
883-
if (orte_cmd_options.slot_list) {
884-
orte_set_attribute(&jdata->attributes, ORTE_JOB_SLOT_LIST, ORTE_ATTR_GLOBAL, orte_cmd_options.slot_list, OPAL_STRING);
883+
if (orte_cmd_options.cpu_list) {
884+
orte_set_attribute(&jdata->attributes, ORTE_JOB_CPU_LIST, ORTE_ATTR_GLOBAL, orte_cmd_options.cpu_list, OPAL_STRING);
885885
}
886886

887887
/* if recovery was enabled on the cmd line, do so */
@@ -1158,10 +1158,10 @@ static int init_globals(void)
11581158
free(orte_cmd_options.report_uri);
11591159
orte_cmd_options.report_uri = NULL;
11601160
}
1161-
if (NULL != orte_cmd_options.slot_list) {
1162-
free(orte_cmd_options.slot_list);
1163-
orte_cmd_options.slot_list= NULL;
1164-
}
1161+
if (NULL != orte_cmd_options.cpu_list) {
1162+
free(orte_cmd_options.cpu_list);
1163+
orte_cmd_options.cpu_list= NULL;
1164+
}
11651165
orte_cmd_options.preload_binaries = false;
11661166
if (NULL != orte_cmd_options.preload_files) {
11671167
free(orte_cmd_options.preload_files);

0 commit comments

Comments
 (0)