Hardware Locality (hwloc)
2.4.1
|
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).
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.
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.
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.
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).
--host=powerpc64-bgq-linux
is passed to configure (see How do I build hwloc for BlueGene/Q?).