Hardware Locality (hwloc) 1.10.0

- Main Page
- Related Pages
- Modules
- Data Structures

Enumerations | Functions
Object levels, depths and types

## Enumerations
enum | hwloc_get_type_depth_e { HWLOC_TYPE_DEPTH_UNKNOWN, HWLOC_TYPE_DEPTH_MULTIPLE, HWLOC_TYPE_DEPTH_BRIDGE, HWLOC_TYPE_DEPTH_PCI_DEVICE, HWLOC_TYPE_DEPTH_OS_DEVICE }

## Functions
unsigned | hwloc_topology_get_depth (hwloc_topology_t restrict topology)
int | hwloc_get_type_depth (hwloc_topology_t topology, hwloc_obj_type_t type)
static int | hwloc_get_type_or_below_depth (hwloc_topology_t topology, hwloc_obj_type_t type)
static int | hwloc_get_type_or_above_depth (hwloc_topology_t topology, hwloc_obj_type_t type)
hwloc_obj_type_t | hwloc_get_depth_type (hwloc_topology_t topology, unsigned depth)
unsigned | hwloc_get_nbobjs_by_depth (hwloc_topology_t topology, unsigned depth)
static int | hwloc_get_nbobjs_by_type (hwloc_topology_t topology, hwloc_obj_type_t type)
static hwloc_obj_t | hwloc_get_root_obj (hwloc_topology_t topology)
hwloc_obj_t | hwloc_get_obj_by_depth (hwloc_topology_t topology, unsigned depth, unsigned idx)
static hwloc_obj_t | hwloc_get_obj_by_type (hwloc_topology_t topology, hwloc_obj_type_t type, unsigned idx)
static hwloc_obj_t | hwloc_get_next_obj_by_depth (hwloc_topology_t topology, unsigned depth, hwloc_obj_t prev)
static hwloc_obj_t | hwloc_get_next_obj_by_type (hwloc_topology_t topology, hwloc_obj_type_t type, 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 socket has fewer caches than its peers.

## Enumeration Type Documentation

enum hwloc_get_type_depth_e

Enumerator
HWLOC_TYPE_DEPTH_UNKNOWN | No object of given type exists in the topology.
HWLOC_TYPE_DEPTH_MULTIPLE | Objects of given type exist at different depth in the topology.
HWLOC_TYPE_DEPTH_BRIDGE | Virtual depth for bridge object level.
HWLOC_TYPE_DEPTH_PCI_DEVICE | Virtual depth for PCI device object level.
HWLOC_TYPE_DEPTH_OS_DEVICE | Virtual depth for software device object level.

## Function Documentation

hwloc_obj_type_t hwloc_get_depth_type | ( | hwloc_topology_t | topology,
|  | unsigned | depth
| ) |  |

Returns the type of objects at depth `depth`.

Returns
  -1 if depth `depth` does not exist.

unsigned hwloc_get_nbobjs_by_depth | ( | hwloc_topology_t | topology,
|  | unsigned | depth
| ) |  |

Returns the width of level at depth `depth`.

static int hwloc_get_nbobjs_by_type | ( | hwloc_topology_t | topology,
|  | hwloc_obj_type_t | type
| ) |  |
| inline static

Returns the width of level type `type`.

If no object for that type exists, 0 is returned. If there are several levels with objects of that type, -1 is returned.

static hwloc_obj_t hwloc_get_next_obj_by_depth | ( | hwloc_topology_t | topology,
|  | unsigned | depth,
|  | hwloc_obj_t | prev
| ) |  |
| inline static

Returns the next object at depth `depth`.

If `prev` is `NULL`, return the first object at depth `depth`.

static hwloc_obj_t hwloc_get_next_obj_by_type | ( | hwloc_topology_t | topology,
|  | hwloc_obj_type_t | type,
|  | hwloc_obj_t | prev
| ) |  |
| inline static

Returns the next object of type `type`.

If `prev` is `NULL`, return the first object at type `type`. If there are multiple or no depth for given type, return `NULL` and let the caller fallback to hwloc_get_next_obj_by_depth().

hwloc_obj_t hwloc_get_obj_by_depth | ( | hwloc_topology_t | topology,
|  | unsigned | depth,
|  | unsigned | idx
| ) |  |

Returns the topology object at logical index `idx` from depth `depth`.

static hwloc_obj_t hwloc_get_obj_by_type | ( | hwloc_topology_t | topology,
|  | hwloc_obj_type_t | type,
|  | unsigned | idx
| ) |  |
| inline static

Returns the topology object at logical index `idx` with type `type`.

If no object for that type exists, `NULL` is returned. If there are several levels with objects of that type, `NULL` is returned and ther caller may fallback to hwloc_get_obj_by_depth().

static hwloc_obj_t hwloc_get_root_obj | ( | hwloc_topology_t | topology | ) |
| inline static

Returns the top-object of the topology-tree.

Its type is typically HWLOC_OBJ_MACHINE but it could be different for complex topologies.

int hwloc_get_type_depth | ( | hwloc_topology_t | topology,
|  | hwloc_obj_type_t | type
| ) |  |

Returns the depth of objects of type `type`.

If no object of this type is present on the underlying architecture, or if the OS doesn't provide this kind of information, the function returns HWLOC_TYPE_DEPTH_UNKNOWN.

If type is absent but a similar type is acceptable, see also hwloc_get_type_or_below_depth() and hwloc_get_type_or_above_depth().

If some objects of the given type exist in different levels, for instance L1 and L2 caches, or L1i and L1d caches, the function returns HWLOC_TYPE_DEPTH_MULTIPLE. See hwloc_get_cache_type_depth() in hwloc/helper.h to better handle this case.

If an I/O object type is given, the function returns a virtual value because I/O objects are stored in special levels that are not CPU-related. This virtual depth may be passed to other hwloc functions such as hwloc_get_obj_by_depth() but it should not be considered as an actual depth by the application. In particular, it should not be compared with any other object depth or with the entire topology depth.

static int hwloc_get_type_or_above_depth | ( | hwloc_topology_t | topology,
|  | hwloc_obj_type_t | type
| ) |  |
| inline static

Returns the depth of objects of type `type` or above.

If no object of this type is present on the underlying architecture, the function returns the depth of the first "present" object typically containing `type`.

If some objects of the given type exist in different levels, for instance L1 and L2 caches, the function returns HWLOC_TYPE_DEPTH_MULTIPLE.

static int hwloc_get_type_or_below_depth | ( | hwloc_topology_t | topology,
|  | hwloc_obj_type_t | type
| ) |  |
| inline static

Returns the depth of objects of type `type` or below.

If no object of this type is present on the underlying architecture, the function returns the depth of the first "present" object typically found inside `type`.

If some objects of the given type exist in different levels, for instance L1 and L2 caches, the function returns HWLOC_TYPE_DEPTH_MULTIPLE.

unsigned hwloc_topology_get_depth | ( | hwloc_topology_t restrict | topology | ) |

Get the depth of the hierarchical tree of objects.

This is the depth of HWLOC_OBJ_PU objects plus one.