]> xenbits.xensource.com Git - people/andrewcoop/hwloc.git/commitdiff
core: switch more printf(stderr) to unique messages that can be silenced with HWLOC_H...
authorBrice Goglin <Brice.Goglin@inria.fr>
Thu, 16 Jan 2014 13:39:21 +0000 (14:39 +0100)
committerBrice Goglin <Brice.Goglin@inria.fr>
Thu, 16 Jan 2014 14:06:23 +0000 (15:06 +0100)
Useful when debugging failures to merge because of different OS indexes or levels.

src/topology.c

index 8afe5a4aa1ef79eea83deb0fee9f7bbbe519751a..31e8231b75b29084281a2533554204ec7fef03c2 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright © 2009 CNRS
- * Copyright © 2009-2013 Inria.  All rights reserved.
+ * Copyright © 2009-2014 Inria.  All rights reserved.
  * Copyright © 2009-2012 Université Bordeaux 1
  * Copyright © 2009-2011 Cisco Systems, Inc.  All rights reserved.
  * See COPYING in top-level directory.
@@ -768,12 +768,22 @@ hwloc___insert_object_by_cpuset(struct hwloc_topology *topology, hwloc_obj_t cur
       case HWLOC_OBJ_EQUAL:
         merge_index(obj, child, os_level, signed);
        if (obj->os_level != child->os_level) {
-          fprintf(stderr, "Different OS level\n");
+         static int reported = 0;
+         if (!reported && !hwloc_hide_errors()) {
+           fprintf(stderr, "Cannot merge similar %s objects with different OS levels %u and %u\n",
+                   hwloc_obj_type_string(obj->type), child->os_level, obj->os_level);
+           reported = 1;
+         }
           return NULL;
         }
         merge_index(obj, child, os_index, unsigned);
        if (obj->os_index != child->os_index) {
-          fprintf(stderr, "Different OS indexes\n");
+         static int reported = 0;
+         if (!reported && !hwloc_hide_errors()) {
+           fprintf(stderr, "Cannot merge similar %s objects with different OS indexes %u and %u\n",
+                   hwloc_obj_type_string(obj->type), child->os_index, obj->os_index);
+           reported = 1;
+         }
           return NULL;
         }
        if (obj->distances_count) {