hwlocality_configuration(3)

NAME
hwlocality_configuration - Topology Detection Configuration and Query

  Data Structures
struct hwloc_topology_discovery_support
struct hwloc_topology_cpubind_support
struct hwloc_topology_membind_support
struct hwloc_topology_support

  Enumerations
enum hwloc_topology_flags_e { HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM, HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM, HWLOC_TOPOLOGY_FLAG_IO_DEVICES, HWLOC_TOPOLOGY_FLAG_IO_BRIDGES, HWLOC_TOPOLOGY_FLAG_WHOLE_IO, HWLOC_TOPOLOGY_FLAG_ICACHES }

  Functions
int hwloc_topology_ignore_type (hwloc_topology_t topology, hwloc_obj_type_t type)
int hwloc_topology_ignore_type_keep_structure (hwloc_topology_t topology, hwloc_obj_type_t type)
int hwloc_topology_ignore_all_keep_structure (hwloc_topology_t topology)
int hwloc_topology_set_flags (hwloc_topology_t topology, unsigned long flags)
unsigned long hwloc_topology_get_flags (hwloc_topology_t topology)
int hwloc_topology_set_pid (hwloc_topology_t restrict topology, hwloc_pid_t pid)
int hwloc_topology_set_fsroot (hwloc_topology_t restrict topology, const char *restrict fsroot_path)
int hwloc_topology_set_synthetic (hwloc_topology_t restrict topology, const char *restrict description)
int hwloc_topology_set_xml (hwloc_topology_t restrict topology, const char *restrict xmlpath)
int hwloc_topology_set_xmlbuffer (hwloc_topology_t restrict topology, const char *restrict buffer, int size)
int hwloc_topology_set_custom (hwloc_topology_t topology)
int hwloc_topology_set_distance_matrix (hwloc_topology_t restrict topology, hwloc_obj_type_t type, unsigned nbobjs, unsigned *os_index, float *distances)
int hwloc_topology_is_thissystem (hwloc_topology_t restrict topology)
const struct hwloc_topology_support * hwloc_topology_get_support (hwloc_topology_t restrict topology)
void hwloc_topology_set_userdata (hwloc_topology_t topology, const void *userdata)
void * hwloc_topology_get_userdata (hwloc_topology_t topology)

Detailed Description

Several functions can optionally be called between hwloc_topology_init() and hwloc_topology_load() to configure how the detection should be performed, e.g. to ignore some objects types, define a synthetic topology, etc.

If none of them is called, the default is to detect all the objects of the machine that the caller is allowed to access.

This default behavior may also be modified through environment variables if the application did not modify it already. Setting HWLOC_XMLFILE in the environment enforces the discovery from a XML file as if hwloc_topology_set_xml() had been called. HWLOC_FSROOT switches to reading the topology from the specified Linux filesystem root as if hwloc_topology_set_fsroot() had been called. Finally, HWLOC_THISSYSTEM enforces the return value of hwloc_topology_is_thissystem().

Enumeration Type Documentation

  enum hwloc_topology_flags_e

Flags to be set onto a topology context before load. Flags should be given to hwloc_topology_set_flags(). They may also be returned by hwloc_topology_get_flags().

Enumerator

HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM
    Detect the whole system, ignore reservations and offline settings. Gather all resources, even if some were disabled by the administrator. For instance, ignore Linux Cgroup/Cpusets and gather all processors and memory nodes, and ignore the fact that some resources may be offline.

When this flag is not set, PUs that are disallowed are not added to the topology. Parent objects (package, core, cache, etc.) are added only if some of their children are allowed. NUMA nodes are always added but their available memory is set to 0 when disallowed.

HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM
    Assume that the selected backend provides the topology for the system on which we are running. This forces hwloc_topology_is_thissystem() to return 1, i.e. makes hwloc assume that the selected backend provides the topology for the system on which we are running, even if it is not the OS-specific backend but the XML backend for instance. This means making the binding functions actually call the OS-specific system calls and really do binding, while the XML backend would otherwise provide empty hooks just returning success.

Setting the environment variable HWLOC_THISSYSTEM may also result in the same behavior.

This can be used for efficiency reasons to first detect the topology once, save it to an XML file, and quickly reload it later through the XML backend, but still having binding functions actually do bind.

HWLOC_TOPOLOGY_FLAG_IO_DEVICES
    Detect PCI devices. By default, I/O devices are ignored. This flag enables I/O device detection using the pci backend. Only the common PCI devices (GPUs, NICs, block devices, ...) and host bridges (objects that connect the host objects to an I/O subsystem) will be added to the topology. Additionally it also enables MemoryModule misc objects. Uncommon devices and other bridges (such as PCI-to-PCI bridges) will be ignored.

