Hardware Locality (hwloc) 2.2.0

Functions
Looking at Ancestor and Child Objects

## Functions
static hwloc_obj_t | hwloc_get_ancestor_obj_by_depth (hwloc_topology_t topology, int depth, hwloc_obj_t obj)
static hwloc_obj_t | hwloc_get_ancestor_obj_by_type (hwloc_topology_t topology, hwloc_obj_type_t type, hwloc_obj_t obj)
static hwloc_obj_t | hwloc_get_common_ancestor_obj (hwloc_topology_t topology, hwloc_obj_t obj1, hwloc_obj_t obj2)
static int | hwloc_obj_is_in_subtree (hwloc_topology_t topology, hwloc_obj_t obj, hwloc_obj_t subtree_root)
static hwloc_obj_t | hwloc_get_next_child (hwloc_topology_t topology, hwloc_obj_t parent, hwloc_obj_t prev)

## Detailed Description

Be sure to see the figure in Terms and Definitions that shows a complete topology tree, including depths, child/sibling/cousin relationships, and an example of an asymmetric topology where one package has fewer caches than its peers.

## Function Documentation

## ◆ hwloc_get_ancestor_obj_by_depth()

static hwloc_obj_t hwloc_get_ancestor_obj_by_depth | ( | hwloc_topology_t | topology,
|  | int | depth,
|  | hwloc_obj_t | obj
| ) |  |
| inline static

Returns the ancestor object of `obj` at depth `depth`.

Note
  `depth` should not be the depth of PU or NUMA objects since they are ancestors of no objects (except Misc or I/O). This function rather expects an intermediate level depth, such as the depth of Packages, Cores, or Caches.

## ◆ hwloc_get_ancestor_obj_by_type()

static hwloc_obj_t hwloc_get_ancestor_obj_by_type | ( | hwloc_topology_t | topology,
|  | hwloc_obj_type_t | type,
|  | hwloc_obj_t | obj
| ) |  |
| inline static

Returns the ancestor object of `obj` with type `type`.

Note
  `type` should not be HWLOC_OBJ_PU or HWLOC_OBJ_NUMANODE since these objects are ancestors of no objects (except Misc or I/O). This function rather expects an intermediate object type, such as HWLOC_OBJ_PACKAGE, HWLOC_OBJ_CORE, etc.

## ◆ hwloc_get_common_ancestor_obj()

static hwloc_obj_t hwloc_get_common_ancestor_obj | ( | hwloc_topology_t | topology,
|  | hwloc_obj_t | obj1,
|  | hwloc_obj_t | obj2
| ) |  |
| inline static

Returns the common parent object to objects `obj1` and `obj2`.

## ◆ hwloc_get_next_child()

static hwloc_obj_t hwloc_get_next_child | ( | hwloc_topology_t | topology,
|  | hwloc_obj_t | parent,
|  | hwloc_obj_t | prev
| ) |  |
| inline static

Return the next child.

Return the next child among the normal children list, then among the memory children list, then among the I/O children list, then among the Misc children list.

If `prev` is `NULL`, return the first child.

Return `NULL` when there is no next child.

## ◆ hwloc_obj_is_in_subtree()

static int hwloc_obj_is_in_subtree | ( | hwloc_topology_t | topology,
|  | hwloc_obj_t | obj,
|  | hwloc_obj_t | subtree_root
| ) |  |
| inline static

Returns true if `obj` is inside the subtree beginning with ancestor object `subtree_root`.

Note
  This function cannot work if `obj` and `subtree_root` objects do not have CPU sets (I/O or Misc objects).