16 #ifndef HWLOC_LINUX_LIBNUMA_H
17 #define HWLOC_LINUX_LIBNUMA_H
60 static __hwloc_inline
int
62 unsigned long *mask,
unsigned long *maxnode)
65 unsigned long outmaxnode = -1;
69 *maxnode = (*maxnode + 8*
sizeof(*mask) - 1) & ~(8*
sizeof(*mask) - 1);
70 memset(mask, 0, *maxnode/8);
75 mask[node->
os_index/
sizeof(*mask)/8] |= 1UL << (node->
os_index % (
sizeof(*mask)*8));
76 if (outmaxnode == (
unsigned long) -1 || outmaxnode < node->
os_index)
80 *maxnode = outmaxnode+1;
96 static __hwloc_inline
int
98 unsigned long *mask,
unsigned long *maxnode)
101 unsigned long outmaxnode = -1;
105 *maxnode = (*maxnode + 8*
sizeof(*mask) - 1) & ~(8*
sizeof(*mask) - 1);
106 memset(mask, 0, *maxnode/8);
113 mask[node->
os_index/
sizeof(*mask)/8] |= 1UL << (node->
os_index % (
sizeof(*mask)*8));
114 if (outmaxnode == (
unsigned long) -1 || outmaxnode < node->
os_index)
118 *maxnode = outmaxnode+1;
134 static __hwloc_inline
int
136 const unsigned long *mask,
unsigned long maxnode)
143 && (mask[node->
os_index/
sizeof(*mask)/8] & (1UL << (node->
os_index % (
sizeof(*mask)*8)))))
161 static __hwloc_inline
int
163 const unsigned long *mask,
unsigned long maxnode)
170 && (mask[node->
os_index/
sizeof(*mask)/8] & (1UL << (node->
os_index % (
sizeof(*mask)*8)))))
208 static __hwloc_inline
struct bitmask *
210 static __hwloc_inline
struct bitmask *
215 struct bitmask *bitmask = numa_allocate_cpumask();
220 numa_bitmask_setbit(bitmask, node->
os_index);
233 static __hwloc_inline
struct bitmask *
235 static __hwloc_inline
struct bitmask *
240 struct bitmask *bitmask = numa_allocate_cpumask();
245 numa_bitmask_setbit(bitmask, node->
os_index);
257 static __hwloc_inline
int
259 const struct bitmask *bitmask)
265 if (numa_bitmask_isbitset(bitmask, node->
os_index))
279 static __hwloc_inline
int
281 const struct bitmask *bitmask)
287 if (numa_bitmask_isbitset(bitmask, node->
os_index))
int hwloc_bitmap_set(hwloc_bitmap_t bitmap, unsigned id)
Add index id in bitmap bitmap.
int hwloc_bitmap_isset(hwloc_const_bitmap_t bitmap, unsigned id)
Test whether index id is part of bitmap bitmap.
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.
void hwloc_bitmap_zero(hwloc_bitmap_t bitmap)
Empty the bitmap bitmap.
struct hwloc_topology * hwloc_topology_t
Topology context.
Definition: hwloc.h:783
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:429
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.
int hwloc_get_type_depth(hwloc_topology_t topology, hwloc_obj_type_t type)
Returns the depth of objects of type type.
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:211
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:280
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:258
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:236
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:97
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:135
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:162
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:61
hwloc_const_bitmap_t hwloc_const_cpuset_t
A non-modifiable hwloc_cpuset_t.
Definition: hwloc.h:167
hwloc_const_bitmap_t hwloc_const_nodeset_t
A non-modifiable hwloc_nodeset_t.
Definition: hwloc.h:186
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:183
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:165
@ HWLOC_OBJ_NUMANODE
NUMA node. An object that contains memory that is directly and byte-accessible to the host processors...
Definition: hwloc.h:273
hwloc_uint64_t local_memory
Local memory (in bytes)
Definition: hwloc.h:705
Structure of a topology object.
Definition: hwloc.h:492
unsigned os_index
OS-provided physical index number. It is not guaranteed unique across the entire machine,...
Definition: hwloc.h:497
hwloc_cpuset_t cpuset
CPUs covered by this object.
Definition: hwloc.h:608
union hwloc_obj_attr_u * attr
Object type-specific Attributes, may be NULL if no attribute value was found.
Definition: hwloc.h:511
struct hwloc_obj_attr_u::hwloc_numanode_attr_s numanode