---
name: "hwlocality_helper_find_inside"
section: "3"
platform: "linux"
package: "hwloc"
version: "2.15.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/hwlocality_helper_find_inside"
---

# hwlocality\_helper\_find\_inside(3)

Finding Objects inside a CPU set

## NAME

hwlocality\_helper\_find\_inside - Finding Objects inside a CPU set

## SYNOPSIS

### Functions

**hwloc\_obj\_t** **hwloc\_get\_first\_largest\_obj\_inside\_cpuset** (**hwloc\_topology\_t** topology, **hwloc\_const\_cpuset\_t** set)\
 int **hwloc\_get\_largest\_objs\_inside\_cpuset** (**hwloc\_topology\_t** topology, **hwloc\_const\_cpuset\_t** set, **hwloc\_obj\_t** \*restrict objs, int max)\
 **hwloc\_obj\_t** **hwloc\_get\_next\_obj\_inside\_cpuset\_by\_depth** (**hwloc\_topology\_t** topology, **hwloc\_const\_cpuset\_t** set, int depth, **hwloc\_obj\_t** prev)\
 **hwloc\_obj\_t** **hwloc\_get\_next\_obj\_inside\_cpuset\_by\_type** (**hwloc\_topology\_t** topology, **hwloc\_const\_cpuset\_t** set, **hwloc\_obj\_type\_t** type, **hwloc\_obj\_t** prev)\
 **hwloc\_obj\_t** **hwloc\_get\_obj\_inside\_cpuset\_by\_depth** (**hwloc\_topology\_t** topology, **hwloc\_const\_cpuset\_t** set, int depth, unsigned idx)\
 **hwloc\_obj\_t** **hwloc\_get\_obj\_inside\_cpuset\_by\_type** (**hwloc\_topology\_t** topology, **hwloc\_const\_cpuset\_t** set, **hwloc\_obj\_type\_t** type, unsigned idx)\
 unsigned **hwloc\_get\_nbobjs\_inside\_cpuset\_by\_depth** (**hwloc\_topology\_t** topology, **hwloc\_const\_cpuset\_t** set, int depth)\
 int **hwloc\_get\_nbobjs\_inside\_cpuset\_by\_type** (**hwloc\_topology\_t** topology, **hwloc\_const\_cpuset\_t** set, **hwloc\_obj\_type\_t** type)\
 int **hwloc\_get\_obj\_index\_inside\_cpuset** (**hwloc\_topology\_t** topology, **hwloc\_const\_cpuset\_t** set, **hwloc\_obj\_t** obj)\

## Detailed Description

## Function Documentation

### hwloc\_obj\_t hwloc\_get\_first\_largest\_obj\_inside\_cpuset (hwloc\_topology\_t topology, hwloc\_const\_cpuset\_t set) \[inline\]

Get the first largest object included in the given cpuset set.

**Returns**

the first object that is included in set and whose parent is not.

NULL if no such object exists.

This is convenient for iterating over all largest objects within a CPU set by doing a loop getting the first largest object and clearing its CPU set from the remaining CPU set.

### int hwloc\_get\_largest\_objs\_inside\_cpuset (hwloc\_topology\_t topology, hwloc\_const\_cpuset\_t set, hwloc\_obj\_t \*restrict objs, int max)

Get the set of largest objects covering exactly a given cpuset set.

**Returns**

the number of objects returned in objs.

\-1 if no set of objects may cover that cpuset.

### unsigned hwloc\_get\_nbobjs\_inside\_cpuset\_by\_depth (hwloc\_topology\_t topology, hwloc\_const\_cpuset\_t set, int depth) \[inline\]

Return the number of objects at depth depth included in CPU set set.

**Returns**

the number of objects.

0 if the depth is invalid.

**Note**

Objects with empty CPU sets are ignored (otherwise they would be considered included in any given set).

This function cannot work if objects at the given depth do not have CPU sets (I/O or Misc objects).

### int hwloc\_get\_nbobjs\_inside\_cpuset\_by\_type (hwloc\_topology\_t topology, hwloc\_const\_cpuset\_t set, hwloc\_obj\_type\_t type) \[inline\]

