Open MPI logo

Hardware Locality Development Mailing List Archives

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

Subject: Re: [hwloc-devel] Build system issues
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2009-09-08 17:58:42


On Sep 8, 2009, at 5:41 PM, Samuel Thibault wrote:

> Well, we could as well just implement --version :)
>

Good enough. How's this? (see patch)

(we haven't worked out the logistics of development yet -- e.g., just
committing, or sending patches, etc. -- such things to be determined
shortly...)

Index: utils/topodistrib.c
===================================================================
--- utils/topodistrib.c (revision 893)
+++ utils/topodistrib.c (working copy)
@@ -1,5 +1,6 @@
  /*
   * Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
+ * Copyright © 2009 Cisco Systems, Inc. All rights reserved.
   * See COPYING in top-level directory.
   */

@@ -18,6 +19,7 @@
  #ifdef HAVE_XML
    fprintf(where, " --xml <path>\t\tread topology from XML file
<path>\n");
  #endif
+ fprintf(where, " --version\t\treport version and exit\n");
  }

  int main(int argc, char *argv[])
@@ -26,6 +28,7 @@
    char * synthetic = NULL;
    char * xmlpath = NULL;
    int verbose = 0;
+ char **orig_argv = argv;

    /* skip argv[0], handle options */
    argv++;
@@ -57,6 +60,10 @@
          argc--;
          goto next;
        }
+ else if (!strcmp (argv[0], "--version")) {
+ printf("%s %s\n", orig_argv[0], VERSION);
+ exit(EXIT_SUCCESS);
+ }
  #ifdef HAVE_XML
        if (!strcmp (argv[0], "--xml")) {
          if (argc <= 2) {
Index: utils/topobind.c
===================================================================
--- utils/topobind.c (revision 893)
+++ utils/topobind.c (working copy)
@@ -1,5 +1,6 @@
  /*
   * Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
+ * Copyright © 2009 Cisco Systems, Inc. All rights reserved.
   * See COPYING in top-level directory.
   */

@@ -20,6 +21,7 @@
    fprintf(where, " --single\tbind on a single CPU to prevent
migration\n");
    fprintf(where, " --strict\trequire strict binding\n");
    fprintf(where, " -v\t\tverbose messages\n");
+ fprintf(where, " --version\treport version and exit\n");
  }

  int main(int argc, char *argv[])
@@ -32,6 +34,7 @@
    int verbose = 0;
    int flags = 0;
    int ret;
+ char **orig_argv = argv;

    topo_cpuset_zero(&cpu_set);

@@ -67,6 +70,10 @@
          flags |= TOPO_CPUBIND_STRICT;
          goto next;
        }
+ else if (!strcmp (argv[0], "--version")) {
+ printf("%s %s\n", orig_argv[0], VERSION);
+ exit(EXIT_SUCCESS);
+ }

        usage(stderr);
        return EXIT_FAILURE;
Index: utils/lstopo.c
===================================================================
--- utils/lstopo.c (revision 893)
+++ utils/lstopo.c (working copy)
@@ -1,5 +1,6 @@
  /*
   * Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
+ * Copyright © 2009 Cisco Systems, Inc. All rights reserved.
   * See COPYING in top-level directory.
   */

@@ -75,6 +76,7 @@
    fprintf (where, " --fontsize 10 set size of text font\n");
    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, " --version report version and exit
\n");
  }

  int
@@ -155,6 +157,9 @@
          }
          fsysroot = argv[2]; opt = 1;
  #endif
+ } else if (!strcmp (argv[1], "--version")) {
+ printf("%s %s\n", argv[0], VERSION);
+ exit(EXIT_SUCCESS);
        } else {
          if (filename) {
            fprintf (stderr, "Unrecognized options: %s\n", argv[1]);
Index: utils/Makefile.am
===================================================================
--- utils/Makefile.am (revision 893)
+++ utils/Makefile.am (working copy)
@@ -29,7 +29,7 @@
  if TOPO_HAVE_UTILS_MAN
  else
    ifneq ($(HELP2MAN),)
-TOPO_HELP2MAN=$(HELP2MAN) -m "Topology commands" -S "INRIA" -N --
version-string @VERSION@
+TOPO_HELP2MAN=$(HELP2MAN) -m "Topology commands" -S "INRIA" -N

  lstopo.1: lstopo
          $(TOPO_HELP2MAN) -n "Show the topology of the system" ./$^ -o $@
Index: utils/topomask.c
===================================================================
--- utils/topomask.c (revision 893)
+++ utils/topomask.c (working copy)
@@ -1,5 +1,6 @@
  /*
   * Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
+ * Copyright © 2009 Cisco Systems, Inc. All rights reserved.
   * See COPYING in top-level directory.
   */

@@ -33,6 +34,7 @@
    fprintf(where, " -v\tverbose\n");
    fprintf(where, " --proclist\treport the list of processors in the
CPU set\n");
    fprintf(where, " --nodelist\treport the list of memory nodes near
the CPU set\n");
+ fprintf(where, " --version\treport version and exit\n");
  }

  int main(int argc, char *argv[])
@@ -43,6 +45,7 @@
    int verbose = 0;
    int nodelist = 0;
    int proclist = 0;
+ char **orig_argv = argv;

    topo_cpuset_zero(&set);

@@ -68,6 +71,10 @@
          nodelist = 1;
          goto next;
        }
+ if (!strcmp(argv[1], "--version")) {
+ printf("%s %s\n", orig_argv[0], VERSION);
+ exit(EXIT_SUCCESS);
+ }
        usage(stderr);
        return EXIT_FAILURE;
      }

-- 
Jeff Squyres
jsquyres_at_[hidden]