.TH "hwlocality_configuration" 3 "Version 2.10.0rc2" "Hardware Locality (hwloc)" \" -*- nroff -*- .ad l .nh .SH NAME hwlocality_configuration \- Topology Detection Configuration and Query .SH SYNOPSIS .br .PP .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_misc_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_INCLUDE_DISALLOWED\fP, \fBHWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM\fP, \fBHWLOC_TOPOLOGY_FLAG_THISSYSTEM_ALLOWED_RESOURCES\fP, \fBHWLOC_TOPOLOGY_FLAG_IMPORT_SUPPORT\fP = (1UL<<3), \fBHWLOC_TOPOLOGY_FLAG_RESTRICT_TO_CPUBINDING\fP = (1UL<<4), \fBHWLOC_TOPOLOGY_FLAG_RESTRICT_TO_MEMBINDING\fP = (1UL<<5), \fBHWLOC_TOPOLOGY_FLAG_DONT_CHANGE_BINDING\fP = (1UL<<6), \fBHWLOC_TOPOLOGY_FLAG_NO_DISTANCES\fP = (1UL<<7), \fBHWLOC_TOPOLOGY_FLAG_NO_MEMATTRS\fP = (1UL<<8), \fBHWLOC_TOPOLOGY_FLAG_NO_CPUKINDS\fP = (1UL<<9) }" .br .ti -1c .RI "enum \fBhwloc_type_filter_e\fP { \fBHWLOC_TYPE_FILTER_KEEP_ALL\fP, \fBHWLOC_TYPE_FILTER_KEEP_NONE\fP, \fBHWLOC_TYPE_FILTER_KEEP_STRUCTURE\fP, \fBHWLOC_TYPE_FILTER_KEEP_IMPORTANT\fP }" .br .in -1c .SS "Functions" .in +1c .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_is_thissystem\fP (\fBhwloc_topology_t\fP restrict topology)" .br .ti -1c .RI "const struct \fBhwloc_topology_support\fP * \fBhwloc_topology_get_support\fP (\fBhwloc_topology_t\fP restrict topology)" .br .ti -1c .RI "int \fBhwloc_topology_set_type_filter\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_obj_type_t\fP type, enum \fBhwloc_type_filter_e\fP filter)" .br .ti -1c .RI "int \fBhwloc_topology_get_type_filter\fP (\fBhwloc_topology_t\fP topology, \fBhwloc_obj_type_t\fP type, enum \fBhwloc_type_filter_e\fP *filter)" .br .ti -1c .RI "int \fBhwloc_topology_set_all_types_filter\fP (\fBhwloc_topology_t\fP topology, enum \fBhwloc_type_filter_e\fP filter)" .br .ti -1c .RI "int \fBhwloc_topology_set_cache_types_filter\fP (\fBhwloc_topology_t\fP topology, enum \fBhwloc_type_filter_e\fP filter)" .br .ti -1c .RI "int \fBhwloc_topology_set_icache_types_filter\fP (\fBhwloc_topology_t\fP topology, enum \fBhwloc_type_filter_e\fP filter)" .br .ti -1c .RI "int \fBhwloc_topology_set_io_types_filter\fP (\fBhwloc_topology_t\fP topology, enum \fBhwloc_type_filter_e\fP filter)" .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\&. .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_INCLUDE_DISALLOWED \fP\fP Detect the whole system, ignore reservations, include disallowed objects\&. Gather all online resources, even if some were disabled by the administrator\&. For instance, ignore Linux Cgroup/Cpusets and gather all processors and memory nodes\&. However offline PUs and NUMA nodes are still ignored\&. .PP When this flag is not set, PUs and NUMA nodes 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\&. All existing PUs and NUMA nodes in the topology are allowed\&. \fBhwloc_topology_get_allowed_cpuset()\fP and \fBhwloc_topology_get_allowed_nodeset()\fP are equal to the root object cpuset and nodeset\&. .PP When this flag is set, the actual sets of allowed PUs and NUMA nodes are given by \fBhwloc_topology_get_allowed_cpuset()\fP and \fBhwloc_topology_get_allowed_nodeset()\fP\&. They may be smaller than the root object cpuset and nodeset\&. .PP If the current topology is exported to XML and reimported later, this flag should be set again in the reimported topology so that disallowed resources are reimported as well\&. .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 \fBhwloc_topology_is_thissystem()\fP 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_THISSYSTEM_ALLOWED_RESOURCES \fP\fP Get the set of allowed resources from the local operating system even if the topology was loaded from XML or synthetic description\&. If the topology was loaded from XML or from a synthetic string, restrict it by applying the current process restrictions such as Linux Cgroup/Cpuset\&. .PP This is useful when the topology is not loaded directly from the local machine (e\&.g\&. for performance reason) and it comes with all resources, while the running process is restricted to only parts of the machine\&. .PP This flag is ignored unless \fBHWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM\fP is also set since the loaded topology must match the underlying machine where restrictions will be gathered from\&. .PP Setting the environment variable HWLOC_THISSYSTEM_ALLOWED_RESOURCES would result in the same behavior\&. .TP \fB\fIHWLOC_TOPOLOGY_FLAG_IMPORT_SUPPORT \fP\fP Import support from the imported topology\&. When importing a XML topology from a remote machine, binding is disabled by default (see \fBHWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM\fP)\&. This disabling is also marked by putting zeroes in the corresponding supported feature bits reported by \fBhwloc_topology_get_support()\fP\&. .PP The flag \fBHWLOC_TOPOLOGY_FLAG_IMPORT_SUPPORT\fP actually imports support bits from the remote machine\&. It also sets the flag \fCimported_support\fP in the struct \fBhwloc_topology_misc_support\fP array\&. If the imported XML did not contain any support information (exporter hwloc is too old), this flag is not set\&. .PP Note that these supported features are only relevant for the hwloc installation that actually exported the XML topology (it may vary with the operating system, or with how hwloc was compiled)\&. .PP Note that setting this flag however does not enable binding for the locally imported hwloc topology, it only reports what the remote hwloc and machine support\&. .TP \fB\fIHWLOC_TOPOLOGY_FLAG_RESTRICT_TO_CPUBINDING \fP\fP Do not consider resources outside of the process CPU binding\&. If the binding of the process is limited to a subset of cores, ignore the other cores during discovery\&. .PP The resulting topology is identical to what a call to \fBhwloc_topology_restrict()\fP would generate, but this flag also prevents hwloc from ever touching other resources during the discovery\&. .PP This flag especially tells the x86 backend to never temporarily rebind a thread on any excluded core\&. This is useful on Windows because such temporary rebinding can change the process binding\&. Another use-case is to avoid cores that would not be able to perform the hwloc discovery anytime soon because they are busy executing some high-priority real-time tasks\&. .PP If process CPU binding is not supported, the thread CPU binding is considered instead if supported, or the flag is ignored\&. .PP This flag requires \fBHWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM\fP as well since binding support is required\&. .TP \fB\fIHWLOC_TOPOLOGY_FLAG_RESTRICT_TO_MEMBINDING \fP\fP Do not consider resources outside of the process memory binding\&. If the binding of the process is limited to a subset of NUMA nodes, ignore the other NUMA nodes during discovery\&. .PP The resulting topology is identical to what a call to \fBhwloc_topology_restrict()\fP would generate, but this flag also prevents hwloc from ever touching other resources during the discovery\&. .PP This flag is meant to be used together with \fBHWLOC_TOPOLOGY_FLAG_RESTRICT_TO_CPUBINDING\fP when both cores and NUMA nodes should be ignored outside of the process binding\&. .PP If process memory binding is not supported, the thread memory binding is considered instead if supported, or the flag is ignored\&. .PP This flag requires \fBHWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM\fP as well since binding support is required\&. .TP \fB\fIHWLOC_TOPOLOGY_FLAG_DONT_CHANGE_BINDING \fP\fP Do not ever modify the process or thread binding during discovery\&. This flag disables all hwloc discovery steps that require a change of the process or thread binding\&. This currently only affects the x86 backend which gets entirely disabled\&. .PP This is useful when \fBhwloc_topology_load()\fP is called while the application also creates additional threads or modifies the binding\&. .PP This flag is also a strict way to make sure the process binding will not change to due thread binding changes on Windows (see \fBHWLOC_TOPOLOGY_FLAG_RESTRICT_TO_CPUBINDING\fP)\&. .TP \fB\fIHWLOC_TOPOLOGY_FLAG_NO_DISTANCES \fP\fP Ignore distances\&. Ignore distance information from the operating systems (and from XML) and hence do not use distances for grouping\&. .TP \fB\fIHWLOC_TOPOLOGY_FLAG_NO_MEMATTRS \fP\fP Ignore memory attributes and tiers\&. Ignore memory attribues from the operating systems (and from XML) Hence also do not try to build memory tiers\&. .TP \fB\fIHWLOC_TOPOLOGY_FLAG_NO_CPUKINDS \fP\fP Ignore CPU Kinds\&. Ignore CPU kind information from the operating systems (and from XML)\&. .SS "enum \fBhwloc_type_filter_e\fP" .PP Type filtering flags\&. By default, most objects are kept (\fBHWLOC_TYPE_FILTER_KEEP_ALL\fP)\&. Instruction caches, memory-side caches, I/O and Misc objects are ignored by default (\fBHWLOC_TYPE_FILTER_KEEP_NONE\fP)\&. Group levels are ignored unless they bring structure (\fBHWLOC_TYPE_FILTER_KEEP_STRUCTURE\fP)\&. .PP Note that group objects are also ignored individually (without the entire level) when they do not bring structure\&. .PP \fBEnumerator\fP .in +1c .TP \fB\fIHWLOC_TYPE_FILTER_KEEP_ALL \fP\fP Keep all objects of this type\&. Cannot be set for \fBHWLOC_OBJ_GROUP\fP (groups are designed only to add more structure to the topology)\&. .TP \fB\fIHWLOC_TYPE_FILTER_KEEP_NONE \fP\fP Ignore all objects of this type\&. The bottom-level type \fBHWLOC_OBJ_PU\fP, the \fBHWLOC_OBJ_NUMANODE\fP type, and the top-level type \fBHWLOC_OBJ_MACHINE\fP may not be ignored\&. .TP \fB\fIHWLOC_TYPE_FILTER_KEEP_STRUCTURE \fP\fP Only ignore objects if their entire level does not bring any structure\&. Keep the entire level of objects if at least one of these objects adds structure to the topology\&. An object brings structure when it has multiple children and it is not the only child of its parent\&. .PP If all objects in the level are the only child of their parent, and if none of them has multiple children, the entire level is removed\&. .PP Cannot be set for I/O and Misc objects since the topology structure does not matter there\&. .TP \fB\fIHWLOC_TYPE_FILTER_KEEP_IMPORTANT \fP\fP Only keep likely-important objects of the given type\&. It is only useful for I/O object types\&. For \fBHWLOC_OBJ_PCI_DEVICE\fP and \fBHWLOC_OBJ_OS_DEVICE\fP, it means that only objects of major/common kinds are kept (storage, network, OpenFabrics, CUDA, OpenCL, RSMI, NVML, and displays)\&. Also, only OS devices directly attached on PCI (e\&.g\&. no USB) are reported\&. For \fBHWLOC_OBJ_BRIDGE\fP, it means that bridges are kept only if they have children\&. .PP This flag equivalent to \fBHWLOC_TYPE_FILTER_KEEP_ALL\fP for Normal, Memory and Misc types since they are likely important\&. .SH "Function Documentation" .PP .SS "unsigned long hwloc_topology_get_flags (\fBhwloc_topology_t\fP topology)" .PP Get OR'ed flags of a topology\&. Get the OR'ed set of \fBhwloc_topology_flags_e\fP of a topology\&. .PP If \fBhwloc_topology_set_flags()\fP was not called earlier, no flags are set (\fC0\fP is returned)\&. .PP \fBReturns\fP .RS 4 the flags previously set with \fBhwloc_topology_set_flags()\fP\&. .RE .PP \fBNote\fP .RS 4 This function may also be called after \fBhwloc_topology_load()\fP\&. .RE .PP .SS "const struct \fBhwloc_topology_support\fP * hwloc_topology_get_support (\fBhwloc_topology_t\fP restrict topology)" .PP Retrieve the topology support\&. Each flag indicates whether a feature is supported\&. If set to 0, the feature is not supported\&. If set to 1, the feature is supported, but the corresponding call may still fail in some corner cases\&. .PP These features are also listed by hwloc-info --support .PP The reported features are what the current topology supports on the current machine\&. If the topology was exported to XML from another machine and later imported here, support still describes what is supported for this imported topology after import\&. By default, binding will be reported as unsupported in this case (see \fBHWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM\fP)\&. .PP Topology flag \fBHWLOC_TOPOLOGY_FLAG_IMPORT_SUPPORT\fP may be used to report the supported features of the original remote machine instead\&. If it was successfully imported, \fCimported_support\fP will be set in the struct \fBhwloc_topology_misc_support\fP array\&. .PP \fBReturns\fP .RS 4 A pointer to a support structure\&. .RE .PP \fBNote\fP .RS 4 The function cannot return \fCNULL\fP\&. .PP The returned pointer should not be freed, it belongs to the hwloc library\&. .PP This function may be called before or after \fBhwloc_topology_load()\fP but the support structure only contains valid information after\&. .RE .PP .SS "int hwloc_topology_get_type_filter (\fBhwloc_topology_t\fP topology, \fBhwloc_obj_type_t\fP type, enum \fBhwloc_type_filter_e\fP * filter)" .PP Get the current filtering for the given object type\&. .PP \fBReturns\fP .RS 4 0 on success, -1 on error\&. .RE .PP .SS "void * hwloc_topology_get_userdata (\fBhwloc_topology_t\fP topology)" .PP Retrieve the topology-specific userdata pointer\&. Retrieve the application-given private data pointer that was previously set with \fBhwloc_topology_set_userdata()\fP\&. .PP \fBReturns\fP .RS 4 A pointer to the private-data if any\&. .PP \fCNULL\fP if no private-data was previoulsy set\&. .RE .PP .SS "int hwloc_topology_is_thissystem (\fBhwloc_topology_t\fP restrict topology)" .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 \fBNote\fP .RS 4 This function may also be called after \fBhwloc_topology_load()\fP\&. .RE .PP .SS "int hwloc_topology_set_all_types_filter (\fBhwloc_topology_t\fP topology, enum \fBhwloc_type_filter_e\fP filter)" .PP Set the filtering for all object types\&. If some types do not support this filtering, they are silently ignored\&. .PP \fBReturns\fP .RS 4 0 on success, -1 on error\&. .RE .PP .SS "int hwloc_topology_set_cache_types_filter (\fBhwloc_topology_t\fP topology, enum \fBhwloc_type_filter_e\fP filter)" .PP Set the filtering for all CPU cache object types\&. Memory-side caches are not involved since they are not CPU caches\&. .PP \fBReturns\fP .RS 4 0 on success, -1 on error\&. .RE .PP .SS "int hwloc_topology_set_flags (\fBhwloc_topology_t\fP topology, unsigned long flags)" .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 invocation will erase and replace the set of flags that was previously set\&. .PP By default, no flags are set (\fC0\fP)\&. .PP The flags set in a topology may be retrieved with \fBhwloc_topology_get_flags()\fP\&. .PP \fBReturns\fP .RS 4 0 on success\&. .PP -1 on error, for instance if flags are invalid\&. .RE .PP .SS "int hwloc_topology_set_icache_types_filter (\fBhwloc_topology_t\fP topology, enum \fBhwloc_type_filter_e\fP filter)" .PP Set the filtering for all CPU instruction cache object types\&. Memory-side caches are not involved since they are not CPU caches\&. .PP \fBReturns\fP .RS 4 0 on success, -1 on error\&. .RE .PP .SS "int hwloc_topology_set_io_types_filter (\fBhwloc_topology_t\fP topology, enum \fBhwloc_type_filter_e\fP filter)" .PP Set the filtering for all I/O object types\&. .PP \fBReturns\fP .RS 4 0 on success, -1 on error\&. .RE .PP .SS "int hwloc_topology_set_type_filter (\fBhwloc_topology_t\fP topology, \fBhwloc_obj_type_t\fP type, enum \fBhwloc_type_filter_e\fP filter)" .PP Set the filtering for the given object type\&. .PP \fBReturns\fP .RS 4 0 on success, -1 on error\&. .RE .PP .SS "void hwloc_topology_set_userdata (\fBhwloc_topology_t\fP topology, 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\&. .SH "Author" .PP Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code\&.