---
name: "hwloc_distances_add"
section: "3"
platform: "linux"
package: "libhwloc-doc"
version: "2.4.1+dfsg-1"
release: "Debian 11 (Bullseye)"
platforms: ["linux"]
url: "https://new.carta.tech/hwlocality_distances_add"
---

# hwloc\_distances\_add(3)

Add or remove distances between objects

Part of [hwlocality\_distances\_add(3)](/hwlocality_distances_add/3.md).

## NAME

hwlocality\_distances\_add - Add or remove distances between objects

## SYNOPSIS

### Enumerations

enum **hwloc\_distances\_add\_flag\_e** { **HWLOC\_DISTANCES\_ADD\_FLAG\_GROUP**, **HWLOC\_DISTANCES\_ADD\_FLAG\_GROUP\_INACCURATE** }\

### Functions

int **hwloc\_distances\_add** (**hwloc\_topology\_t** topology, unsigned nbobjs, **hwloc\_obj\_t** \*objs, hwloc\_uint64\_t \*values, unsigned long kind, unsigned long flags)\
 int **hwloc\_distances\_remove** (**hwloc\_topology\_t** topology)\
 int **hwloc\_distances\_remove\_by\_depth** (**hwloc\_topology\_t** topology, int depth)\
 static int **hwloc\_distances\_remove\_by\_type** (**hwloc\_topology\_t** topology, **hwloc\_obj\_type\_t** type)\
 int **hwloc\_distances\_release\_remove** (**hwloc\_topology\_t** topology, struct **hwloc\_distances\_s** \*distances)\

## Detailed Description

## Enumeration Type Documentation

### enum hwloc\_distances\_add\_flag\_e

Flags for adding a new distances to a topology.

**Enumerator**

- *HWLOC\_DISTANCES\_ADD\_FLAG\_GROUP*

  *Try to group objects based on the newly provided distance information.*

- *HWLOC\_DISTANCES\_ADD\_FLAG\_GROUP\_INACCURATE*

  *If grouping, consider the distance values as inaccurate and relax the comparisons during the grouping algorithms. The actual accuracy may be modified through the HWLOC\_GROUPING\_ACCURACY environment variable (see* **Environment Variables***).*

## Function Documentation

### int hwloc\_distances\_add (hwloc\_topology\_t topology, unsigned nbobjs, hwloc\_obj\_t \* objs, hwloc\_uint64\_t \* values, unsigned long kind, unsigned long flags)

*Provide a new distance matrix. Provide the matrix of distances between a set of objects given by* `nbobjs` *and the* `objs` *array.* `nbobjs` *must be at least 2. The distances are stored as a one-dimension array in* `values`*. The distance from object i to object j is in slot i\*nbobjs+j.*

`kind` *specifies the kind of distance as a OR'ed set of* **hwloc\_distances\_kind\_e***. Kind* **HWLOC\_DISTANCES\_KIND\_HETEROGENEOUS\_TYPES** *will be automatically added if objects of different types are given.*

`flags` *configures the behavior of the function using an optional OR'ed set of* **hwloc\_distances\_add\_flag\_e***.*

### int hwloc\_distances\_release\_remove (hwloc\_topology\_t topology, struct hwloc\_distances\_s \* distances)

*Release and remove the given distance matrice from the topology. This function includes a call to* **hwloc\_distances\_release()***.*

### int hwloc\_distances\_remove (hwloc\_topology\_t topology)

*Remove all distance matrices from a topology. Remove all distance matrices, either provided by the user or gathered through the OS.*

*If these distances were used to group objects, these additional Group objects are not removed from the topology.*

### int hwloc\_distances\_remove\_by\_depth (hwloc\_topology\_t topology, int depth)

*Remove distance matrices for objects at a specific depth in the topology. Identical to* **hwloc\_distances\_remove()** *but only applies to one level of the topology.*

### static int hwloc\_distances\_remove\_by\_type (hwloc\_topology\_t topology, hwloc\_obj\_type\_t type)` [inline]`, ` [static]`

*Remove distance matrices for objects of a specific type in the topology. Identical to* **hwloc\_distances\_remove()** *but only applies to one level of the topology.*

## Author

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