Open MPI logo

Portable Hardware Locality (hwloc) Documentation: v1.0.3

  |   Home   |   Support   |   FAQ   |  

cpuset.h File Reference

The Cpuset API, for use in hwloc itself. More...

#include <hwloc/config.h>

Go to the source code of this file.

Defines

#define hwloc_cpuset_foreach_begin(cpu, set)
 Loop macro iterating on CPU set set.
#define hwloc_cpuset_foreach_end()
 End of loop. Needs a terminating ';'.

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_const_cpuset_t set)
 Duplicate CPU set set by allocating a new CPU set and copying set's contents.
void hwloc_cpuset_copy (hwloc_cpuset_t dst, hwloc_const_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.
int hwloc_cpuset_from_string (hwloc_cpuset_t set, const char *restrict string)
 Parse a cpuset string and stores it in CPU set set.
void hwloc_cpuset_zero (hwloc_cpuset_t set)
 Empty the CPU set set.
void hwloc_cpuset_fill (hwloc_cpuset_t set)
 Fill CPU set set with all possible CPUs (even if those CPUs don't exist or are otherwise unavailable).
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, unsigned 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, unsigned i)
 Convert the i -th subset of CPU set set into unsigned long mask.
void hwloc_cpuset_cpu (hwloc_cpuset_t set, unsigned cpu)
 Empty the CPU set set and add CPU cpu.
void hwloc_cpuset_all_but_cpu (hwloc_cpuset_t set, unsigned cpu)
 Empty the CPU set set and add 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.
void hwloc_cpuset_clr_range (hwloc_cpuset_t set, unsigned begincpu, unsigned endcpu)
 Remove CPUs from begincpu to endcpu in 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 empty.
int hwloc_cpuset_isfull (hwloc_const_cpuset_t set)
 Test whether set set is completely 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_or (hwloc_cpuset_t res, hwloc_const_cpuset_t set1, hwloc_const_cpuset_t set2)
 Or sets set1 and set2 and store the result in set res.
void hwloc_cpuset_and (hwloc_cpuset_t res, hwloc_const_cpuset_t set1, hwloc_const_cpuset_t set2)
 And sets set1 and set2 and store the result in set res.
void hwloc_cpuset_andnot (hwloc_cpuset_t res, hwloc_const_cpuset_t set1, hwloc_const_cpuset_t set2)
 And set set1 and the negation of set2 and store the result in set res.
void hwloc_cpuset_xor (hwloc_cpuset_t res, hwloc_const_cpuset_t set1, hwloc_const_cpuset_t set2)
 Xor sets set1 and set2 and store the result in set res.
void hwloc_cpuset_not (hwloc_cpuset_t res, hwloc_const_cpuset_t set)
 Negate set set and store the result in set res.
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.
int hwloc_cpuset_next (hwloc_const_cpuset_t set, unsigned prev_cpu)
 Compute the next CPU in CPU set set which is after CPU prev_cpu.
void hwloc_cpuset_singlify (hwloc_cpuset_t set)
 Keep a single CPU among those set in CPU set set.
int hwloc_cpuset_compare_first (hwloc_const_cpuset_t set1, hwloc_const_cpuset_t set2)
 Compare CPU sets set1 and set2 using their lowest index CPU.
int hwloc_cpuset_compare (hwloc_const_cpuset_t set1, hwloc_const_cpuset_t set2)
 Compare CPU sets set1 and set2 using their highest index CPU.
int hwloc_cpuset_weight (hwloc_const_cpuset_t set)
 Compute the "weight" of CPU set set (i.e., number of CPUs that are in the set).

Detailed Description

The Cpuset API, for use in hwloc itself.