HWLOC_TOPOLOGY_FLAG_IO_BRIDGES
    Detect PCI bridges. This flag should be combined with HWLOC_TOPOLOGY_FLAG_IO_DEVICES to enable the detection of both common devices and of all useful bridges (bridges that have at least one device behind them).

HWLOC_TOPOLOGY_FLAG_WHOLE_IO
    Detect the whole PCI hierarchy. This flag enables detection of all I/O devices (even the uncommon ones such as DMA channels) and bridges (even those that have no device behind them) using the pci backend. This implies HWLOC_TOPOLOGY_FLAG_IO_DEVICES.

HWLOC_TOPOLOGY_FLAG_ICACHES
    Detect instruction caches. This flag enables detection of Instruction caches, instead of only Data and Unified caches.

Function Documentation

  unsigned long hwloc_topology_get_flags (hwloc_topology_t topology)

Get OR'ed flags of a topology. Get the OR'ed set of hwloc_topology_flags_e of a topology.

Returns:
    the flags previously set with hwloc_topology_set_flags().

  const struct hwloc_topology_support* hwloc_topology_get_support (hwloc_topology_t restrict topology)

Retrieve the topology support.

  void* hwloc_topology_get_userdata (hwloc_topology_t topology)

Retrieve the topology-specific userdata pointer. Retrieve the application-given private data pointer that was previously set with hwloc_topology_set_userdata().

  int hwloc_topology_ignore_all_keep_structure (hwloc_topology_t topology)

Ignore all objects that do not bring any structure. Ignore all objects that do not bring any structure: This is equivalent to calling hwloc_topology_ignore_type_keep_structure() for all object types.

  int hwloc_topology_ignore_type (hwloc_topology_t topology, hwloc_obj_type_t type)

Ignore an object type. Ignore all objects from the given type. The bottom-level type HWLOC_OBJ_PU may not be ignored. The top-level object of the hierarchy will never be ignored, even if this function succeeds. Group objects are always ignored if they do not bring any structure since they are designed to add structure to the topology. I/O objects may not be ignored, topology flags should be used to configure their discovery instead.

  int hwloc_topology_ignore_type_keep_structure (hwloc_topology_t topology, hwloc_obj_type_t type)

Ignore an object type if it does not bring any structure. Ignore all objects from the given type as long as they do not bring any structure: Each ignored object should have a single children or be the only child of its parent. The bottom-level type HWLOC_OBJ_PU may not be ignored. I/O objects may not be ignored, topology flags should be used to configure their discovery instead.

  int hwloc_topology_is_thissystem (hwloc_topology_t restrict topology)

Does the topology context come from this system?

Returns:
    1 if this topology context was built using the system running this program.

    0 instead (for instance if using another file-system root, a XML topology file, or a synthetic topology).

  int hwloc_topology_set_custom (hwloc_topology_t topology)

Prepare the topology for custom assembly. The topology then contains a single root object. It must then be built by inserting other topologies with hwloc_custom_insert_topology() or single objects with hwloc_custom_insert_group_object_by_parent(). hwloc_topology_load() must be called to finalize the new topology as usual.

Note:
    If nothing is inserted in the topology, hwloc_topology_load() will fail with errno set to EINVAL.

    The cpuset and nodeset of the root object are NULL because these sets are meaningless when assembling multiple topologies.

    On success, the custom component replaces the previously enabled component (if any), but the topology is not actually modified until hwloc_topology_load().

  int hwloc_topology_set_distance_matrix (hwloc_topology_t restrict topology, hwloc_obj_type_t type, unsigned nbobjs, unsigned * os_index, float * distances)

Provide a distance matrix. Provide the matrix of distances between a set of objects of the given type. The set may or may not contain all the existing objects of this type. The objects are specified by their OS/physical index in the os_index array. The distances matrix follows the same order. The distance from object i to object j in the i*nbobjs+j.

A single latency matrix may be defined for each type. If another distance matrix already exists for the given type, either because the user specified it or because the OS offers it, it will be replaced by the given one. If nbobjs is 0, os_index is NULL and distances is NULL, the existing distance matrix for the given type is removed.

Note:
    Distance matrices are ignored in multi-node topologies.

  int hwloc_topology_set_flags (hwloc_topology_t topology, unsigned long flags)

Set OR'ed flags to non-yet-loaded topology. Set a OR'ed set of hwloc_topology_flags_e onto a topology that was not yet loaded.

If this function is called multiple times, the last invokation will erase and replace the set of flags that was previously set.

The flags set in a topology may be retrieved with hwloc_topology_get_flags()

  int hwloc_topology_set_fsroot (hwloc_topology_t restrict topology, const char *restrict fsroot_path)

