24 #ifndef HWLOC_LINUX_LIBNUMA_H
25 #define HWLOC_LINUX_LIBNUMA_H
51 static __hwloc_inline
int
53 unsigned long *mask,
unsigned long *maxnode)
56 unsigned long outmaxnode = -1;
59 *maxnode = (*maxnode + 8*
sizeof(*mask) - 1) & ~(8*
sizeof(*mask) - 1);
60 memset(mask, 0, *maxnode/8);
67 mask[node->
os_index/
sizeof(*mask)/8] |= 1UL << (node->
os_index % (
sizeof(*mask)*8));
68 if (outmaxnode == (
unsigned long) -1 || outmaxnode < node->os_index)
80 *maxnode = outmaxnode+1;
94 static __hwloc_inline
int
96 unsigned long *mask,
unsigned long *maxnode)
99 unsigned long outmaxnode = -1;
102 *maxnode = (*maxnode + 8*
sizeof(*mask) - 1) & ~(8*
sizeof(*mask) - 1);
103 memset(mask, 0, *maxnode/8);
112 mask[node->
os_index/
sizeof(*mask)/8] |= 1UL << (node->
os_index % (
sizeof(*mask)*8));
113 if (outmaxnode == (
unsigned long) -1 || outmaxnode < node->os_index)
125 *maxnode = outmaxnode+1;
138 static __hwloc_inline
int
140 const unsigned long *mask,
unsigned long maxnode)
148 for(i=0; i<maxnode; i++)
149 if (mask[i/
sizeof(*mask)/8] & (1UL << (i% (
sizeof(*mask)*8)))) {
174 static __hwloc_inline
int
176 const unsigned long *mask,
unsigned long maxnode)
184 for(i=0; i<maxnode; i++)
185 if (mask[i/
sizeof(*mask)/8] & (1UL << (i% (
sizeof(*mask)*8)))) {
219 static __hwloc_inline
struct bitmask * __hwloc_attribute_malloc
223 struct bitmask *bitmask = numa_allocate_cpumask();
231 numa_bitmask_setbit(bitmask, node->
os_index);
235 numa_bitmask_setbit(bitmask, 0);
250 static __hwloc_inline
struct bitmask * __hwloc_attribute_malloc
254 struct bitmask *bitmask = numa_allocate_cpumask();
262 numa_bitmask_setbit(bitmask, node->
os_index);
266 numa_bitmask_setbit(bitmask, 0);
277 static __hwloc_inline
int
279 const struct bitmask *bitmask)
287 for(i=0; i<NUMA_NUM_NODES; i++)
288 if (numa_bitmask_isbitset(bitmask, i)) {
295 if (numa_bitmask_isbitset(bitmask, 0))
309 static __hwloc_inline
int
311 const struct bitmask *bitmask)
319 for(i=0; i<NUMA_NUM_NODES; i++)
320 if (numa_bitmask_isbitset(bitmask, i)) {
327 if (numa_bitmask_isbitset(bitmask, 0))
340 #ifdef NUMA_VERSION1_COMPATIBILITY
351 static __hwloc_inline
int
353 nodemask_t *nodemask)
357 nodemask_zero(nodemask);
362 nodemask_set(nodemask, node->
os_index);
366 nodemask_set(nodemask, 0);
377 static __hwloc_inline
int
379 nodemask_t *nodemask)
383 nodemask_zero(nodemask);
389 nodemask_set(nodemask, node->
os_index);
393 nodemask_set(nodemask, 0);
404 static __hwloc_inline
int
406 const nodemask_t *nodemask)
414 for(i=0; i<NUMA_NUM_NODES; i++)
415 if (nodemask_isset(nodemask, i)) {
422 if (nodemask_isset(nodemask, 0))
436 static __hwloc_inline
int
438 const nodemask_t *nodemask)
446 for(i=0; i<NUMA_NUM_NODES; i++)
447 if (nodemask_isset(nodemask, i)) {
454 if (nodemask_isset(nodemask, 0))
HWLOC_DECLSPEC void hwloc_bitmap_zero(hwloc_bitmap_t bitmap)
Empty the bitmap bitmap.
HWLOC_DECLSPEC void hwloc_bitmap_copy(hwloc_bitmap_t dst, hwloc_const_bitmap_t src)
Copy the contents of bitmap src into the already allocated bitmap dst.
unsigned os_index
OS-provided physical index number.
Definition: hwloc.h:332
HWLOC_DECLSPEC int hwloc_bitmap_iszero(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure
Test whether bitmap bitmap is empty.
static __hwloc_inline struct bitmask *__hwloc_attribute_malloc 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:251
struct hwloc_obj_memory_s memory
Memory attributes.
Definition: hwloc.h:335
static __hwloc_inline 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:52
HWLOC_DECLSPEC int hwloc_bitmap_isset(hwloc_const_bitmap_t bitmap, unsigned id) __hwloc_attribute_pure
Test whether index id is part of bitmap bitmap.
static __hwloc_inline hwloc_const_cpuset_t __hwloc_attribute_pure hwloc_topology_get_complete_cpuset(hwloc_topology_t topology)
Get complete CPU set.
Definition: helper.h:729
static __hwloc_inline 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:95
hwloc_uint64_t local_memory
Local memory (in bytes)
Definition: hwloc.h:311
static __hwloc_inline 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:310
static __hwloc_inline struct bitmask *__hwloc_attribute_malloc 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:220
static __hwloc_inline hwloc_obj_t hwloc_get_next_obj_covering_cpuset_by_type(hwloc_topology_t topology, hwloc_const_cpuset_t set, hwloc_obj_type_t type, hwloc_obj_t prev)
Iterate through same-type objects covering at least CPU set set.
Definition: helper.h:475
Structure of a topology object.
Definition: hwloc.h:329
NUMA node.
Definition: hwloc.h:184
static __hwloc_inline 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:139
static __hwloc_inline hwloc_obj_t hwloc_get_next_obj_by_type(hwloc_topology_t topology, hwloc_obj_type_t type, hwloc_obj_t prev)
Returns the next object of type type.
Definition: helper.h:158
static __hwloc_inline 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:175
HWLOC_DECLSPEC void hwloc_bitmap_fill(hwloc_bitmap_t bitmap)
Fill bitmap bitmap with all possible indexes (even if those objects don't exist or are otherwise unav...
HWLOC_DECLSPEC void hwloc_bitmap_set(hwloc_bitmap_t bitmap, unsigned id)
Add index id in bitmap bitmap.
static __hwloc_inline 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:278
HWLOC_DECLSPEC void 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.
hwloc_cpuset_t cpuset
CPUs covered by this object.
Definition: hwloc.h:366
HWLOC_DECLSPEC hwloc_obj_t hwloc_get_obj_by_depth(hwloc_topology_t topology, unsigned depth, unsigned idx) __hwloc_attribute_pure
Returns the topology object at logical index idx from depth depth.