discussing the idea.
+ hwloc-calc and friends have a more robust parsing of locations given
on the command-line and they report useful error messages about it.
+ + Add --whole-system to hwloc-bind, hwloc-calc, hwloc-distances and
+ hwloc-distrib, and add --restrict to hwloc-bind for uniformity among
+ tools.
* Misc
+ Calling hwloc_topology_load() or hwloc_topology_set_*() on an already
loaded topology now returns an error.
.\" -*- nroff -*-
-.\" Copyright © 2009-2012 Inria. All rights reserved.
+.\" Copyright © 2009-2013 Inria. All rights reserved.
.\" Copyright © 2010 Université of Bordeaux
.\" Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
.\" See COPYING in top-level directory.
This option has no impact on the format of input CPU set strings,
both formats are always accepted.
.TP
+\fB\-\-restrict\fR <cpuset>
+Restrict the topology to the given cpuset.
+.TP
+\fB\-\-whole\-system\fR
+Do not consider administration limitations.
+.TP
\fB\-f\fR \fB\-\-force\fR
Launch the executable even if binding failed.
.TP
/*
* Copyright © 2009 CNRS
- * Copyright © 2009-2012 Inria. All rights reserved.
+ * Copyright © 2009-2013 Inria. All rights reserved.
* Copyright © 2009-2010, 2012 Université Bordeaux 1
* Copyright © 2009 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
" Retrieve the last processors where the current process ran\n");
fprintf(where, " --pid <pid> Operate on process <pid>\n");
fprintf(where, " --taskset Use taskset-specific format when displaying cpuset strings\n");
+ fprintf(where, "Input topology options:\n");
+ fprintf(where, " --restrict <set> Restrict the topology to processors listed in <set>\n");
+ fprintf(where, " --whole-system Do not consider administration limitations\n");
+ fprintf(where, "Miscellaneous options:\n");
fprintf(where, " -f --force Launch the command even if binding failed\n");
fprintf(where, " -q --quiet Hide non-fatal error messages\n");
fprintf(where, " -v --verbose Show verbose messages\n");
int working_on_cpubind = 1; /* membind if 0 */
int get_binding = 0;
int get_last_cpu_location = 0;
+ unsigned long flags = HWLOC_TOPOLOGY_FLAG_WHOLE_IO|HWLOC_TOPOLOGY_FLAG_ICACHES;
int force = 0;
int single = 0;
int verbose = 0;
membind_set = hwloc_bitmap_alloc();
hwloc_topology_init(&topology);
- hwloc_topology_set_flags(topology, HWLOC_TOPOLOGY_FLAG_WHOLE_IO|HWLOC_TOPOLOGY_FLAG_ICACHES);
+ hwloc_topology_set_flags(topology, flags);
hwloc_topology_load(topology);
depth = hwloc_topology_get_depth(topology);
opt = 1;
goto next;
}
+ else if (!strcmp (argv[0], "--whole-system")) {
+ flags |= HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM;
+ hwloc_topology_destroy(topology);
+ hwloc_topology_init(&topology);
+ hwloc_topology_set_flags(topology, flags);
+ hwloc_topology_load(topology);
+ depth = hwloc_topology_get_depth(topology);
+ goto next;
+ }
+ else if (!strcmp (argv[0], "--restrict")) {
+ hwloc_bitmap_t restrictset;
+ int err;
+ if (argc < 2) {
+ usage (callname, stdout);
+ exit(EXIT_FAILURE);
+ }
+ restrictset = hwloc_bitmap_alloc();
+ hwloc_bitmap_sscanf(restrictset, argv[1]);
+ err = hwloc_topology_restrict (topology, restrictset, 0);
+ if (err) {
+ perror("Restricting the topology");
+ /* fallthrough */
+ }
+ hwloc_bitmap_free(restrictset);
+ argc--;
+ argv++;
+ goto next;
+ }
fprintf (stderr, "Unrecognized option: %s\n", argv[0]);
usage("hwloc-bind", stderr);
\fB\-\-restrict\fR <cpuset>
Restrict the topology to the given cpuset.
.TP
+\fB\-\-whole\-system\fR
+Do not consider administration limitations.
+.TP
\fB\-i\fR <file>, \fB\-\-input\fR <file>
Read topology from XML file <file> (instead of discovering the
topology on the local machine). If <file> is "\-", the standard input
fprintf(where, " --single Singlify the output to a single CPU\n");
fprintf(where, "Input topology options:\n");
fprintf(where, " --restrict <cpuset> Restrict the topology to processors listed in <cpuset>\n");
+ fprintf(where, " --whole-system Do not consider administration limitations\n");
hwloc_utils_input_format_usage(where, 10);
fprintf(where, "Miscellaneous options:\n");
fprintf(where, " -q --quiet Hide non-fatal error messages\n");
verbose--;
goto next;
}
+ if (!strcmp (argv[0], "--whole-system")) {
+ flags |= HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM;
+ input_changed = 1;
+ goto next;
+ }
if (!strcmp(argv[0], "--help")) {
usage(callname, stdout);
return EXIT_SUCCESS;
return EXIT_FAILURE;
}
- if (input_changed && input) {
- /* only update the input when actually using it */
+ if (input_changed) {
+ /* flags or input was changed */
hwloc_topology_destroy(topology);
hwloc_topology_init(&topology);
hwloc_topology_set_flags(topology, flags);
- err = hwloc_utils_enable_input_format(topology, input, input_format, verbose, callname);
- if (err)
- return err;
+ if (input) {
+ /* only update the input when actually using it */
+ err = hwloc_utils_enable_input_format(topology, input, input_format, verbose, callname);
+ if (err)
+ return err;
+ }
hwloc_topology_load(topology);
depth = hwloc_topology_get_depth(topology);
input_changed = 0;
size_t len = HWLOC_CALC_LINE_LEN;
char * line = malloc(len);
- if (input_changed && input) {
- /* only update the input when actually using it */
+ if (input_changed) {
+ /* flags or input was changed */
hwloc_topology_destroy(topology);
hwloc_topology_init(&topology);
hwloc_topology_set_flags(topology, flags);
- err = hwloc_utils_enable_input_format(topology, input, input_format, verbose, callname);
- if (err)
- return err;
+ if (input) {
+ /* only update the input when actually using it */
+ err = hwloc_utils_enable_input_format(topology, input, input_format, verbose, callname);
+ if (err)
+ return err;
+ }
hwloc_topology_load(topology);
depth = hwloc_topology_get_depth(topology);
input_changed = 0;
.\" -*- nroff -*-
-.\" Copyright © 2012 Inria. All rights reserved.
+.\" Copyright © 2012-2013 Inria. All rights reserved.
.\" Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
.\" See COPYING in top-level directory.
.TH HWLOC-DISTANCES "1" "#HWLOC_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"
\fB\-\-restrict\fR <cpuset>
Restrict the topology to the given cpuset.
.TP
+\fB\-\-whole\-system\fR
+Do not consider administration limitations.
+.TP
\fB\-v\fR \fB\-\-verbose\fR
Verbose messages.
.TP
fprintf(where, " -p --physical Display physical object indexes\n");
fprintf(where, "Input topology options:\n");
fprintf(where, " --restrict <set> Restrict the topology to processors listed in <set>\n");
+ fprintf(where, " --whole-system Do not consider administration limitations\n");
hwloc_utils_input_format_usage(where, 0);
fprintf(where, "Miscellaneous options:\n");
fprintf(where, " -v --verbose Show verbose messages\n");
enum hwloc_utils_input_format input_format = HWLOC_UTILS_INPUT_DEFAULT;
char *restrictstring = NULL;
hwloc_topology_t topology;
+ unsigned long flags = 0;
unsigned i, depth;
int logical = 1;
int verbose = 0;
logical = 0;
goto next;
}
+ if (!strcmp (argv[0], "--whole-system")) {
+ flags |= HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM;
+ goto next;
+ }
if (hwloc_utils_lookup_input_option(argv, argc, &opt,
&input, &input_format,
callname)) {
if (err)
return err;
}
+ hwloc_topology_set_flags(topology, flags);
hwloc_topology_load(topology);
if (restrictstring) {
.\" -*- nroff -*-
-.\" Copyright © 2010-2012 Inria. All rights reserved.
+.\" Copyright © 2010-2013 Inria. All rights reserved.
.\" Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
.\" See COPYING in top-level directory.
.TH HWLOC-DISTRIB "1" "#HWLOC_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"
\fB\-\-restrict\fR <cpuset>
Restrict the topology to the given cpuset.
.TP
+\fB\-\-whole\-system\fR
+Do not consider administration limitations.
+.TP
\fB\-\-version\fR
Report version and exit.
.
/*
* Copyright © 2009 CNRS
- * Copyright © 2009-2012 Inria. All rights reserved.
+ * Copyright © 2009-2013 Inria. All rights reserved.
* Copyright © 2009-2010 Université Bordeaux 1
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
fprintf(where, " --at <type> Distribute among objects of the given type\n");
fprintf(where, "Input topology options:\n");
fprintf(where, " --restrict <set> Restrict the topology to processors listed in <set>\n");
+ fprintf(where, " --whole-system Do not consider administration limitations\n");
hwloc_utils_input_format_usage(where, 0);
fprintf(where, "Formatting options:\n");
fprintf(where, " --single Singlify each output to a single CPU\n");
char *restrictstring = NULL;
hwloc_obj_type_t from_type = (hwloc_obj_type_t) -1, to_type = (hwloc_obj_type_t) -1;
hwloc_topology_t topology;
+ unsigned long flags = 0;
int opt;
int err;
verbose = 1;
goto next;
}
+ if (!strcmp (argv[0], "--whole-system")) {
+ flags |= HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM;
+ goto next;
+ }
if (!strcmp(argv[0], "--help")) {
usage(callname, stdout);
return EXIT_SUCCESS;
if (err)
return err;
}
+ hwloc_topology_set_flags(topology, flags);
hwloc_topology_load(topology);
if (restrictstring) {