Hardware Locality (hwloc) 2.9.2

Macros | Functions
Components and Plugins: Core functions to be used by components

## Macros
#define | HWLOC_SHOW_CRITICAL_ERRORS() (hwloc_hide_errors() < 2)
#define | HWLOC_SHOW_ALL_ERRORS() (hwloc_hide_errors() == 0)

## Functions
int | hwloc_hide_errors (void)
hwloc_obj_t | hwloc__insert_object_by_cpuset (struct hwloc_topology *topology, hwloc_obj_t root, hwloc_obj_t obj, const char *reason)
void | hwloc_insert_object_by_parent (struct hwloc_topology *topology, hwloc_obj_t parent, hwloc_obj_t obj)
hwloc_obj_t | hwloc_alloc_setup_object (hwloc_topology_t topology, hwloc_obj_type_t type, unsigned os_index)
int | hwloc_obj_add_children_sets (hwloc_obj_t obj)
int | hwloc_topology_reconnect (hwloc_topology_t topology, unsigned long flags)
static int | hwloc_plugin_check_namespace (const char *pluginname, const char *symbol)

## Detailed Description

Note
  These structures and functions may change when HWLOC_COMPONENT_ABI is modified.

## Macro Definition Documentation

## ◆ HWLOC_SHOW_ALL_ERRORS

#define HWLOC_SHOW_ALL_ERRORS | ( |  | ) | (hwloc_hide_errors() == 0)

## ◆ HWLOC_SHOW_CRITICAL_ERRORS

#define HWLOC_SHOW_CRITICAL_ERRORS | ( |  | ) | (hwloc_hide_errors() < 2)

## Function Documentation

## ◆ hwloc__insert_object_by_cpuset()

hwloc_obj_t hwloc__insert_object_by_cpuset | ( | struct hwloc_topology * | topology,
|  | hwloc_obj_t | root,
|  | hwloc_obj_t | obj,
|  | const char * | reason
| ) |  |

Add an object to the topology.

Insert new object `obj` in the topology starting under existing object `root` (if `NULL`, the topology root object is used).

It is sorted along the tree of other objects according to the inclusion of cpusets, to eventually be added as a child of the smallest object including this object.

If the cpuset is empty, the type of the object (and maybe some attributes) must be enough to find where to insert the object. This is especially true for NUMA nodes with memory and no CPUs.

The given object should not have children.

This shall only be called before levels are built.

The caller should check whether the object type is filtered-out before calling this function.

The topology cpuset/nodesets will be enlarged to include the object sets.

`reason` is a unique string identifying where and why this insertion call was performed (it will be displayed in case of internal insertion error).

Returns the object on success. Returns NULL and frees obj on error. Returns another object and frees obj if it was merged with an identical pre-existing object.

## ◆ hwloc_alloc_setup_object()

hwloc_obj_t hwloc_alloc_setup_object | ( | hwloc_topology_t | topology,
|  | hwloc_obj_type_t | type,
|  | unsigned | os_index
| ) |  |

Allocate and initialize an object of the given type and physical index.

If `os_index` is unknown or irrelevant, use `HWLOC_UNKNOWN_INDEX`.

## ◆ hwloc_hide_errors()

int hwloc_hide_errors | ( | void |  | ) |

Check whether error messages are hidden.

Callers should print critical error messages (e.g. invalid hw topo info, invalid config) only if this function returns strictly less than 2.

Callers should print non-critical error messages (e.g. failure to initialize CUDA) if this function returns 0.

This function return 1 by default (show critical only), 0 in lstopo (show all), or anything set in HWLOC_HIDE_ERRORS in the environment.

Use macros HWLOC_SHOW_CRITICAL_ERRORS() and HWLOC_SHOW_ALL_ERRORS() for clarity.

## ◆ hwloc_insert_object_by_parent()

void hwloc_insert_object_by_parent | ( | struct hwloc_topology * | topology,
|  | hwloc_obj_t | parent,
|  | hwloc_obj_t | obj
| ) |  |

Insert an object somewhere in the topology.

It is added as the last child of the given parent. The cpuset is completely ignored, so strange objects such as I/O devices should preferably be inserted with this.

When used for "normal" children with cpusets (when importing from XML when duplicating a topology), the caller should make sure that:

- children are inserted in order,
- children cpusets do not intersect.

The given object may have normal, I/O or Misc children, as long as they are in order as well. These children must have valid parent and next_sibling pointers.

The caller should check whether the object type is filtered-out before calling this function.

## ◆ hwloc_obj_add_children_sets()

int hwloc_obj_add_children_sets | ( | hwloc_obj_t | obj | ) |

Setup object cpusets/nodesets by OR'ing its children.

Used when adding an object late in the topology. Will update the new object by OR'ing all its new children sets.

Used when PCI backend adds a hostbridge parent, when distances add a new Group, etc.

## ◆ hwloc_plugin_check_namespace()

static int hwloc_plugin_check_namespace | ( | const char * | pluginname,
|  | const char * | symbol
| ) |  |
| inline static

Make sure that plugins can lookup core symbols.

This is a sanity check to avoid lazy-lookup failures when libhwloc is loaded within a plugin, and later tries to load its own plugins. This may fail (and abort the program) if libhwloc symbols are in a private namespace.

Returns
  0 on success.
  -1 if the plugin cannot be successfully loaded. The caller plugin init() callback should return a negative error code as well.

Plugins should call this function in their init() callback to avoid later crashes if lazy symbol resolution is used by the upper layer that loaded hwloc (e.g. OpenCL implementations using dlopen with RTLD_LAZY).

Note
  The build system must define HWLOC_INSIDE_PLUGIN if and only if building the caller as a plugin.
  This function should remain inline so plugins can call it even when they cannot find libhwloc symbols.

## ◆ hwloc_topology_reconnect()

int hwloc_topology_reconnect | ( | hwloc_topology_t | topology,
|  | unsigned long | flags
| ) |  |

Request a reconnection of children and levels in the topology.

May be used by backends during discovery if they need arrays or lists of object within levels or children to be fully connected.

`flags` is currently unused, must 0.