15 #ifndef HWLOC_LINUX_LIBNUMA_H 16 #define HWLOC_LINUX_LIBNUMA_H 54 static __hwloc_inline
int 56 unsigned long *mask,
unsigned long *maxnode)
59 unsigned long outmaxnode = -1;
63 *maxnode = (*maxnode + 8*
sizeof(*mask) - 1) & ~(8*
sizeof(*mask) - 1);
64 memset(mask, 0, *maxnode/8);
69 mask[node->
os_index/
sizeof(*mask)/8] |= 1UL << (node->
os_index % (
sizeof(*mask)*8));
70 if (outmaxnode == (
unsigned long) -1 || outmaxnode < node->os_index)
74 *maxnode = outmaxnode+1;
88 static __hwloc_inline
int 90 unsigned long *mask,
unsigned long *maxnode)
93 unsigned long outmaxnode = -1;
97 *maxnode = (*maxnode + 8*
sizeof(*mask) - 1) & ~(8*
sizeof(*mask) - 1);
98 memset(mask, 0, *maxnode/8);
105 mask[node->
os_index/
sizeof(*mask)/8] |= 1UL << (node->
os_index % (
sizeof(*mask)*8));
106 if (outmaxnode == (
unsigned long) -1 || outmaxnode < node->os_index)
110 *maxnode = outmaxnode+1;
123 static __hwloc_inline
int 125 const unsigned long *mask,
unsigned long maxnode)
132 && (mask[node->
os_index/
sizeof(*mask)/8] & (1UL << (node->
os_index % (
sizeof(*mask)*8)))))
146 static __hwloc_inline
int 148 const unsigned long *mask,
unsigned long maxnode)
155 && (mask[node->
os_index/
sizeof(*mask)/8] & (1UL << (node->
os_index % (
sizeof(*mask)*8)))))
189 static __hwloc_inline
struct bitmask *
191 static __hwloc_inline
struct bitmask *
196 struct bitmask *bitmask = numa_allocate_cpumask();
201 numa_bitmask_setbit(bitmask, node->
os_index);
214 static __hwloc_inline
struct bitmask *
216 static __hwloc_inline
struct bitmask *
221 struct bitmask *bitmask = numa_allocate_cpumask();
226 numa_bitmask_setbit(bitmask, node->
os_index);
235 static __hwloc_inline
int 237 const struct bitmask *bitmask)
243 if (numa_bitmask_isbitset(bitmask, node->
os_index))
253 static __hwloc_inline
int 255 const struct bitmask *bitmask)
261 if (numa_bitmask_isbitset(bitmask, node->
os_index))
static hwloc_obj_t hwloc_get_next_obj_by_depth(hwloc_topology_t topology, int depth, hwloc_obj_t prev)
Returns the next object at depth depth.
struct hwloc_obj_attr_u::hwloc_numanode_attr_s numanode
int hwloc_get_type_depth(hwloc_topology_t topology, hwloc_obj_type_t type)
Returns the depth of objects of type type.
struct hwloc_topology * hwloc_topology_t
Topology context.
Definition: hwloc.h:667
hwloc_const_bitmap_t hwloc_const_cpuset_t
A non-modifiable hwloc_cpuset_t.
Definition: hwloc.h:142
static int hwloc_cpuset_from_linux_libnuma_ulongs(hwloc_topology_t topology, hwloc_cpuset_t cpuset, const unsigned long *mask, unsigned long maxnode)
Convert the array of unsigned long mask into hwloc CPU set.
Definition: linux-libnuma.h:124
hwloc_bitmap_t hwloc_nodeset_t
A node set is a bitmap whose bits are set according to NUMA memory node physical OS indexes...
Definition: hwloc.h:157
int hwloc_bitmap_or(hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2)
Or bitmaps bitmap1 and bitmap2 and store the result in bitmap res.
static int hwloc_cpuset_to_linux_libnuma_ulongs(hwloc_topology_t topology, hwloc_const_cpuset_t cpuset, unsigned long *mask, unsigned long *maxnode)
Convert hwloc CPU set cpuset into the array of unsigned long mask.
Definition: linux-libnuma.h:55
union hwloc_obj_attr_u * attr
Object type-specific Attributes, may be NULL if no attribute value was found.
Definition: hwloc.h:400
static int hwloc_nodeset_from_linux_libnuma_ulongs(hwloc_topology_t topology, hwloc_nodeset_t nodeset, const unsigned long *mask, unsigned long maxnode)
Convert the array of unsigned long mask into hwloc NUMA node set.
Definition: linux-libnuma.h:147
int hwloc_bitmap_set(hwloc_bitmap_t bitmap, unsigned id)
Add index id in bitmap bitmap.
static struct bitmask * hwloc_nodeset_to_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset)
Convert hwloc NUMA node set nodeset into the returned libnuma bitmask.
Definition: linux-libnuma.h:217
static struct bitmask * hwloc_cpuset_to_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_const_cpuset_t cpuset)
Convert hwloc CPU set cpuset into the returned libnuma bitmask.
Definition: linux-libnuma.h:192
unsigned os_index
OS-provided physical index number. It is not guaranteed unique across the entire machine, except for PUs and NUMA nodes. Set to HWLOC_UNKNOWN_INDEX if unknown or irrelevant for this object.
Definition: hwloc.h:386
Structure of a topology object.
Definition: hwloc.h:381
void hwloc_bitmap_zero(hwloc_bitmap_t bitmap)
Empty the bitmap bitmap.
hwloc_cpuset_t cpuset
CPUs covered by this object.
Definition: hwloc.h:497
hwloc_bitmap_t hwloc_cpuset_t
A CPU set is a bitmap whose bits are set according to CPU physical OS indexes.
Definition: hwloc.h:140
hwloc_const_bitmap_t hwloc_const_nodeset_t
A non-modifiable hwloc_nodeset_t.
Definition: hwloc.h:160
NUMA node. An object that contains memory that is directly and byte-accessible to the host processors...
Definition: hwloc.h:232
static int hwloc_cpuset_from_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_cpuset_t cpuset, const struct bitmask *bitmask)
Convert libnuma bitmask bitmask into hwloc CPU set cpuset.
Definition: linux-libnuma.h:236
static hwloc_obj_t hwloc_get_next_obj_covering_cpuset_by_depth(hwloc_topology_t topology, hwloc_const_cpuset_t set, int depth, hwloc_obj_t prev)
Iterate through same-depth objects covering at least CPU set set.
Definition: helper.h:321
static int hwloc_nodeset_to_linux_libnuma_ulongs(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset, unsigned long *mask, unsigned long *maxnode)
Convert hwloc NUMA node set nodeset into the array of unsigned long mask.
Definition: linux-libnuma.h:89
hwloc_uint64_t local_memory
Local memory (in bytes)
Definition: hwloc.h:585
static int hwloc_nodeset_from_linux_libnuma_bitmask(hwloc_topology_t topology, hwloc_nodeset_t nodeset, const struct bitmask *bitmask)
Convert libnuma bitmask bitmask into hwloc NUMA node set nodeset.
Definition: linux-libnuma.h:254
int hwloc_bitmap_isset(hwloc_const_bitmap_t bitmap, unsigned id)
Test whether index id is part of bitmap bitmap.