Change the file-system root path when building the topology from sysfs/procfs. On Linux system, use sysfs and procfs files as if they were mounted on the given fsroot_path instead of the main file-system root. Setting the environment variable HWLOC_FSROOT may also result in this behavior. Not using the main file-system root causes hwloc_topology_is_thissystem() to return 0.

Note that this function does not actually load topology information; it just tells hwloc where to load it from. You'll still need to invoke hwloc_topology_load() to actually load the topology information.

Returns:
    -1 with errno set to ENOSYS on non-Linux and on Linux systems that do not support it.

    -1 with the appropriate errno if fsroot_path cannot be used.

Note:
    For convenience, this backend provides empty binding hooks which just return success. To have hwloc still actually call OS-specific hooks, the HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM has to be set to assert that the loaded file is really the underlying system.

    On success, the Linux component replaces the previously enabled component (if any), but the topology is not actually modified until hwloc_topology_load().

  int hwloc_topology_set_pid (hwloc_topology_t restrict topology, hwloc_pid_t pid)

Change which process the topology is viewed from. On some systems, processes may have different views of the machine, for instance the set of allowed CPUs. By default, hwloc exposes the view from the current process. Calling hwloc_topology_set_pid() permits to make it expose the topology of the machine from the point of view of another process.

Note:
    hwloc_pid_t is pid_t on Unix platforms, and HANDLE on native Windows platforms.

    -1 is returned and errno is set to ENOSYS on platforms that do not support this feature.

  int hwloc_topology_set_synthetic (hwloc_topology_t restrict topology, const char *restrict description)

Enable synthetic topology. Gather topology information from the given description, a space-separated string of numbers describing the arity of each level. Each number may be prefixed with a type and a colon to enforce the type of a level. If only some level types are enforced, hwloc will try to choose the other types according to usual topologies, but it may fail and you may have to specify more level types manually. See also the Synthetic topologies.

If description was properly parsed and describes a valid topology configuration, this function returns 0. Otherwise -1 is returned and errno is set to EINVAL.

Note that this function does not actually load topology information; it just tells hwloc where to load it from. You'll still need to invoke hwloc_topology_load() to actually load the topology information.

Note:
    For convenience, this backend provides empty binding hooks which just return success.

    On success, the synthetic component replaces the previously enabled component (if any), but the topology is not actually modified until hwloc_topology_load().

  void hwloc_topology_set_userdata (hwloc_topology_t topology, const void * userdata)

Set the topology-specific userdata pointer. Each topology may store one application-given private data pointer. It is initialized to NULL. hwloc will never modify it.

Use it as you wish, after hwloc_topology_init() and until hwloc_topolog_destroy().

This pointer is not exported to XML.

  int hwloc_topology_set_xml (hwloc_topology_t restrict topology, const char *restrict xmlpath)

Enable XML-file based topology. Gather topology information from the XML file given at xmlpath. Setting the environment variable HWLOC_XMLFILE may also result in this behavior. This file may have been generated earlier with hwloc_topology_export_xml() or lstopo file.xml.

Note that this function does not actually load topology information; it just tells hwloc where to load it from. You'll still need to invoke hwloc_topology_load() to actually load the topology information.

Returns:
    -1 with errno set to EINVAL on failure to read the XML file.

Note:
    See also hwloc_topology_set_userdata_import_callback() for importing application-specific object userdata.

    For convenience, this backend provides empty binding hooks which just return success. To have hwloc still actually call OS-specific hooks, the HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM has to be set to assert that the loaded file is really the underlying system.

    On success, the XML component replaces the previously enabled component (if any), but the topology is not actually modified until hwloc_topology_load().

  int hwloc_topology_set_xmlbuffer (hwloc_topology_t restrict topology, const char *restrict buffer, int size)

Enable XML based topology using a memory buffer (instead of a file, as with hwloc_topology_set_xml()). Gather topology information from the XML memory buffer given at buffer and of length size. This buffer may have been filled earlier with hwloc_topology_export_xmlbuffer().

Note that this function does not actually load topology information; it just tells hwloc where to load it from. You'll still need to invoke hwloc_topology_load() to actually load the topology information.

Returns:
    -1 with errno set to EINVAL on failure to read the XML buffer.

Note:
    See also hwloc_topology_set_userdata_import_callback() for importing application-specific object userdata.

    For convenience, this backend provides empty binding hooks which just return success. To have hwloc still actually call OS-specific hooks, the HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM has to be set to assert that the loaded file is really the underlying system.

    On success, the XML component replaces the previously enabled component (if any), but the topology is not actually modified until hwloc_topology_load().

Author

Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code.