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

# hwlocality\_helper\_binding(3)

## NAME

Binding Helpers -

### Functions

static inline void **hwloc\_distributev** (**hwloc\_topology\_t** topology, **hwloc\_obj\_t** \*root, unsigned n\_roots, **hwloc\_cpuset\_t** \*cpuset, unsigned n, unsigned until)\
 static inline void **hwloc\_distribute** (**hwloc\_topology\_t** topology, **hwloc\_obj\_t** root, **hwloc\_cpuset\_t** \*cpuset, unsigned n, unsigned until)\
 static inline void \* **hwloc\_alloc\_membind\_policy\_nodeset** (**hwloc\_topology\_t** topology, size\_t len, **hwloc\_const\_nodeset\_t** nodeset, **hwloc\_membind\_policy\_t** policy, int flags)\
 static inline void \* **hwloc\_alloc\_membind\_policy** (**hwloc\_topology\_t** topology, size\_t len, **hwloc\_const\_cpuset\_t** cpuset, **hwloc\_membind\_policy\_t** policy, int flags)\

## Function Documentation

### static inline void\* hwloc\_alloc\_membind\_policy (hwloc\_topology\_ttopology, size\_tlen, hwloc\_const\_cpuset\_tcpuset, hwloc\_membind\_policy\_tpolicy, intflags)` [static]`

Allocate some memory on the memory nodes near given cpuset `cpuset`. This is similar to hwloc\_alloc\_membind\_policy\_nodeset, but for a given cpuset.

### static inline void\* hwloc\_alloc\_membind\_policy\_nodeset (hwloc\_topology\_ttopology, size\_tlen, hwloc\_const\_nodeset\_tnodeset, hwloc\_membind\_policy\_tpolicy, intflags)` [static]`

Allocate some memory on the given nodeset `nodeset`. This is similar to hwloc\_alloc\_membind except that it is allowed to change the current memory binding policy, thus providing more binding support, at the expense of changing the current state.

### static inline void hwloc\_distribute (hwloc\_topology\_ttopology, hwloc\_obj\_troot, hwloc\_cpuset\_t \*cpuset, unsignedn, unsigneduntil)` [static]`

### static inline void hwloc\_distributev (hwloc\_topology\_ttopology, hwloc\_obj\_t \*roots, unsignedn\_roots, hwloc\_cpuset\_t \*cpuset, unsignedn, unsigneduntil)` [static]`

Distribute `n` items over the topology under `root`. Distribute `n` items over the topology under `roots`.

Array `cpuset` will be filled with `n` cpusets recursively distributed linearly over the topology under `root`, down to depth `until` (which can be INT\_MAX to distribute down to the finest level).

This is typically useful when an application wants to distribute `n` threads over a machine, giving each of them as much private cache as possible and keeping them locally in number order.

The caller may typically want to also call **hwloc\_bitmap\_singlify()** before binding a thread so that it does not move at all.

**Note:**

This function requires the `root` object to have a CPU set.

This is the same as hwloc\_distribute, but takes an array of roots instead of just one root.

**Note:**

This function requires the `roots` objects to have a CPU set.

## Author

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