---
name: "hwloc_cpuset_from_nodeset_strict"
section: "3"
platform: "linux"
package: "libhwloc-doc"
version: "1.11.12-3"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/hwlocality_helper_nodeset_convert"
---

# hwloc\_cpuset\_from\_nodeset\_strict(3)

Part of [hwlocality\_helper\_nodeset\_convert(3)](/hwlocality_helper_nodeset_convert/3.md).

## NAME

hwlocality\_helper\_nodeset\_convert

## SYNOPSIS

### Functions

static void **hwloc\_cpuset\_to\_nodeset** (**hwloc\_topology\_t** topology, **hwloc\_const\_cpuset\_t** \_cpuset, **hwloc\_nodeset\_t** nodeset)\
 static void **hwloc\_cpuset\_to\_nodeset\_strict** (struct hwloc\_topology \*topology, **hwloc\_const\_cpuset\_t** \_cpuset, **hwloc\_nodeset\_t** nodeset)\
 static void **hwloc\_cpuset\_from\_nodeset** (**hwloc\_topology\_t** topology, **hwloc\_cpuset\_t** \_cpuset, **hwloc\_const\_nodeset\_t** nodeset)\
 static void **hwloc\_cpuset\_from\_nodeset\_strict** (struct hwloc\_topology \*topology, **hwloc\_cpuset\_t** \_cpuset, **hwloc\_const\_nodeset\_t** nodeset)\

## Detailed Description

There are two semantics for converting cpusets to nodesets depending on how non-NUMA machines are handled.

When manipulating nodesets for memory binding, non-NUMA machines should be considered as having a single NUMA node. The standard conversion routines below should be used so that marking the first bit of the nodeset means that memory should be bound to a non-NUMA whole machine.

When manipulating nodesets as an actual list of NUMA nodes without any need to handle memory binding on non-NUMA machines, the strict conversion routines may be used instead.

## Function Documentation

### static void hwloc\_cpuset\_from\_nodeset (hwloc\_topology\_t topology, hwloc\_cpuset\_t \_cpuset, hwloc\_const\_nodeset\_t nodeset)` [inline]`, ` [static]`

Convert a NUMA node set into a CPU set and handle non-NUMA cases. If the topology contains no NUMA nodes, the machine is considered as a single memory node, and the following behavior is used: If `nodeset` is empty, `cpuset` will be emptied as well. Otherwise `cpuset` will be entirely filled. This is useful for manipulating memory binding sets.

### static void hwloc\_cpuset\_from\_nodeset\_strict (struct hwloc\_topology \* topology, hwloc\_cpuset\_t \_cpuset, hwloc\_const\_nodeset\_t nodeset)` [inline]`, ` [static]`

Convert a NUMA node set into a CPU set without handling non-NUMA cases. This is the strict variant of **hwloc\_cpuset\_from\_nodeset()**. It does not fix non-NUMA cases. If the topology contains some NUMA nodes, behave exactly the same. However, if the topology contains no NUMA nodes, return an empty cpuset.

### static void hwloc\_cpuset\_to\_nodeset (hwloc\_topology\_t topology, hwloc\_const\_cpuset\_t \_cpuset, hwloc\_nodeset\_t nodeset)` [inline]`, ` [static]`

Convert a CPU set into a NUMA node set and handle non-NUMA cases. If some NUMA nodes have no CPUs at all, this function never sets their indexes in the output node set, even if a full CPU set is given in input.

If the topology contains no NUMA nodes, the machine is considered as a single memory node, and the following behavior is used: If `cpuset` is empty, `nodeset` will be emptied as well. Otherwise `nodeset` will be entirely filled.

### static void hwloc\_cpuset\_to\_nodeset\_strict (struct hwloc\_topology \* topology, hwloc\_const\_cpuset\_t \_cpuset, hwloc\_nodeset\_t nodeset)` [inline]`, ` [static]`

Convert a CPU set into a NUMA node set without handling non-NUMA cases. This is the strict variant of **hwloc\_cpuset\_to\_nodeset()**. It does not fix non-NUMA cases. If the topology contains some NUMA nodes, behave exactly the same. However, if the topology contains no NUMA nodes, return an empty nodeset.

## Author

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