Return the number of objects of type type included in CPU set set.

**Returns**

the number of objects.

0 if there are no objects of that type in the topology.

\-1 if there are multiple levels of objects of that type, the caller should fallback to **hwloc\_get\_nbobjs\_inside\_cpuset\_by\_depth()**.

**Note**

Objects with empty CPU sets are ignored (otherwise they would be considered included in any given set).

This function cannot work if objects of the given type do not have CPU sets (I/O objects).

### hwloc\_obj\_t hwloc\_get\_next\_obj\_inside\_cpuset\_by\_depth (hwloc\_topology\_t topology, hwloc\_const\_cpuset\_t set, int depth, hwloc\_obj\_t prev) \[inline\]

Return the next object at depth depth included in CPU set set. The next invokation should pass the previous return value in prev so as to obtain the next object in set.

**Returns**

the first object at depth depth included in set if prev is NULL.

the next object at depth depth included in set if prev is not NULL.

NULL if there is no next object.

**Note**

Objects with empty CPU sets are ignored (otherwise they would be considered included in any given set).

This function cannot work if objects at the given depth do not have CPU sets (I/O or Misc objects).

### hwloc\_obj\_t hwloc\_get\_next\_obj\_inside\_cpuset\_by\_type (hwloc\_topology\_t topology, hwloc\_const\_cpuset\_t set, hwloc\_obj\_type\_t type, hwloc\_obj\_t prev) \[inline\]

Return the next object of type type included in CPU set set. The next invokation should pass the previous return value in prev so as to obtain the next object in set.

**Returns**

the first object of type type included in set if prev is NULL.

the next object of type type included in set if prev is not NULL.

NULL if there is no next object.

NULL if there is no depth for the given type.

NULL if there are multiple depths for the given type, the caller should fallback to **hwloc\_get\_next\_obj\_inside\_cpuset\_by\_depth()**.

**Note**

Objects with empty CPU sets are ignored (otherwise they would be considered included in any given set).

This function cannot work if objects of the given type do not have CPU sets (I/O or Misc objects).

### int hwloc\_get\_obj\_index\_inside\_cpuset (hwloc\_topology\_t topology, hwloc\_const\_cpuset\_t set, hwloc\_obj\_t obj) \[inline\]

Return the logical index among the objects included in CPU set set. Consult all objects in the same level as obj and inside CPU set set in the logical order, and return the index of obj within them. If set covers the entire topology, this is the logical index of obj. Otherwise, this is similar to a logical index within the part of the topology defined by CPU set set.

**Returns**

the logical index among the objects included in the set if any.

\-1 if the object is not included in the set.

**Note**

Objects with empty CPU sets are ignored (otherwise they would be considered included in any given set).

This function cannot work if obj does not have CPU sets (I/O objects).

### hwloc\_obj\_t hwloc\_get\_obj\_inside\_cpuset\_by\_depth (hwloc\_topology\_t topology, hwloc\_const\_cpuset\_t set, int depth, unsigned idx) \[inline\]

Return the (logically) idx -th object at depth depth included in CPU set set.

**Returns**

the object if any, NULL otherwise.

**Note**

Objects with empty CPU sets are ignored (otherwise they would be considered included in any given set).

This function cannot work if objects at the given depth do not have CPU sets (I/O or Misc objects).

### hwloc\_obj\_t hwloc\_get\_obj\_inside\_cpuset\_by\_type (hwloc\_topology\_t topology, hwloc\_const\_cpuset\_t set, hwloc\_obj\_type\_t type, unsigned idx) \[inline\]

Return the idx -th object of type type included in CPU set set.

**Returns**

the object if any.

NULL if there is no such object.

NULL if there is no depth for given type.

NULL if there are multiple depths for given type, the caller should fallback to **hwloc\_get\_obj\_inside\_cpuset\_by\_depth()**.

**Note**

Objects with empty CPU sets are ignored (otherwise they would be considered included in any given set).

This function cannot work if objects of the given type do not have CPU sets (I/O or Misc objects).

## Author

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