Open MPI logo

Hardware Locality Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Development mailing list

Subject: Re: [hwloc-devel] [hwloc-svn] svn:hwloc r2831
From: Brice Goglin (Brice.Goglin_at_[hidden])
Date: 2010-11-24 04:14:35


We should uniformize how the graphic/drawing and text outputs are called
in the manpage/usage/doc/README, it may be a bit misleading now. But I
am not sure which terms are best between graphic and drawing, and
between console and text.

Also, is everybody ok with the new defaults and formatting:
* graphic/drawing
physical by default
legend by default
both logical and physical indexes prefixed with #
* text/console
logical by default
never any legend (add one in verbose mode?)
logical indexes prefixed with # (and the interesting physical one appear
in parentheses as phys=X)
physical indexes prefixed with p#

FWIW, in 1.0.3, the only thing that changes is the default index in
drawing mode. There is no legend or prefix change there.

Brice

Le 24/11/2010 10:02, bgoglin_at_[hidden] a écrit :
> Author: bgoglin
> Date: 2010-11-24 04:02:18 EST (Wed, 24 Nov 2010)
> New Revision: 2831
> URL: https://svn.open-mpi.org/trac/hwloc/changeset/2831
>
> Log:
> lstopo: add --no-legend to remove the new text legend at the bottom
>
> And update NEWS about all this.
> Text files modified:
> trunk/NEWS | 5 +++++
> trunk/utils/lstopo-cairo.c | 36 ++++++++++++++++++------------------
> trunk/utils/lstopo-draw.c | 30 ++++++++++++++++--------------
> trunk/utils/lstopo-fig.c | 6 +++---
> trunk/utils/lstopo-text.c | 8 ++++----
> trunk/utils/lstopo-windows.c | 4 ++--
> trunk/utils/lstopo-xml.c | 2 +-
> trunk/utils/lstopo.1in | 3 +++
> trunk/utils/lstopo.c | 27 ++++++++++++++++-----------
> trunk/utils/lstopo.h | 6 +++---
> 10 files changed, 71 insertions(+), 56 deletions(-)
>
> Modified: trunk/NEWS
> ==============================================================================
> --- trunk/NEWS (original)
> +++ trunk/NEWS 2010-11-24 04:02:18 EST (Wed, 24 Nov 2010)
> @@ -52,6 +52,11 @@
> with CUDA Runtime and Driver APIs.
> + Add Myrinet Express helper in myriexpress.h to ease interoperability.
> * Tools
> + + lstopo now displays physical/OS indexes by default in drawing mode
> + (use -l to switch back to logical indexes). The text output still uses
> + logical by default (use -p to switch to physical indexes).
> + + Add a legend at the bottom of the lstopo drawing output, use --no-legend
> + to remove it.
> + Add hwloc-ps to list process' bindings.
> + Add --membind and --mempolicy options to hwloc-bind.
> + Improve tools command-line options by adding a generic --input option
>
> Modified: trunk/utils/lstopo-cairo.c
> ==============================================================================
> --- trunk/utils/lstopo-cairo.c (original)
> +++ trunk/utils/lstopo-cairo.c 2010-11-24 04:02:18 EST (Wed, 24 Nov 2010)
> @@ -95,11 +95,11 @@
> #endif /* (CAIRO_HAS_PNG_FUNCTIONS + CAIRO_HAS_PDF_SURFACE + CAIRO_HAS_PS_SURFACE + CAIRO_HAS_SVG_SURFACE) */
>
> static void
> -topo_cairo_paint(struct draw_methods *methods, int logical, hwloc_topology_t topology, cairo_surface_t *cs)
> +topo_cairo_paint(struct draw_methods *methods, int logical, int legend, hwloc_topology_t topology, cairo_surface_t *cs)
> {
> cairo_t *c;
> c = cairo_create(cs);
> - output_draw(methods, logical, topology, c);
> + output_draw(methods, logical, legend, topology, c);
> cairo_show_page(c);
> cairo_destroy(c);
> }
> @@ -207,15 +207,15 @@
> }
>
> void
> -output_x11(hwloc_topology_t topology, const char *filename __hwloc_attribute_unused, int logical, int verbose_mode __hwloc_attribute_unused)
> +output_x11(hwloc_topology_t topology, const char *filename __hwloc_attribute_unused, int logical, int legend, int verbose_mode __hwloc_attribute_unused)
> {
> - struct display *disp = output_draw_start(&x11_draw_methods, logical, topology, NULL);
> + struct display *disp = output_draw_start(&x11_draw_methods, logical, legend, topology, NULL);
> int finish = 0;
> int state = 0;
> int x = 0, y = 0; /* shut warning down */
> int lastx = disp->x, lasty = disp->y;
>
> - topo_cairo_paint(&x11_draw_methods, logical, topology, disp->cs);
> + topo_cairo_paint(&x11_draw_methods, logical, legend, topology, disp->cs);
>
> while (!finish) {
> XEvent e;
> @@ -231,7 +231,7 @@
> switch (e.type) {
> case Expose:
> if (e.xexpose.count < 1)
> - topo_cairo_paint(&x11_draw_methods, logical, topology, disp->cs);
> + topo_cairo_paint(&x11_draw_methods, logical, legend, topology, disp->cs);
> break;
> case MotionNotify:
> if (state) {
> @@ -346,7 +346,7 @@
> };
>
> void
> -output_png(hwloc_topology_t topology, const char *filename, int logical, int verbose_mode __hwloc_attribute_unused)
> +output_png(hwloc_topology_t topology, const char *filename, int logical, int legend, int verbose_mode __hwloc_attribute_unused)
> {
> FILE *output = open_file(filename, "w");
> cairo_surface_t *cs;
> @@ -356,9 +356,9 @@
> return;
> }
>
> - cs = output_draw_start(&png_draw_methods, logical, topology, output);
> + cs = output_draw_start(&png_draw_methods, logical, legend, topology, output);
>
> - topo_cairo_paint(&png_draw_methods, logical, topology, cs);
> + topo_cairo_paint(&png_draw_methods, logical, legend, topology, cs);
> cairo_surface_write_to_png_stream(cs, topo_cairo_write, output);
> cairo_surface_destroy(cs);
> fclose(output);
> @@ -383,7 +383,7 @@
> };
>
> void
> -output_pdf(hwloc_topology_t topology, const char *filename, int logical, int verbose_mode __hwloc_attribute_unused)
> +output_pdf(hwloc_topology_t topology, const char *filename, int logical, int legend, int verbose_mode __hwloc_attribute_unused)
> {
> FILE *output = open_file(filename, "w");
> cairo_surface_t *cs;
> @@ -393,9 +393,9 @@
> return;
> }
>
> - cs = output_draw_start(&pdf_draw_methods, logical, topology, output);
> + cs = output_draw_start(&pdf_draw_methods, logical, legend, topology, output);
>
> - topo_cairo_paint(&pdf_draw_methods, logical, topology, cs);
> + topo_cairo_paint(&pdf_draw_methods, logical, legend, topology, cs);
> cairo_surface_flush(cs);
> cairo_surface_destroy(cs);
> fclose(output);
> @@ -420,7 +420,7 @@
> };
>
> void
> -output_ps(hwloc_topology_t topology, const char *filename, int logical, int verbose_mode __hwloc_attribute_unused)
> +output_ps(hwloc_topology_t topology, const char *filename, int logical, int legend, int verbose_mode __hwloc_attribute_unused)
> {
> FILE *output = open_file(filename, "w");
> cairo_surface_t *cs;
> @@ -430,9 +430,9 @@
> return;
> }
>
> - cs = output_draw_start(&ps_draw_methods, logical, topology, output);
> + cs = output_draw_start(&ps_draw_methods, logical, legend, topology, output);
>
> - topo_cairo_paint(&ps_draw_methods, logical, topology, cs);
> + topo_cairo_paint(&ps_draw_methods, logical, legend, topology, cs);
> cairo_surface_flush(cs);
> cairo_surface_destroy(cs);
> fclose(output);
> @@ -457,7 +457,7 @@
> };
>
> void
> -output_svg(hwloc_topology_t topology, const char *filename, int logical, int verbose_mode __hwloc_attribute_unused)
> +output_svg(hwloc_topology_t topology, const char *filename, int logical, int legend, int verbose_mode __hwloc_attribute_unused)
> {
> FILE *output;
> cairo_surface_t *cs;
> @@ -468,9 +468,9 @@
> return;
> }
>
> - cs = output_draw_start(&svg_draw_methods, logical, topology, output);
> + cs = output_draw_start(&svg_draw_methods, logical, legend, topology, output);
>
> - topo_cairo_paint(&svg_draw_methods, logical, topology, cs);
> + topo_cairo_paint(&svg_draw_methods, logical, legend, topology, cs);
> cairo_surface_flush(cs);
> cairo_surface_destroy(cs);
> fclose(output);
>
> Modified: trunk/utils/lstopo-draw.c
> ==============================================================================
> --- trunk/utils/lstopo-draw.c (original)
> +++ trunk/utils/lstopo-draw.c 2010-11-24 04:02:18 EST (Wed, 24 Nov 2010)
> @@ -656,7 +656,7 @@
> }
>
> static void
> -fig(hwloc_topology_t topology, struct draw_methods *methods, int logical, hwloc_obj_t level, void *output, unsigned depth, unsigned x, unsigned y)
> +fig(hwloc_topology_t topology, struct draw_methods *methods, int logical, int legend, hwloc_obj_t level, void *output, unsigned depth, unsigned x, unsigned y)
> {
> unsigned totwidth, totheight;
> time_t t;
> @@ -674,18 +674,20 @@
> if (n && date[n-1] == '\n');
> date[n-1] = 0;
>
> - if (hwloc_topology_is_thissystem(topology) &&
> + if (legend) {
> + if (hwloc_topology_is_thissystem(topology) &&
> #ifdef HWLOC_WIN_SYS
> - GetComputerName(hostname, &hostname_size)
> + GetComputerName(hostname, &hostname_size)
> #else
> - !gethostname(hostname, hostname_size)
> + !gethostname(hostname, hostname_size)
> #endif
> - )
> - snprintf(text, sizeof(text), "%s IDs for %s on %s", logical ? "logical" : "physical", hostname, date);
> - else
> - snprintf(text, sizeof(text), "%s IDs on %s", logical ? "logical" : "physical", date);
> - methods->box(output, 0xff, 0xff, 0xff, depth, 0, totwidth, totheight, gridsize + fontsize + gridsize);
> - methods->text(output, 0, 0, 0, fontsize, depth, gridsize, totheight + gridsize, text);
> + )
> + snprintf(text, sizeof(text), "%s IDs for %s on %s", logical ? "logical" : "physical", hostname, date);
> + else
> + snprintf(text, sizeof(text), "%s IDs on %s", logical ? "logical" : "physical", date);
> + methods->box(output, 0xff, 0xff, 0xff, depth, 0, totwidth, totheight, gridsize + fontsize + gridsize);
> + methods->text(output, 0, 0, 0, fontsize, depth, gridsize, totheight + gridsize, text);
> + }
> }
>
> /*
> @@ -756,10 +758,10 @@
> };
>
> void *
> -output_draw_start(struct draw_methods *methods, int logical, hwloc_topology_t topology, void *output)
> +output_draw_start(struct draw_methods *methods, int logical, int legend, hwloc_topology_t topology, void *output)
> {
> struct coords coords = { .x = 0, .y = 0};
> - fig(topology, &getmax_draw_methods, logical, hwloc_get_root_obj(topology), &coords, 100, 0, 0);
> + fig(topology, &getmax_draw_methods, logical, legend, hwloc_get_root_obj(topology), &coords, 100, 0, 0);
> output = methods->start(output, coords.x, coords.y);
> methods->declare_color(output, 0, 0, 0);
> methods->declare_color(output, NODE_R_COLOR, NODE_G_COLOR, NODE_B_COLOR);
> @@ -778,7 +780,7 @@
> }
>
> void
> -output_draw(struct draw_methods *methods, int logical, hwloc_topology_t topology, void *output)
> +output_draw(struct draw_methods *methods, int logical, int legend, hwloc_topology_t topology, void *output)
> {
> - fig(topology, methods, logical, hwloc_get_root_obj(topology), output, 100, 0, 0);
> + fig(topology, methods, logical, legend, hwloc_get_root_obj(topology), output, 100, 0, 0);
> }
>
> Modified: trunk/utils/lstopo-fig.c
> ==============================================================================
> --- trunk/utils/lstopo-fig.c (original)
> +++ trunk/utils/lstopo-fig.c 2010-11-24 04:02:18 EST (Wed, 24 Nov 2010)
> @@ -116,7 +116,7 @@
> };
>
> void
> -output_fig (hwloc_topology_t topology, const char *filename, int logical, int verbose_mode __hwloc_attribute_unused)
> +output_fig (hwloc_topology_t topology, const char *filename, int logical, int legend, int verbose_mode __hwloc_attribute_unused)
> {
> FILE *output = open_file(filename, "w");
> if (!output) {
> @@ -124,7 +124,7 @@
> return;
> }
>
> - output = output_draw_start(&fig_draw_methods, logical, topology, output);
> - output_draw(&fig_draw_methods, logical, topology, output);
> + output = output_draw_start(&fig_draw_methods, logical, legend, topology, output);
> + output_draw(&fig_draw_methods, logical, legend, topology, output);
> fclose(output);
> }
>
> Modified: trunk/utils/lstopo-text.c
> ==============================================================================
> --- trunk/utils/lstopo-text.c (original)
> +++ trunk/utils/lstopo-text.c 2010-11-24 04:02:18 EST (Wed, 24 Nov 2010)
> @@ -120,7 +120,7 @@
> output_only (topology, l->children[x], output, logical, verbose_mode);
> }
>
> -void output_console(hwloc_topology_t topology, const char *filename, int logical, int verbose_mode)
> +void output_console(hwloc_topology_t topology, const char *filename, int logical, int legend __hwloc_attribute_unused, int verbose_mode)
> {
> unsigned topodepth;
> FILE *output;
> @@ -606,7 +606,7 @@
> .text = text_text,
> };
>
> -void output_text(hwloc_topology_t topology, const char *filename, int logical, int verbose_mode __hwloc_attribute_unused)
> +void output_text(hwloc_topology_t topology, const char *filename, int logical, int legend, int verbose_mode __hwloc_attribute_unused)
> {
> FILE *output;
> struct display *disp;
> @@ -665,8 +665,8 @@
> }
> #endif /* HWLOC_HAVE_LIBTERMCAP */
>
> - disp = output_draw_start(&text_draw_methods, logical, topology, output);
> - output_draw(&text_draw_methods, logical, topology, disp);
> + disp = output_draw_start(&text_draw_methods, logical, legend, topology, output);
> + output_draw(&text_draw_methods, logical, legend, topology, disp);
>
> lfr = lfg = lfb = -1;
> lbr = lbg = lbb = -1;
>
> Modified: trunk/utils/lstopo-windows.c
> ==============================================================================
> --- trunk/utils/lstopo-windows.c (original)
> +++ trunk/utils/lstopo-windows.c 2010-11-24 04:02:18 EST (Wed, 24 Nov 2010)
> @@ -262,12 +262,12 @@
> };
>
> void
> -output_windows (hwloc_topology_t topology, const char *filename __hwloc_attribute_unused, int logical, int verbose_mode __hwloc_attribute_unused)
> +output_windows (hwloc_topology_t topology, const char *filename __hwloc_attribute_unused, int logical, int legend, int verbose_mode __hwloc_attribute_unused)
> {
> HWND toplevel;
> the_topology = topology;
> the_logical = logical;
> - toplevel = output_draw_start(&windows_draw_methods, logical, topology, NULL);
> + toplevel = output_draw_start(&windows_draw_methods, logical, legend, topology, NULL);
> UpdateWindow(toplevel);
> MSG msg;
> while (!finish && GetMessage(&msg, NULL, 0, 0)) {
>
> Modified: trunk/utils/lstopo-xml.c
> ==============================================================================
> --- trunk/utils/lstopo-xml.c (original)
> +++ trunk/utils/lstopo-xml.c 2010-11-24 04:02:18 EST (Wed, 24 Nov 2010)
> @@ -15,7 +15,7 @@
>
> #include "lstopo.h"
>
> -void output_xml(hwloc_topology_t topology, const char *filename, int logical __hwloc_attribute_unused, int verbose_mode __hwloc_attribute_unused)
> +void output_xml(hwloc_topology_t topology, const char *filename, int logical __hwloc_attribute_unused, int legend __hwloc_attribute_unused, int verbose_mode __hwloc_attribute_unused)
> {
> if (!filename || !strcasecmp(filename, "-.xml"))
> filename = "-";
>
> Modified: trunk/utils/lstopo.1in
> ==============================================================================
> --- trunk/utils/lstopo.1in (original)
> +++ trunk/utils/lstopo.1in 2010-11-24 04:02:18 EST (Wed, 24 Nov 2010)
> @@ -117,6 +117,9 @@
> \fB\-\-vert\fR
> Vertical graphic layout instead of nearly 4/3 ratio.
> .TP
> +\fB\-\-no\-legend\fR
> +Remove the text legend at the bottom.
> +.TP
> \fB\-\-version\fR
> Report version and exit.
> .
>
> Modified: trunk/utils/lstopo.c
> ==============================================================================
> --- trunk/utils/lstopo.c (original)
> +++ trunk/utils/lstopo.c 2010-11-24 04:02:18 EST (Wed, 24 Nov 2010)
> @@ -34,6 +34,7 @@
> unsigned int gridsize = 10;
> unsigned int force_horiz = 0;
> unsigned int force_vert = 0;
> +unsigned int legend = 1;
> unsigned int top = 0;
> hwloc_pid_t pid = (hwloc_pid_t) -1;
>
> @@ -221,6 +222,7 @@
> fprintf (where, " --gridsize 10 Set size of margin between elements\n");
> fprintf (where, " --horiz Horizontal graphic layout instead of nearly 4/3 ratio\n");
> fprintf (where, " --vert Vertical graphic layout instead of nearly 4/3 ratio\n");
> + fprintf (where, " --no-legend Remove the text legend at the bottom\n");
> fprintf (where, "Miscellaneous options:\n");
> fprintf (where, " --ps --top Display processes within the hierarchy\n");
> fprintf (where, " --version Report version and exit\n");
> @@ -359,6 +361,9 @@
> gridsize = atoi(argv[2]);
> opt = 1;
> }
> + else if (!strcmp (argv[1], "--no-legend")) {
> + legend = 0;
> + }
>
> else if (hwloc_utils_lookup_input_option(argv+1, argc-1, &opt,
> &input, &input_format,
> @@ -465,7 +470,7 @@
> if (getenv("DISPLAY")) {
> if (logical == -1)
> logical = 0;
> - output_x11(topology, NULL, logical, verbose_mode);
> + output_x11(topology, NULL, logical, legend, verbose_mode);
> } else
> #endif /* CAIRO_HAS_XLIB_SURFACE */
> #endif /* HWLOC_HAVE_CAIRO */
> @@ -473,51 +478,51 @@
> {
> if (logical == -1)
> logical = 0;
> - output_windows(topology, NULL, logical, verbose_mode);
> + output_windows(topology, NULL, logical, legend, verbose_mode);
> }
> #else
> {
> if (logical == -1)
> logical = 1;
> - output_console(topology, NULL, logical, verbose_mode);
> + output_console(topology, NULL, logical, legend, verbose_mode);
> }
> #endif
> break;
>
> case LSTOPO_OUTPUT_CONSOLE:
> - output_console(topology, filename, logical, verbose_mode);
> + output_console(topology, filename, logical, legend, verbose_mode);
> break;
> case LSTOPO_OUTPUT_TEXT:
> - output_text(topology, filename, logical, verbose_mode);
> + output_text(topology, filename, logical, legend, verbose_mode);
> break;
> case LSTOPO_OUTPUT_FIG:
> - output_fig(topology, filename, logical, verbose_mode);
> + output_fig(topology, filename, logical, legend, verbose_mode);
> break;
> #ifdef HWLOC_HAVE_CAIRO
> # if CAIRO_HAS_PNG_FUNCTIONS
> case LSTOPO_OUTPUT_PNG:
> - output_png(topology, filename, logical, verbose_mode);
> + output_png(topology, filename, logical, legend, verbose_mode);
> break;
> # endif /* CAIRO_HAS_PNG_FUNCTIONS */
> # if CAIRO_HAS_PDF_SURFACE
> case LSTOPO_OUTPUT_PDF:
> - output_pdf(topology, filename, logical, verbose_mode);
> + output_pdf(topology, filename, logical, legend, verbose_mode);
> break;
> # endif /* CAIRO_HAS_PDF_SURFACE */
> # if CAIRO_HAS_PS_SURFACE
> case LSTOPO_OUTPUT_PS:
> - output_ps(topology, filename, logical, verbose_mode);
> + output_ps(topology, filename, logical, legend, verbose_mode);
> break;
> #endif /* CAIRO_HAS_PS_SURFACE */
> #if CAIRO_HAS_SVG_SURFACE
> case LSTOPO_OUTPUT_SVG:
> - output_svg(topology, filename, logical, verbose_mode);
> + output_svg(topology, filename, logical, legend, verbose_mode);
> break;
> #endif /* CAIRO_HAS_SVG_SURFACE */
> #endif /* HWLOC_HAVE_CAIRO */
> #ifdef HWLOC_HAVE_XML
> case LSTOPO_OUTPUT_XML:
> - output_xml(topology, filename, logical, verbose_mode);
> + output_xml(topology, filename, logical, legend, verbose_mode);
> break;
> #endif
> default:
>
> Modified: trunk/utils/lstopo.h
> ==============================================================================
> --- trunk/utils/lstopo.h (original)
> +++ trunk/utils/lstopo.h 2010-11-24 04:02:18 EST (Wed, 24 Nov 2010)
> @@ -16,7 +16,7 @@
> extern int taskset;
> extern hwloc_pid_t pid;
>
> -typedef void output_method (struct hwloc_topology *topology, const char *output, int logical, int verbose_mode);
> +typedef void output_method (struct hwloc_topology *topology, const char *output, int logical, int legend, int verbose_mode);
>
> FILE *open_file(const char *filename, const char *mode) __hwloc_attribute_malloc;
>
> @@ -32,8 +32,8 @@
>
> extern unsigned int gridsize, fontsize, force_horiz, force_vert;
>
> -extern void *output_draw_start(struct draw_methods *draw_methods, int logical, struct hwloc_topology *topology, void *output);
> -extern void output_draw(struct draw_methods *draw_methods, int logical, struct hwloc_topology *topology, void *output);
> +extern void *output_draw_start(struct draw_methods *draw_methods, int logical, int legend, struct hwloc_topology *topology, void *output);
> +extern void output_draw(struct draw_methods *draw_methods, int logical, int legend, struct hwloc_topology *topology, void *output);
>
> int rgb_to_color(int r, int g, int b) __hwloc_attribute_const;
> int declare_color(int r, int g, int b);
> _______________________________________________
> hwloc-svn mailing list
> hwloc-svn_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-svn
>