.TH "Topology Detection Configuration and Query" 3 "Sun Nov 2 2014" "Version 1.10.0" "Hardware Locality (hwloc)" \" -*- nroff -*- .ad l .nh .SH NAME Topology Detection Configuration and Query \- .SS "Data Structures" .in +1c .ti -1c .RI "struct \fBhwloc_topology_discovery_support\fP" .br .ti -1c .RI "struct \fBhwloc_topology_cpubind_support\fP" .br .ti -1c .RI "struct \fBhwloc_topology_membind_support\fP" .br .ti -1c .RI "struct \fBhwloc_topology_support\fP" .br .in -1c .SS "Enumerations" .in +1c .ti -1c .RI "enum \fBhwloc_topology_flags_e\fP { \fBHWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM\fP, \fBHWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM\fP, \fBHWLOC_TOPOLOGY_FLAG_IO_DEVICES\fP, \fBHWLOC_TOPOLOGY_FLAG_IO_BRIDGES\fP, \fBHWLOC_TOPOLOGY_FLAG_WHOLE_IO\fP, \fBHWLOC_TOPOLOGY_FLAG_ICACHES\fP }" .br .in -1c .SS "Functions" .in +1c .ti -1c .RI "int \fBhwloc_topology_ignore_type\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_obj_type_t\fP type)" .br .ti -1c .RI "int \fBhwloc_topology_ignore_type_keep_structure\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_obj_type_t\fP type)" .br .ti -1c .RI "int \fBhwloc_topology_ignore_all_keep_structure\fP (\fBhwloc_topology_t\fP topology)" .br .ti -1c .RI "int \fBhwloc_topology_set_flags\fP (\fBhwloc_topology_t\fP topology, unsigned long flags)" .br .ti -1c .RI "unsigned long \fBhwloc_topology_get_flags\fP (\fBhwloc_topology_t\fP topology)" .br .ti -1c .RI "int \fBhwloc_topology_set_pid\fP (\fBhwloc_topology_t\fP restrict topology, hwloc_pid_t pid)" .br .ti -1c .RI "int \fBhwloc_topology_set_fsroot\fP (\fBhwloc_topology_t\fP restrict topology, const char *restrict fsroot_path)" .br .ti -1c .RI "int \fBhwloc_topology_set_synthetic\fP (\fBhwloc_topology_t\fP restrict topology, const char *restrict description)" .br .ti -1c .RI "int \fBhwloc_topology_set_xml\fP (\fBhwloc_topology_t\fP restrict topology, const char *restrict xmlpath)" .br .ti -1c .RI "int \fBhwloc_topology_set_xmlbuffer\fP (\fBhwloc_topology_t\fP restrict topology, const char *restrict buffer, int size)" .br .ti -1c .RI "int \fBhwloc_topology_set_custom\fP (\fBhwloc_topology_t\fP topology)" .br .ti -1c .RI "int \fBhwloc_topology_set_distance_matrix\fP (\fBhwloc_topology_t\fP restrict topology, \fBhwloc_obj_type_t\fP type, unsigned nbobjs, unsigned *os_index, float *distances)" .br .ti -1c .RI "int \fBhwloc_topology_is_thissystem\fP (\fBhwloc_topology_t\fP restrict topology)" .br .ti -1c .RI "const struct .br \fBhwloc_topology_support\fP * \fBhwloc_topology_get_support\fP (\fBhwloc_topology_t\fP restrict topology)" .br .ti -1c .RI "void \fBhwloc_topology_set_userdata\fP (\fBhwloc_topology_t\fP topology, const void *userdata)" .br .ti -1c .RI "void * \fBhwloc_topology_get_userdata\fP (\fBhwloc_topology_t\fP topology)" .br .in -1c .SH "Detailed Description" .PP Several functions can optionally be called between \fBhwloc_topology_init()\fP and \fBhwloc_topology_load()\fP to configure how the detection should be performed, e\&.g\&. to ignore some objects types, define a synthetic topology, etc\&. .PP If none of them is called, the default is to detect all the objects of the machine that the caller is allowed to access\&. .PP 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 \fBhwloc_topology_set_xml()\fP had been called\&. HWLOC_FSROOT switches to reading the topology from the specified Linux filesystem root as if \fBhwloc_topology_set_fsroot()\fP had been called\&. Finally, HWLOC_THISSYSTEM enforces the return value of \fBhwloc_topology_is_thissystem()\fP\&. .SH "Enumeration Type Documentation" .PP .SS "enum \fBhwloc_topology_flags_e\fP" .PP Flags to be set onto a topology context before load\&. Flags should be given to \fBhwloc_topology_set_flags()\fP\&. They may also be returned by \fBhwloc_topology_get_flags()\fP\&. .PP \fBEnumerator\fP .in +1c .TP \fB\fIHWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM \fP\fP Detect the whole system, ignore reservations and offline settings\&. Gather all resources, even if some were disabled by the administrator\&. For instance, ignore Linux Cpusets and gather all processors and memory nodes, and ignore the fact that some resources may be offline\&. .TP \fB\fIHWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM \fP\fP 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\&. .PP Setting the environment variable HWLOC_THISSYSTEM may also result in the same behavior\&. .PP 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\&. .TP \fB\fIHWLOC_TOPOLOGY_FLAG_IO_DEVICES \fP\fP 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\&. Uncommon devices and other bridges (such as PCI-to-PCI bridges) will be ignored\&. .TP \fB\fIHWLOC_TOPOLOGY_FLAG_IO_BRIDGES \fP\fP 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)\&. .TP \fB\fIHWLOC_TOPOLOGY_FLAG_WHOLE_IO \fP\fP Detect the whole PCI hierarchy\&. This flag enables detection of all I/O devices (even the uncommon ones) and bridges (even those that have no device behind them) using the pci backend\&. .TP \fB\fIHWLOC_TOPOLOGY_FLAG_ICACHES \fP\fP Detect instruction caches\&. This flag enables detection of Instruction caches, instead of only Data and Unified caches\&. .SH "Function Documentation" .PP .SS "unsigned long hwloc_topology_get_flags (\fBhwloc_topology_t\fPtopology)" .PP Get OR'ed flags of a topology\&. Get the OR'ed set of \fBhwloc_topology_flags_e\fP of a topology\&. .PP \fBReturns:\fP .RS 4 the flags previously set with \fBhwloc_topology_set_flags()\fP\&. .RE .PP .SS "const struct \fBhwloc_topology_support\fP* hwloc_topology_get_support (\fBhwloc_topology_t\fP restricttopology)" .PP Retrieve the topology support\&. .SS "void* hwloc_topology_get_userdata (\fBhwloc_topology_t\fPtopology)" .PP Retrieve the topology-specific userdata pointer\&. Retrieve the application-given private data pointer that was previously set with \fBhwloc_topology_set_userdata()\fP\&. .SS "int hwloc_topology_ignore_all_keep_structure (\fBhwloc_topology_t\fPtopology)" .PP Ignore all objects that do not bring any structure\&. Ignore all objects that do not bring any structure: Each ignored object should have a single children or be the only child of its parent\&. I/O objects may not be ignored, topology flags should be used to configure their discovery instead\&. .SS "int hwloc_topology_ignore_type (\fBhwloc_topology_t\fPtopology, \fBhwloc_obj_type_t\fPtype)" .PP 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\&. I/O objects may not be ignored, topology flags should be used to configure their discovery instead\&. .SS "int hwloc_topology_ignore_type_keep_structure (\fBhwloc_topology_t\fPtopology, \fBhwloc_obj_type_t\fPtype)" .PP 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\&. .SS "int hwloc_topology_is_thissystem (\fBhwloc_topology_t\fP restricttopology)" .PP Does the topology context come from this system? .PP \fBReturns:\fP .RS 4 1 if this topology context was built using the system running this program\&. .PP 0 instead (for instance if using another file-system root, a XML topology file, or a synthetic topology)\&. .RE .PP .SS "int hwloc_topology_set_custom (\fBhwloc_topology_t\fPtopology)" .PP Prepare the topology for custom assembly\&. The topology then contains a single root object\&. It must then be built by inserting other topologies with \fBhwloc_custom_insert_topology()\fP or single objects with \fBhwloc_custom_insert_group_object_by_parent()\fP\&. \fBhwloc_topology_load()\fP must be called to finalize the new topology as usual\&. .PP \fBNote:\fP .RS 4 If nothing is inserted in the topology, \fBhwloc_topology_load()\fP will fail with errno set to EINVAL\&. .PP The cpuset and nodeset of the root object are NULL because these sets are meaningless when assembling multiple topologies\&. .PP On success, the custom component replaces the previously enabled component (if any), but the topology is not actually modified until \fBhwloc_topology_load()\fP\&. .RE .PP .SS "int hwloc_topology_set_distance_matrix (\fBhwloc_topology_t\fP restricttopology, \fBhwloc_obj_type_t\fPtype, unsignednbobjs, unsigned *os_index, float *distances)" .PP 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 \fCos_index\fP array\&. The \fCdistances\fP matrix follows the same order\&. The distance from object i to object j in the i*nbobjs+j\&. .PP 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 \fCnbobjs\fP is \fC0\fP, \fCos_index\fP is \fCNULL\fP and \fCdistances\fP is \fCNULL\fP, the existing distance matrix for the given type is removed\&. .PP \fBNote:\fP .RS 4 Distance matrices are ignored in multi-node topologies\&. .RE .PP .SS "int hwloc_topology_set_flags (\fBhwloc_topology_t\fPtopology, unsigned longflags)" .PP Set OR'ed flags to non-yet-loaded topology\&. Set a OR'ed set of \fBhwloc_topology_flags_e\fP onto a topology that was not yet loaded\&. .PP If this function is called multiple times, the last invokation will erase and replace the set of flags that was previously set\&. .PP The flags set in a topology may be retrieved with \fBhwloc_topology_get_flags()\fP .SS "int hwloc_topology_set_fsroot (\fBhwloc_topology_t\fP restricttopology, const char *restrictfsroot_path)" .PP 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 \fCfsroot_path\fP 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 \fBhwloc_topology_is_thissystem()\fP to return 0\&. .PP 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 \fBhwloc_topology_load()\fP to actually load the topology information\&. .PP \fBReturns:\fP .RS 4 -1 with errno set to ENOSYS on non-Linux and on Linux systems that do not support it\&. .PP -1 with the appropriate errno if \fCfsroot_path\fP cannot be used\&. .RE .PP \fBNote:\fP .RS 4 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\&. .PP On success, the Linux component replaces the previously enabled component (if any), but the topology is not actually modified until \fBhwloc_topology_load()\fP\&. .RE .PP .SS "int hwloc_topology_set_pid (\fBhwloc_topology_t\fP restricttopology, hwloc_pid_tpid)" .PP Change which pid 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 \fBhwloc_topology_set_pid()\fP permits to make it expose the topology of the machine from the point of view of another process\&. .PP \fBNote:\fP .RS 4 \fChwloc_pid_t\fP is \fCpid_t\fP on Unix platforms, and \fCHANDLE\fP on native Windows platforms\&. .PP -1 is returned and errno is set to ENOSYS on platforms that do not support this feature\&. .RE .PP .SS "int hwloc_topology_set_synthetic (\fBhwloc_topology_t\fP restricttopology, const char *restrictdescription)" .PP Enable synthetic topology\&. Gather topology information from the given \fCdescription\fP, 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 \fBSynthetic topologies\fP\&. .PP If \fCdescription\fP was properly parsed and describes a valid topology configuration, this function returns 0\&. Otherwise -1 is returned and errno is set to EINVAL\&. .PP 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 \fBhwloc_topology_load()\fP to actually load the topology information\&. .PP \fBNote:\fP .RS 4 For convenience, this backend provides empty binding hooks which just return success\&. .PP On success, the synthetic component replaces the previously enabled component (if any), but the topology is not actually modified until \fBhwloc_topology_load()\fP\&. .RE .PP .SS "void hwloc_topology_set_userdata (\fBhwloc_topology_t\fPtopology, const void *userdata)" .PP Set the topology-specific userdata pointer\&. Each topology may store one application-given private data pointer\&. It is initialized to \fCNULL\fP\&. hwloc will never modify it\&. .PP Use it as you wish, after \fBhwloc_topology_init()\fP and until hwloc_topolog_destroy()\&. .PP This pointer is not exported to XML\&. .SS "int hwloc_topology_set_xml (\fBhwloc_topology_t\fP restricttopology, const char *restrictxmlpath)" .PP Enable XML-file based topology\&. Gather topology information from the XML file given at \fCxmlpath\fP\&. Setting the environment variable HWLOC_XMLFILE may also result in this behavior\&. This file may have been generated earlier with \fBhwloc_topology_export_xml()\fP or lstopo file\&.xml\&. .PP 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 \fBhwloc_topology_load()\fP to actually load the topology information\&. .PP \fBReturns:\fP .RS 4 -1 with errno set to EINVAL on failure to read the XML file\&. .RE .PP \fBNote:\fP .RS 4 See also \fBhwloc_topology_set_userdata_import_callback()\fP for importing application-specific object userdata\&. .PP 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\&. .PP On success, the XML component replaces the previously enabled component (if any), but the topology is not actually modified until \fBhwloc_topology_load()\fP\&. .RE .PP .SS "int hwloc_topology_set_xmlbuffer (\fBhwloc_topology_t\fP restricttopology, const char *restrictbuffer, intsize)" .PP Enable XML based topology using a memory buffer (instead of a file, as with \fBhwloc_topology_set_xml()\fP)\&. Gather topology information from the XML memory buffer given at \fCbuffer\fP and of length \fCsize\fP\&. This buffer may have been filled earlier with \fBhwloc_topology_export_xmlbuffer()\fP\&. .PP 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 \fBhwloc_topology_load()\fP to actually load the topology information\&. .PP \fBReturns:\fP .RS 4 -1 with errno set to EINVAL on failure to read the XML buffer\&. .RE .PP \fBNote:\fP .RS 4 See also \fBhwloc_topology_set_userdata_import_callback()\fP for importing application-specific object userdata\&. .PP 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\&. .PP On success, the XML component replaces the previously enabled component (if any), but the topology is not actually modified until \fBhwloc_topology_load()\fP\&. .RE .PP .SH "Author" .PP Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code\&.