the cpuset api(3)
NAME
- The Cpuset API
- Defines
- #define hwloc_cpuset_foreach_begin(cpu, set)
Loop macro iterating on CPU set set.
- #define hwloc_cpuset_foreach_end() }
End of loop.
- Typedefs
- typedef struct hwloc_cpuset_s * hwloc_cpuset_t
Set of CPUs represented as an opaque pointer to an internal bitmask.
- typedef struct hwloc_cpuset_s * hwloc_const_cpuset_t
- Functions
- hwloc_cpuset_t hwloc_cpuset_alloc (void)
Allocate a new empty CPU set.
- void hwloc_cpuset_free (hwloc_cpuset_t set)
Free CPU set set.
- hwloc_cpuset_t hwloc_cpuset_dup (hwloc_cpuset_t set)
Duplicate CPU set set by allocating a new CPU set and copying its contents.
- void hwloc_cpuset_copy (hwloc_cpuset_t dst, hwloc_cpuset_t src)
Copy the contents of CPU set src into the already allocated CPU set dst.
- int hwloc_cpuset_snprintf (char *restrict buf, size_t buflen,
hwloc_const_cpuset_t set)
Stringify a cpuset. - int hwloc_cpuset_asprintf (char **strp, hwloc_const_cpuset_t set)
Stringify a cpuset into a newly allocated string.
- hwloc_cpuset_t hwloc_cpuset_from_string (const char *restrict string)
Parse a cpuset string.
- void hwloc_cpuset_zero (hwloc_cpuset_t set)
Primitives & macros for building, modifying and consulting 'sets' of cpus.
- void hwloc_cpuset_fill (hwloc_cpuset_t set)
Fill CPU set set.
- void hwloc_cpuset_from_ulong (hwloc_cpuset_t set, unsigned long mask)
Setup CPU set set from unsigned long mask.
- void hwloc_cpuset_from_ith_ulong (hwloc_cpuset_t set, int i, unsigned
long mask)
Setup CPU set set from unsigned long mask used as i -th subset. - unsigned long hwloc_cpuset_to_ulong (hwloc_const_cpuset_t set)
Convert the beginning part of CPU set set into unsigned long mask.
- unsigned long hwloc_cpuset_to_ith_ulong (hwloc_const_cpuset_t set, int
i)
Convert the i -th subset of CPU set set into unsigned long mask. - void hwloc_cpuset_cpu (hwloc_cpuset_t set, unsigned cpu)
Clear CPU set set and set CPU cpu.
- void hwloc_cpuset_all_but_cpu (hwloc_cpuset_t set, unsigned cpu)
Clear CPU set set and set all but the CPU cpu.
- void hwloc_cpuset_set (hwloc_cpuset_t set, unsigned cpu)
Add CPU cpu in CPU set set.
- void hwloc_cpuset_set_range (hwloc_cpuset_t set, unsigned begincpu,
unsigned endcpu)
Add CPUs from begincpu to endcpu in CPU set set. - void hwloc_cpuset_clr (hwloc_cpuset_t set, unsigned cpu)
Remove CPU cpu from CPU set set.
- int hwloc_cpuset_isset (hwloc_const_cpuset_t set, unsigned cpu)
Test whether CPU cpu is part of set set.
- int hwloc_cpuset_iszero (hwloc_const_cpuset_t set)
Test whether set set is zero.
- int hwloc_cpuset_isfull (hwloc_const_cpuset_t set)
Test whether set set is full.
- int hwloc_cpuset_isequal (hwloc_const_cpuset_t set1,
hwloc_const_cpuset_t set2) Test whether set set1 is equal to set set2.
- int hwloc_cpuset_intersects (hwloc_const_cpuset_t set1,
hwloc_const_cpuset_t set2) Test whether sets set1 and set2 intersects.
- int hwloc_cpuset_isincluded (hwloc_const_cpuset_t sub_set,
hwloc_const_cpuset_t super_set) Test whether set sub_set is part of set super_set.
- void hwloc_cpuset_orset (hwloc_cpuset_t set, hwloc_const_cpuset_t
modifier_set)
Or set modifier_set into set set. - void hwloc_cpuset_andset (hwloc_cpuset_t set, hwloc_const_cpuset_t
modifier_set)
And set modifier_set into set set. - void hwloc_cpuset_clearset (hwloc_cpuset_t set, hwloc_const_cpuset_t
modifier_set)
Clear set modifier_set out of set set. - void hwloc_cpuset_xorset (hwloc_cpuset_t set, hwloc_const_cpuset_t
modifier_set)
Xor set set with set modifier_set. - int hwloc_cpuset_first (hwloc_const_cpuset_t set)
Compute the first CPU (least significant bit) in CPU set set.
- int hwloc_cpuset_last (hwloc_const_cpuset_t set)
Compute the last CPU (most significant bit) in CPU set set.
- void hwloc_cpuset_singlify (hwloc_cpuset_t set)
Keep a single CPU among those set in CPU set set.
- int hwloc_cpuset_compar_first (hwloc_const_cpuset_t set1,
hwloc_const_cpuset_t set2) Compar CPU sets set1 and set2 using their first set bit.
- int hwloc_cpuset_compar (hwloc_const_cpuset_t set1,
hwloc_const_cpuset_t set2) Compar CPU sets set1 and set2 using their last bits.
- int hwloc_cpuset_weight (hwloc_const_cpuset_t set)
Compute the weight of CPU set set.
Detailed Description
For use in hwloc itself, a hwloc_cpuset_t represents a set of logical
processors.
- Note:
- cpusets are indexed by OS logical processor number.
Define Documentation
- #define hwloc_cpuset_foreach_begin(cpu, set) Value:
- for (cpu = 0; cpu < HWLOC_NBMAXCPUS; cpu++) if (hwloc_cpuset_isset(set, cpu)) {
- Loop macro iterating on CPU set set. It yields on each cpu that is
member of the set. It uses variables set (the cpu set) and cpu (the
loop variable) - #define hwloc_cpuset_foreach_end() }
- End of loop. See also:
hwloc_cpuset_foreach_begin
Typedef Documentation
- typedef struct hwloc_cpuset_s* hwloc_const_cpuset_t typedef struct hwloc_cpuset_s* hwloc_cpuset_t
- Set of CPUs represented as an opaque pointer to an internal bitmask.
Function Documentation
- void hwloc_cpuset_all_but_cpu (hwloc_cpuset_t set, unsigned cpu)
- Clear CPU set set and set all but the CPU cpu.
- hwloc_cpuset_t hwloc_cpuset_alloc (void)
- Allocate a new empty CPU set.
- void hwloc_cpuset_andset (hwloc_cpuset_t set, hwloc_const_cpuset_t
- modifier_set)
And set modifier_set into set set. - int hwloc_cpuset_asprintf (char ** strp, hwloc_const_cpuset_t set)
- Stringify a cpuset into a newly allocated string. Returns:
the number of character that were actually written (not including
the ending \0). - void hwloc_cpuset_clearset (hwloc_cpuset_t set, hwloc_const_cpuset_t
- modifier_set)
Clear set modifier_set out of set set. - void hwloc_cpuset_clr (hwloc_cpuset_t set, unsigned cpu)
- Remove CPU cpu from CPU set set.
- int hwloc_cpuset_compar (hwloc_const_cpuset_t set1, hwloc_const_cpuset_t
- set2)
Compar CPU sets set1 and set2 using their last bits. Higher most
significant bit is higher. The empty CPU set is considered lower than
anything. - int hwloc_cpuset_compar_first (hwloc_const_cpuset_t set1,
- hwloc_const_cpuset_t set2) Compar CPU sets set1 and set2 using their first set bit. Smaller least significant bit is smaller. The empty CPU set is considered higher than anything.
- void hwloc_cpuset_copy (hwloc_cpuset_t dst, hwloc_cpuset_t src)
- Copy the contents of CPU set src into the already allocated CPU set
dst. - void hwloc_cpuset_cpu (hwloc_cpuset_t set, unsigned cpu)
- Clear CPU set set and set CPU cpu.
- hwloc_cpuset_t hwloc_cpuset_dup (hwloc_cpuset_t set)
- Duplicate CPU set set by allocating a new CPU set and copying its
contents. - void hwloc_cpuset_fill (hwloc_cpuset_t set)
- Fill CPU set set.
- int hwloc_cpuset_first (hwloc_const_cpuset_t set)
- Compute the first CPU (least significant bit) in CPU set set.
- void hwloc_cpuset_free (hwloc_cpuset_t set)
- Free CPU set set.
- void hwloc_cpuset_from_ith_ulong (hwloc_cpuset_t set, int i, unsigned long
- mask)
Setup CPU set set from unsigned long mask used as i -th subset. - hwloc_cpuset_t hwloc_cpuset_from_string (const char *restrict string)
- Parse a cpuset string. Must start and end with a digit.
- void hwloc_cpuset_from_ulong (hwloc_cpuset_t set, unsigned long mask)
- Setup CPU set set from unsigned long mask.
- int hwloc_cpuset_intersects (hwloc_const_cpuset_t set1,
- hwloc_const_cpuset_t set2) Test whether sets set1 and set2 intersects.
- int hwloc_cpuset_isequal (hwloc_const_cpuset_t set1, hwloc_const_cpuset_t
- set2)
Test whether set set1 is equal to set set2. - int hwloc_cpuset_isfull (hwloc_const_cpuset_t set)
- Test whether set set is full.
- int hwloc_cpuset_isincluded (hwloc_const_cpuset_t sub_set,
- hwloc_const_cpuset_t super_set) Test whether set sub_set is part of set super_set.
- int hwloc_cpuset_isset (hwloc_const_cpuset_t set, unsigned cpu)
- Test whether CPU cpu is part of set set.
- int hwloc_cpuset_iszero (hwloc_const_cpuset_t set)
- Test whether set set is zero.
- int hwloc_cpuset_last (hwloc_const_cpuset_t set)
- Compute the last CPU (most significant bit) in CPU set set.
- void hwloc_cpuset_orset (hwloc_cpuset_t set, hwloc_const_cpuset_t
- modifier_set)
Or set modifier_set into set set. - void hwloc_cpuset_set (hwloc_cpuset_t set, unsigned cpu)
- Add CPU cpu in CPU set set.
- void hwloc_cpuset_set_range (hwloc_cpuset_t set, unsigned begincpu,
- unsigned endcpu)
Add CPUs from begincpu to endcpu in CPU set set. - void hwloc_cpuset_singlify (hwloc_cpuset_t set)
- Keep a single CPU among those set in CPU set set. Might be used before binding so that the process does not have a chance of migrating between multiple logical CPUs in the original mask.
- int hwloc_cpuset_snprintf (char *restrict buf, size_t buflen,
- hwloc_const_cpuset_t set)
Stringify a cpuset. Up to buflen characters may be written in buffer
buf. - Returns:
the number of character that were actually written if not
truncating, or that would have been written (not including the
ending \0). - unsigned long hwloc_cpuset_to_ith_ulong (hwloc_const_cpuset_t set, int i)
- Convert the i -th subset of CPU set set into unsigned long mask.
- unsigned long hwloc_cpuset_to_ulong (hwloc_const_cpuset_t set)
- Convert the beginning part of CPU set set into unsigned long mask.
- int hwloc_cpuset_weight (hwloc_const_cpuset_t set)
- Compute the weight of CPU set set.
- void hwloc_cpuset_xorset (hwloc_cpuset_t set, hwloc_const_cpuset_t
- modifier_set)
Xor set set with set modifier_set. - void hwloc_cpuset_zero (hwloc_cpuset_t set)
- Primitives & macros for building, modifying and consulting 'sets' of
cpus. Empty CPU set set
Author
- Generated automatically by Doxygen for Hardware Locality (hwloc) from
the source code.