It looks like I spoke too soon on the fix. That solves the problem but it keeps the Miscs from being created and in some situations I'd like to keep the Miscs but not the nodes. The attached patch does that for me.
Samuel Thibault wrote: > Michael Raymond, le Thu 19 Nov 2009 14:33:49 -0600, a écrit : >> --- hwloc-0.9.2/src/topology-linux.c 2009-11-03 16:40:31.000000000 -0600 >> +++ hwloc-new//src/topology-linux.c 2009-11-19 14:20:43.630035434 -0600 >> @@ -536,6 +536,10 @@ >> struct dirent *dirent; >> hwloc_obj_t node; >> >> + if (topology->ignored_types[HWLOC_OBJ_NODE] == >> HWLOC_IGNORE_TYPE_ALWAYS) { >> + return; >> + } >> + >> dir = hwloc_opendir(path, topology->backend_params.sysfs.root_fd); >> if (dir) >> { > > Mmm, indeed. And it will happen on other OSes where we get the > distances too, e.g. Solaris. Does the attached more generic patch > properly fixes it too? > >> Also I'm concerned about the value of CPUSET_MASK_LEN in >> hwloc_admin_disable_set_from_cpuset(). It's only 64 characters but our >> Linux boxes can have to 2048 processors. I don't think there's any harm >> in bumping that up a little. > > Mmm, even better, we can avoid using a constant size completely, I've > commited a fix. > > Samuel > > > ------------------------------------------------------------------------ > > _______________________________________________ > hwloc-devel mailing list > hwloc-de...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel -- Michael A. Raymond Message Passing Toolkit Team Silicon Graphics Inc (651) 683-3434
--- hwloc-0.9.2/include/private/private.h 2009-11-03 16:40:30.000000000 -0600 +++ hwloc-new//include/private/private.h 2009-11-19 15:28:37.439941339 -0600 @@ -201,4 +201,6 @@ * required size. hwloc_snprintf always report the actually required size. */ int hwloc_snprintf(char *str, size_t size, const char *format, ...); +void hwloc_free_object(hwloc_obj_t obj); + #endif /* HWLOC_PRIVATE_H */ --- hwloc-0.9.2/src/topology.c 2009-11-03 16:40:31.000000000 -0600 +++ hwloc-new//src/topology.c 2009-11-20 08:10:01.537850444 -0600 @@ -383,8 +383,8 @@ } /* Free an object and all its content. */ -static void -free_object(hwloc_obj_t obj) +void +hwloc_free_object(hwloc_obj_t obj) { switch (obj->type) { case HWLOC_OBJ_SYSTEM: @@ -676,7 +676,7 @@ hwloc_add_object(struct hwloc_topology *topology, hwloc_obj_t obj) { if (topology->ignored_types[obj->type] == HWLOC_IGNORE_TYPE_ALWAYS) { - free_object(obj); + hwloc_free_object(obj); return; } @@ -740,7 +740,7 @@ static void do_free_object(hwloc_topology_t topology, hwloc_obj_t *obj, void *data) { - free_object(*obj); + hwloc_free_object(*obj); } /* Remove all children whose cpuset is empty, except NUMA nodes @@ -772,11 +772,11 @@ /* Father can be ignored in favor of the child. */ *pfather = child; child->next_sibling = father->next_sibling; - free_object(father); + hwloc_free_object(father); } else if (topology->ignored_types[child->type] == HWLOC_IGNORE_TYPE_KEEP_STRUCTURE) { /* Child can be ignored in favor of the father. */ father->first_child = child->first_child; - free_object(child); + hwloc_free_object(child); } } @@ -1296,7 +1296,7 @@ unsigned l,i; for (l=0; l<topology->nb_levels; l++) { for (i=0; i<topology->level_nbobjects[l]; i++) - free_object(topology->levels[l][i]); + hwloc_free_object(topology->levels[l][i]); free(topology->levels[l]); } } --- hwloc-0.9.2/src/topology-linux.c 2009-11-03 16:40:31.000000000 -0600 +++ hwloc-new//src/topology-linux.c 2009-11-20 08:13:02.418548959 -0600 @@ -582,11 +582,14 @@ node->cpuset = cpuset; node->attr->node.memory_kB = size; node->attr->node.huge_page_free = hpfree; - node->cpuset = cpuset; hwloc_debug_1arg_cpuset("os node %u has cpuset %s\n", osnode, node->cpuset); - hwloc_add_object(topology, node); + + /* Might free the object and we need it in the misc calculations */ + if (topology->ignored_types[HWLOC_OBJ_NODE] != + HWLOC_IGNORE_TYPE_ALWAYS) + hwloc_add_object(topology, node); nodes[osnode] = node; sprintf(nodepath, "%s/node%u/distance", path, osnode); @@ -594,6 +597,13 @@ } hwloc_setup_misc_level_from_distances(topology, nbnodes, nodes, (unsigned*) distances); + /* No longer need the node objects */ + if (topology->ignored_types[HWLOC_OBJ_NODE] == HWLOC_IGNORE_TYPE_ALWAYS) { + int i; + for (i = 0; i < nbnodes; i++) { + hwloc_free_object(nodes[i]); + } + } } }