---
name: "hwloc_topology_get_support"
section: "3"
platform: "linux"
package: "libhwloc-doc"
version: "1.4.1-4"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/hwlocality_configuration"
---

# hwloc\_topology\_get\_support(3)

Part of [hwlocality\_configuration(3)](/hwlocality_configuration/3.md).

## NAME

Configure Topology Detection -

### Data Structures

struct **hwloc\_topology\_discovery\_support**\
 *Flags describing actual discovery support for this topology.*  struct **hwloc\_topology\_cpubind\_support**\
 *Flags describing actual PU binding support for this topology.*  struct **hwloc\_topology\_membind\_support**\
 *Flags describing actual memory binding support for this topology.*  struct **hwloc\_topology\_support**\
 *Set of flags describing actual support for this topology.*

### Enumerations

enum **hwloc\_topology\_flags\_e** { **HWLOC\_TOPOLOGY\_FLAG\_WHOLE\_SYSTEM**, **HWLOC\_TOPOLOGY\_FLAG\_IS\_THISSYSTEM**, **HWLOC\_TOPOLOGY\_FLAG\_IO\_DEVICES** =  (1\<\<2), **HWLOC\_TOPOLOGY\_FLAG\_IO\_BRIDGES** =  (1\<\<3), **HWLOC\_TOPOLOGY\_FLAG\_WHOLE\_IO** =  (1\<\<4) }\

### 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)\
  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)\
  struct \
 **hwloc\_topology\_support** \* **hwloc\_topology\_get\_support** (**hwloc\_topology\_t** restrict topology)"\

## Detailed Description

These 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()**.

**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 Cpusets and gather all processors and memory nodes, and ignore the fact that some resources may be offline.*

- *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*

  - *HWLOC\_TOPOLOGY\_FLAG\_IO\_BRIDGES*

  - *HWLOC\_TOPOLOGY\_FLAG\_WHOLE\_IO*

  ## Function Documentation

### struct hwloc\_topology\_support\* hwloc\_topology\_get\_support (hwloc\_topology\_t restricttopology)` [read]`

*Retrieve the topology support.*

### int hwloc\_topology\_ignore\_all\_keep\_structure (hwloc\_topology\_ttopology)

*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.*

### int hwloc\_topology\_ignore\_type (hwloc\_topology\_ttopology, hwloc\_obj\_type\_ttype)

*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.*

### int hwloc\_topology\_ignore\_type\_keep\_structure (hwloc\_topology\_ttopology, hwloc\_obj\_type\_ttype)

*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\_set\_custom (hwloc\_topology\_ttopology)

*Prepare the topology for custom assembly. The topology then contains a single root object. It may 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.*

### int hwloc\_topology\_set\_distance\_matrix (hwloc\_topology\_t restricttopology, hwloc\_obj\_type\_ttype, unsignednbobjs, 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\_ttopology, unsigned longflags)

*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.*

### int hwloc\_topology\_set\_fsroot (hwloc\_topology\_t restricttopology, const char \*restrictfsroot\_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.*

*The existing topology is cleared even on failure.*

### int hwloc\_topology\_set\_pid (hwloc\_topology\_t restricttopology, hwloc\_pid\_tpid)

*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* **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 restricttopology, const char \*restrictdescription)

*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.*

*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.*

*The existing topology is cleared even on failure.*

### int hwloc\_topology\_set\_xml (hwloc\_topology\_t restricttopology, const char \*restrictxmlpath)

*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:**

*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.*

*The existing topology is cleared even on failure.*

### int hwloc\_topology\_set\_xmlbuffer (hwloc\_topology\_t restricttopology, const char \*restrictbuffer, intsize)

*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:**

*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.*

*The existing topology is cleared even on failure.*

## Author

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