Open MPI logo

Portable Hardware Locality (hwloc) Documentation: v2.9.1

  |   Home   |   Support   |   FAQ   |  
Components and plugins

hwloc is organized in components that are responsible for discovering objects. Depending on the topology configuration, some components will be used, some will be ignored. The usual default is to enable the native operating system component, (e.g. linux or solaris) and the pci miscellaneous component. If available, an architecture-specific component (such as x86) may also improve the topology detection.

If a XML topology is loaded, the xml discovery component will be used instead of all other components. It internally uses a specific class of components for the actual XML import/export routines (xml_libxml and xml_nolibxml) but these will not be discussed here (see libxml2 and minimalistic XML backends).

Components enabled by default

The hwloc core contains a list of components sorted by priority. Each one is enabled as long as it does not conflict with the previously enabled ones. This includes native operating system components, architecture-specific ones, and if available, I/O components such as pci.

Usually the native operating system component (when it exists, e.g. linux or aix) is enabled first. Then hwloc looks for an architecture specific component (e.g. x86). Finally there also exist a basic component (no_os) that just tries to discover the number of PUs in the system.

Each component discovers as much topology information as possible. Most of them, including most native OS components, do nothing unless the topology is still empty. Some others, such as x86 and pci, can complete and annotate what other backends found earlier. Discovery is performed by phases: CPUs are first discovered, then memory is attached, then PCI, etc.

Default priorities ensure that clever components are invoked first. Native operating system components have higher priorities, and are therefore invoked first, because they likely offer very detailed topology information. If needed, it will be later extended by architecture-specific information (e.g. from the x86 component).

If any configuration function such as hwloc_topology_set_xml() is used before loading the topology, the corresponding component is enabled first. Then, as usual, hwloc enables any other component (based on priorities) that does not conflict.

Certain components that manage a virtual topology, for instance XML topology import or synthetic topology description, conflict with all other components. Therefore, one of them may only be loaded (e.g. with hwloc_topology_set_xml()) if no other component is enabled.

The environment variable HWLOC_COMPONENTS_VERBOSE may be set to get verbose messages about component registration (including their priority) and enabling.

Selecting which components to use

If no topology configuration functions such as hwloc_topology_set_synthetic() have been called, plugins may be selected with environment variables such as HWLOC_XMLFILE, HWLOC_SYNTHETIC, HWLOC_FSROOT, or HWLOC_CPUID_PATH (see Environment Variables).

Finally, the environment variable HWLOC_COMPONENTS resets the list of selected components. If the variable is set and empty (or set to a single comma separating nothing, since some operating systems do not accept empty variables), the normal plugin priority order is used.

If the variable is set to x86 in this variable will cause the x86 component to take precedence over any other component, including the native operating system component. It is therefore loaded first, before hwloc tries to load all remaining non-conflicting components. In this case, x86 would take care of discovering everything it supports, instead of only completing what the native OS information. This may be useful if the native component is buggy on some platforms.

It is possible to prevent some components from being loaded by prefixing their name with - in the list. For instance x86,-pci will load the x86 component, then let hwloc load all the usual components except pci. A single component phase may also be blacklisted, for instance with -linux:io. hwloc_topology_set_components() may also be used inside the program to prevent the loading of a specific component (or phases) for the target topology.

It is possible to prevent all remaining components from being loaded by placing stop in the environment variable. Only the components listed before this keyword will be enabled.

Loading components from plugins

Components may optionally be built as plugins so that the hwloc core library does not directly depend on their dependencies (for instance the libpciaccess library). Plugin support may be enabled with the --enable-plugins configure option. All components buildable as plugins will then be built as plugins. The configure option may be given a comma-separated list of component names to specify the exact list of components to build as plugins.

Plugins are built as independent dynamic libraries that are installed in $libdir/hwloc. All plugins found in this directory are loaded during topology_init() (unless blacklisted in HWLOC_PLUGINS_BLACKLIST, see Environment Variables). A specific list of directories (colon-separated) to scan may be specified in the HWLOC_PLUGINS_PATH environment variable.

Note that loading a plugin just means that the corresponding component is registered to the hwloc core. Components are then only enabled if the topology configuration requests it, as explained in the previous sections.

Also note that plugins should carefully be enabled and used when embedding hwloc in another project, see Embedding hwloc in Other Software for details.

Existing components and plugins

All components distributed within hwloc are listed below. The list of actually available components may be listed at running with the HWLOC_COMPONENTS_VERBOSE environment variable (see Environment Variables).

linux
The official component for discovering CPU, memory and I/O devices on Linux. It discovers PCI devices without the help of external libraries such as libpciaccess, but requires the pci component for adding vendor/device names to PCI objects. It also discovers many kinds of Linux-specific OS devices.
aix, darwin, freebsd, hpux, netbsd, solaris, windows
Each officially supported operating system has its own native component, which is statically built when supported, and which is used by default.
x86
The x86 architecture (either 32 or 64 bits) has its own component that may complete or replace the previously-found CPU information. It is statically built when supported.
bgq
This component is specific to IBM BlueGene/Q compute node (running CNK). It is built and enabled by default when --host=powerpc64-bgq-linux is passed to configure (see How do I build hwloc for BlueGene/Q?).
no_os
A basic component that just tries to detect the number of processing units in the system. It mostly serves on operating systems that are not natively supported. It is always statically built.
pci
PCI object discovery uses the external pciaccess library (aka libpciaccess); see I/O Devices. It may also annotate existing PCI devices with vendor and device names. It may be built as a plugin.
opencl
The OpenCL component creates co-processor OS device objects such as opencl0d0 (first device of the first OpenCL platform) or opencl1d3 (fourth device of the second platform). Only the AMD and NVIDIA OpenCL implementations currently offer locality information. It may be built as a plugin.
rsmi
This component creates GPU OS device objects such as rsmi0 for describing AMD GPUs. It may be built as a plugin.
levelzero
This component creates co-processor OS device objects such as ze0 for describing oneAPI Level Zero devices. It may also create sub-OS-devices such as ze0.0 inside those devices. It may be built as a plugin.
cuda
This component creates co-processor OS device objects such as cuda0 that correspond to NVIDIA GPUs used with CUDA library. It may be built as a plugin.
nvml
Probing the NVIDIA Management Library creates OS device objects such as nvml0 that are useful for batch schedulers. It also detects the actual PCIe link bandwidth without depending on power management state and without requiring administrator privileges. It may be built as a plugin.
gl
Probing the NV-CONTROL X extension (NVCtrl library) creates OS device objects such as :0.0 corresponding to NVIDIA displays. They are useful for graphical applications that need to place computation and/or data near a rendering GPU. It may be built as a plugin.
synthetic
Synthetic topology support (see Synthetic topologies) is always built statically.
xml
XML topology import (see Importing and exporting topologies from/to XML files) is always built statically. It internally uses one of the XML backends (see libxml2 and minimalistic XML backends).
  • xml_nolibxml is a basic and hwloc-specific XML import/export. It is always statically built.
  • xml_libxml relies on the external libxml2 library for provinding a feature-complete XML import/export. It may be built as a plugin.
fake
A dummy plugin that does nothing but is used for debugging plugin support.