Hardware Locality (hwloc) 2.14.0

helper.h
1/*
2 * SPDX-License-Identifier: BSD-3-Clause
3 * Copyright © 2009 CNRS
4 * Copyright © 2009-2024 Inria. All rights reserved.
5 * Copyright © 2009-2012 Université Bordeaux
6 * Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
7 * See COPYING in top-level directory.
8 */
9
13
14#ifndef HWLOC_HELPER_H
15#define HWLOC_HELPER_H
16
17#ifndef HWLOC_H
18#error Please include the main hwloc.h instead
19#endif
20
21#include <stdlib.h>
22#include <errno.h>
23
24
25#ifdef __cplusplus
26 extern "C" {
27#endif
28
29
42
54HWLOC_DECLSPEC int
55 hwloc_obj_type_is_normal(hwloc_obj_type_t type);
56
65HWLOC_DECLSPEC int
66 hwloc_obj_type_is_io(hwloc_obj_type_t type);
67
76HWLOC_DECLSPEC int
77 hwloc_obj_type_is_memory(hwloc_obj_type_t type);
78
85HWLOC_DECLSPEC int
86 hwloc_obj_type_is_cache(hwloc_obj_type_t type);
87
94HWLOC_DECLSPEC int
95 hwloc_obj_type_is_dcache(hwloc_obj_type_t type);
96
103HWLOC_DECLSPEC int
104 hwloc_obj_type_is_icache(hwloc_obj_type_t type);
105
107
108
109
113
123 static __hwloc_inline hwloc_obj_t
124 hwloc_get_first_largest_obj_inside_cpuset(hwloc_topology_t topology, hwloc_const_cpuset_t set)
125{
126 hwloc_obj_t obj = hwloc_get_root_obj(topology);
127 if (!hwloc_bitmap_intersects(obj->cpuset, set))
128 return NULL;
129 while (!hwloc_bitmap_isincluded(obj->cpuset, set)) {
130 /* while the object intersects without being included, look at its children */
131 hwloc_obj_t child = obj->first_child;
132 while (child) {
133 if (hwloc_bitmap_intersects(child->cpuset, set))
134 break;
135 child = child->next_sibling;
136 }
137 if (!child)
138 /* no child intersects, return their father */
139 return obj;
140 /* found one intersecting child, look at its children */
141 obj = child;
142 }
143 /* obj is included, return it */
144 return obj;
145}
146
152HWLOC_DECLSPEC int hwloc_get_largest_objs_inside_cpuset (hwloc_topology_t topology, hwloc_const_cpuset_t set,
153 hwloc_obj_t * __hwloc_restrict objs, int max);
154
170 static __hwloc_inline hwloc_obj_t
171 hwloc_get_next_obj_inside_cpuset_by_depth (hwloc_topology_t topology, hwloc_const_cpuset_t set,
172 int depth, hwloc_obj_t prev)
173{
174 hwloc_obj_t next = hwloc_get_next_obj_by_depth(topology, depth, prev);
175 if (!next)
176 return NULL;
177 while (next && (hwloc_bitmap_iszero(next->cpuset) || !hwloc_bitmap_isincluded(next->cpuset, set)))
178 next = next->next_cousin;
179 return next;
180}
181
200 static __hwloc_inline hwloc_obj_t
201 hwloc_get_next_obj_inside_cpuset_by_type (hwloc_topology_t topology, hwloc_const_cpuset_t set,
202 hwloc_obj_type_t type, hwloc_obj_t prev)
203{
204 int depth = hwloc_get_type_depth(topology, type);
205 if (depth == HWLOC_TYPE_DEPTH_UNKNOWN || depth == HWLOC_TYPE_DEPTH_MULTIPLE)
206 return NULL;
207 return hwloc_get_next_obj_inside_cpuset_by_depth(topology, set, depth, prev);
208}
209
220 static __hwloc_inline hwloc_obj_t
221 hwloc_get_obj_inside_cpuset_by_depth (hwloc_topology_t topology, hwloc_const_cpuset_t set,
222 int depth, unsigned idx) __hwloc_attribute_pure;
223 static __hwloc_inline hwloc_obj_t
224 hwloc_get_obj_inside_cpuset_by_depth (hwloc_topology_t topology, hwloc_const_cpuset_t set,
225 int depth, unsigned idx)
226{
227 hwloc_obj_t obj = hwloc_get_obj_by_depth (topology, depth, 0);
228 unsigned count = 0;
229 if (!obj)
230 return NULL;
231 while (obj) {
232 if (!hwloc_bitmap_iszero(obj->cpuset) && hwloc_bitmap_isincluded(obj->cpuset, set)) {
233 if (count == idx)
234 return obj;
235 count++;
236 }
237 obj = obj->next_cousin;
238 }
239 return NULL;
240}
241
256 static __hwloc_inline hwloc_obj_t
257 hwloc_get_obj_inside_cpuset_by_type (hwloc_topology_t topology, hwloc_const_cpuset_t set,
258 hwloc_obj_type_t type, unsigned idx) __hwloc_attribute_pure;
259 static __hwloc_inline hwloc_obj_t
260 hwloc_get_obj_inside_cpuset_by_type (hwloc_topology_t topology, hwloc_const_cpuset_t set,
261 hwloc_obj_type_t type, unsigned idx)
262{
263 int depth = hwloc_get_type_depth(topology, type);
264 if (depth == HWLOC_TYPE_DEPTH_UNKNOWN || depth == HWLOC_TYPE_DEPTH_MULTIPLE)
265 return NULL;
266 return hwloc_get_obj_inside_cpuset_by_depth(topology, set, depth, idx);
267}
268
280 static __hwloc_inline unsigned
281 hwloc_get_nbobjs_inside_cpuset_by_depth (hwloc_topology_t topology, hwloc_const_cpuset_t set,
282 int depth) __hwloc_attribute_pure;
283 static __hwloc_inline unsigned
284 hwloc_get_nbobjs_inside_cpuset_by_depth (hwloc_topology_t topology, hwloc_const_cpuset_t set,
285 int depth)
286{
287 hwloc_obj_t obj = hwloc_get_obj_by_depth (topology, depth, 0);
288 unsigned count = 0;
289 if (!obj)
290 return 0;
291 while (obj) {
292 if (!hwloc_bitmap_iszero(obj->cpuset) && hwloc_bitmap_isincluded(obj->cpuset, set))
293 count++;
294 obj = obj->next_cousin;
295 }
296 return count;
297}
298
312 static __hwloc_inline int
313 hwloc_get_nbobjs_inside_cpuset_by_type (hwloc_topology_t topology, hwloc_const_cpuset_t set,
314 hwloc_obj_type_t type) __hwloc_attribute_pure;
315 static __hwloc_inline int
316 hwloc_get_nbobjs_inside_cpuset_by_type (hwloc_topology_t topology, hwloc_const_cpuset_t set,
317 hwloc_obj_type_t type)
318{
319 int depth = hwloc_get_type_depth(topology, type);
320 if (depth == HWLOC_TYPE_DEPTH_UNKNOWN)
321 return 0;
322 if (depth == HWLOC_TYPE_DEPTH_MULTIPLE)
323 return -1; /* FIXME: agregate nbobjs from different levels? */
324 return (int) hwloc_get_nbobjs_inside_cpuset_by_depth(topology, set, depth);
325}
326
343 static __hwloc_inline int
344 hwloc_get_obj_index_inside_cpuset (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_const_cpuset_t set,
345 hwloc_obj_t obj) __hwloc_attribute_pure;
346 static __hwloc_inline int
347 hwloc_get_obj_index_inside_cpuset (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_const_cpuset_t set,
348 hwloc_obj_t obj)
349{
350 int idx = 0;
351 if (!hwloc_bitmap_isincluded(obj->cpuset, set))
352 return -1;
353 /* count how many objects are inside the cpuset on the way from us to the beginning of the level */
354 while ((obj = obj->prev_cousin) != NULL)
355 if (!hwloc_bitmap_iszero(obj->cpuset) && hwloc_bitmap_isincluded(obj->cpuset, set))
356 idx++;
357 return idx;
358}
359
361
362
363
367
375 static __hwloc_inline hwloc_obj_t
376 hwloc_get_child_covering_cpuset (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_const_cpuset_t set,
377 hwloc_obj_t parent) __hwloc_attribute_pure;
378 static __hwloc_inline hwloc_obj_t
379 hwloc_get_child_covering_cpuset (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_const_cpuset_t set,
380 hwloc_obj_t parent)
381{
382 hwloc_obj_t child;
383 if (hwloc_bitmap_iszero(set))
384 return NULL;
385 child = parent->first_child;
386 while (child) {
387 if (child->cpuset && hwloc_bitmap_isincluded(set, child->cpuset))
388 return child;
389 child = child->next_sibling;
390 }
391 return NULL;
392}
393
399 static __hwloc_inline hwloc_obj_t
400 hwloc_get_obj_covering_cpuset (hwloc_topology_t topology, hwloc_const_cpuset_t set) __hwloc_attribute_pure;
401 static __hwloc_inline hwloc_obj_t
402 hwloc_get_obj_covering_cpuset (hwloc_topology_t topology, hwloc_const_cpuset_t set)
403{
404 struct hwloc_obj *current = hwloc_get_root_obj(topology);
405 if (hwloc_bitmap_iszero(set) || !hwloc_bitmap_isincluded(set, current->cpuset))
406 return NULL;
407 while (1) {
408 hwloc_obj_t child = hwloc_get_child_covering_cpuset(topology, set, current);
409 if (!child)
410 return current;
411 current = child;
412 }
413}
414
428 static __hwloc_inline hwloc_obj_t
429 hwloc_get_next_obj_covering_cpuset_by_depth(hwloc_topology_t topology, hwloc_const_cpuset_t set,
430 int depth, hwloc_obj_t prev)
431{
432 hwloc_obj_t next = hwloc_get_next_obj_by_depth(topology, depth, prev);
433 if (!next)
434 return NULL;
435 while (next && !hwloc_bitmap_intersects(set, next->cpuset))
436 next = next->next_cousin;
437 return next;
438}
439
456 static __hwloc_inline hwloc_obj_t
457 hwloc_get_next_obj_covering_cpuset_by_type(hwloc_topology_t topology, hwloc_const_cpuset_t set,
458 hwloc_obj_type_t type, hwloc_obj_t prev)
459{
460 int depth = hwloc_get_type_depth(topology, type);
461 if (depth == HWLOC_TYPE_DEPTH_UNKNOWN || depth == HWLOC_TYPE_DEPTH_MULTIPLE)
462 return NULL;
463 return hwloc_get_next_obj_covering_cpuset_by_depth(topology, set, depth, prev);
464}
465
467
468
469
478
489 static __hwloc_inline hwloc_obj_t
490 hwloc_get_ancestor_obj_by_depth (hwloc_topology_t topology __hwloc_attribute_unused, int depth, hwloc_obj_t obj) __hwloc_attribute_pure;
491 static __hwloc_inline hwloc_obj_t
492 hwloc_get_ancestor_obj_by_depth (hwloc_topology_t topology __hwloc_attribute_unused, int depth, hwloc_obj_t obj)
493{
494 hwloc_obj_t ancestor = obj;
495 if (obj->depth < depth)
496 return NULL;
497 while (ancestor && ancestor->depth > depth)
498 ancestor = ancestor->parent;
499 return ancestor;
500}
501
515 static __hwloc_inline hwloc_obj_t
516 hwloc_get_ancestor_obj_by_type (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_obj_type_t type, hwloc_obj_t obj) __hwloc_attribute_pure;
517 static __hwloc_inline hwloc_obj_t
518 hwloc_get_ancestor_obj_by_type (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_obj_type_t type, hwloc_obj_t obj)
519{
520 hwloc_obj_t ancestor = obj->parent;
521 while (ancestor && ancestor->type != type)
522 ancestor = ancestor->parent;
523 return ancestor;
524}
525
532 static __hwloc_inline hwloc_obj_t
533 hwloc_get_common_ancestor_obj (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_obj_t obj1, hwloc_obj_t obj2) __hwloc_attribute_pure;
534 static __hwloc_inline hwloc_obj_t
535 hwloc_get_common_ancestor_obj (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_obj_t obj1, hwloc_obj_t obj2)
536{
537 /* the loop isn't so easy since intermediate ancestors may have
538 * different depth, causing us to alternate between using obj1->parent
539 * and obj2->parent. Also, even if at some point we find ancestors of
540 * of the same depth, their ancestors may have different depth again.
541 */
542 while (obj1 != obj2) {
543 while (obj1->depth > obj2->depth)
544 obj1 = obj1->parent;
545 while (obj2->depth > obj1->depth)
546 obj2 = obj2->parent;
547 if (obj1 != obj2 && obj1->depth == obj2->depth) {
548 obj1 = obj1->parent;
549 obj2 = obj2->parent;
550 }
551 }
552 return obj1;
553}
554
562 static __hwloc_inline int
563 hwloc_obj_is_in_subtree (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_obj_t obj, hwloc_obj_t subtree_root) __hwloc_attribute_pure;
564 static __hwloc_inline int
565 hwloc_obj_is_in_subtree (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_obj_t obj, hwloc_obj_t subtree_root)
566{
567 return obj->cpuset && subtree_root->cpuset && hwloc_bitmap_isincluded(obj->cpuset, subtree_root->cpuset);
568}
569
580 static __hwloc_inline hwloc_obj_t
581 hwloc_get_next_child (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_obj_t parent, hwloc_obj_t prev)
582{
583 hwloc_obj_t obj;
584 int state = 0;
585 if (prev) {
586 if (prev->type == HWLOC_OBJ_MISC)
587 state = 3;
588 else if (hwloc_obj_type_is_io(prev->type))
589 state = 2;
590 else if (hwloc_obj_type_is_memory(prev->type))
591 state = 1;
592 obj = prev->next_sibling;
593 } else {
594 obj = parent->first_child;
595 }
596 if (!obj && state == 0) {
597 obj = parent->memory_first_child;
598 state = 1;
599 }
600 if (!obj && state == 1) {
601 obj = parent->io_first_child;
602 state = 2;
603 }
604 if (!obj && state == 2) {
605 obj = parent->misc_first_child;
606 state = 3;
607 }
608 return obj;
609}
610
612
613
614
618
642 static __hwloc_inline int
643 hwloc_get_cache_type_depth (hwloc_topology_t topology,
644 unsigned cachelevel, hwloc_obj_cache_type_t cachetype)
645{
646 int depth;
647 int found = HWLOC_TYPE_DEPTH_UNKNOWN;
648 for (depth=0; ; depth++) {
649 hwloc_obj_t obj = hwloc_get_obj_by_depth(topology, depth, 0);
650 if (!obj)
651 break;
652 if (!hwloc_obj_type_is_dcache(obj->type) || obj->attr->cache.depth != cachelevel)
653 /* doesn't match, try next depth */
654 continue;
655 if (cachetype == (hwloc_obj_cache_type_t) -1) {
656 if (found != HWLOC_TYPE_DEPTH_UNKNOWN) {
657 /* second match, return MULTIPLE */
658 return HWLOC_TYPE_DEPTH_MULTIPLE;
659 }
660 /* first match, mark it as found */
661 found = depth;
662 continue;
663 }
664 if (obj->attr->cache.type == cachetype || obj->attr->cache.type == HWLOC_OBJ_CACHE_UNIFIED)
665 /* exact match (either unified is alone, or we match instruction or data), return immediately */
666 return depth;
667 }
668 /* went to the bottom, return what we found */
669 return found;
670}
671
676 static __hwloc_inline hwloc_obj_t
677 hwloc_get_cache_covering_cpuset (hwloc_topology_t topology, hwloc_const_cpuset_t set) __hwloc_attribute_pure;
678 static __hwloc_inline hwloc_obj_t
679 hwloc_get_cache_covering_cpuset (hwloc_topology_t topology, hwloc_const_cpuset_t set)
680{
681 hwloc_obj_t current = hwloc_get_obj_covering_cpuset(topology, set);
682 while (current) {
683 if (hwloc_obj_type_is_dcache(current->type))
684 return current;
685 current = current->parent;
686 }
687 return NULL;
688}
689
695 static __hwloc_inline hwloc_obj_t
696 hwloc_get_shared_cache_covering_obj (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_obj_t obj) __hwloc_attribute_pure;
697 static __hwloc_inline hwloc_obj_t
698 hwloc_get_shared_cache_covering_obj (hwloc_topology_t topology __hwloc_attribute_unused, hwloc_obj_t obj)
699{
700 hwloc_obj_t current = obj->parent;
701 if (!obj->cpuset)
702 return NULL;
703 while (current) {
704 if (!hwloc_bitmap_isequal(current->cpuset, obj->cpuset)
705 && hwloc_obj_type_is_dcache(current->type))
706 return current;
707 current = current->parent;
708 }
709 return NULL;
710}
711
713
714
715
724
743HWLOC_DECLSPEC int hwloc_bitmap_singlify_per_core(hwloc_topology_t topology, hwloc_bitmap_t cpuset, unsigned which);
744
756 static __hwloc_inline hwloc_obj_t
757 hwloc_get_pu_obj_by_os_index(hwloc_topology_t topology, unsigned os_index) __hwloc_attribute_pure;
758 static __hwloc_inline hwloc_obj_t
759 hwloc_get_pu_obj_by_os_index(hwloc_topology_t topology, unsigned os_index)
760{
761 hwloc_obj_t obj = NULL;
762 while ((obj = hwloc_get_next_obj_by_type(topology, HWLOC_OBJ_PU, obj)) != NULL)
763 if (obj->os_index == os_index)
764 return obj;
765 return NULL;
766}
767
779 static __hwloc_inline hwloc_obj_t
780 hwloc_get_numanode_obj_by_os_index(hwloc_topology_t topology, unsigned os_index) __hwloc_attribute_pure;
781 static __hwloc_inline hwloc_obj_t
782 hwloc_get_numanode_obj_by_os_index(hwloc_topology_t topology, unsigned os_index)
783{
784 hwloc_obj_t obj = NULL;
785 while ((obj = hwloc_get_next_obj_by_type(topology, HWLOC_OBJ_NUMANODE, obj)) != NULL)
786 if (obj->os_index == os_index)
787 return obj;
788 return NULL;
789}
790
802/* TODO: rather provide an iterator? Provide a way to know how much should be allocated? By returning the total number of objects instead? */
803HWLOC_DECLSPEC unsigned hwloc_get_closest_objs (hwloc_topology_t topology, hwloc_obj_t src, hwloc_obj_t * __hwloc_restrict objs, unsigned max);
804
819 static __hwloc_inline hwloc_obj_t
820 hwloc_get_obj_below_by_type (hwloc_topology_t topology,
821 hwloc_obj_type_t type1, unsigned idx1,
822 hwloc_obj_type_t type2, unsigned idx2) __hwloc_attribute_pure;
823 static __hwloc_inline hwloc_obj_t
824 hwloc_get_obj_below_by_type (hwloc_topology_t topology,
825 hwloc_obj_type_t type1, unsigned idx1,
826 hwloc_obj_type_t type2, unsigned idx2)
827{
828 hwloc_obj_t obj;
829 obj = hwloc_get_obj_by_type (topology, type1, idx1);
830 if (!obj)
831 return NULL;
832 return hwloc_get_obj_inside_cpuset_by_type(topology, obj->cpuset, type2, idx2);
833}
834
855 static __hwloc_inline hwloc_obj_t
856 hwloc_get_obj_below_array_by_type (hwloc_topology_t topology, int nr, hwloc_obj_type_t *typev, unsigned *idxv) __hwloc_attribute_pure;
857 static __hwloc_inline hwloc_obj_t
858 hwloc_get_obj_below_array_by_type (hwloc_topology_t topology, int nr, hwloc_obj_type_t *typev, unsigned *idxv)
859{
860 hwloc_obj_t obj = hwloc_get_root_obj(topology);
861 int i;
862 for(i=0; i<nr; i++) {
863 if (!obj)
864 return NULL;
865 obj = hwloc_get_obj_inside_cpuset_by_type(topology, obj->cpuset, typev[i], idxv[i]);
866 }
867 return obj;
868}
869
908HWLOC_DECLSPEC hwloc_obj_t
909 hwloc_get_obj_with_same_locality(hwloc_topology_t topology, hwloc_obj_t src,
910 hwloc_obj_type_t type, const char *subtype, const char *nameprefix,
911 unsigned long flags);
912
914
915
916
920
923 enum hwloc_distrib_flags_e {
927 HWLOC_DISTRIB_FLAG_REVERSE = (1UL<<0)
928};
929
960 static __hwloc_inline int
961 hwloc_distrib(hwloc_topology_t topology,
962 hwloc_obj_t *roots, unsigned n_roots,
963 hwloc_cpuset_t *set,
964 unsigned n,
965 int until, unsigned long flags)
966{
967 unsigned i;
968 unsigned tot_weight;
969 unsigned given, givenweight;
970 hwloc_cpuset_t *cpusetp = set;
971
972 if (!n || (flags & ~HWLOC_DISTRIB_FLAG_REVERSE)) {
973 errno = EINVAL;
974 return -1;
975 }
976
977 tot_weight = 0;
978 for (i = 0; i < n_roots; i++)
979 tot_weight += (unsigned) hwloc_bitmap_weight(roots[i]->cpuset);
980
981 for (i = 0, given = 0, givenweight = 0; i < n_roots; i++) {
982 unsigned chunk, weight;
983 hwloc_obj_t root = roots[flags & HWLOC_DISTRIB_FLAG_REVERSE ? n_roots-1-i : i];
984 hwloc_cpuset_t cpuset = root->cpuset;
985 while (!hwloc_obj_type_is_normal(root->type))
986 /* If memory/io/misc, walk up to normal parent */
987 root = root->parent;
988 weight = (unsigned) hwloc_bitmap_weight(cpuset);
989 if (!weight)
990 continue;
991 /* Give to root a chunk proportional to its weight.
992 * If previous chunks got rounded-up, we may get a bit less. */
993 chunk = (( (givenweight+weight) * n + tot_weight-1) / tot_weight)
994 - (( givenweight * n + tot_weight-1) / tot_weight);
995 if (!root->arity || chunk <= 1 || root->depth >= until) {
996 /* We can't split any more, put everything there. */
997 if (chunk) {
998 /* Fill cpusets with ours */
999 unsigned j;
1000 for (j=0; j < chunk; j++)
1001 cpusetp[j] = hwloc_bitmap_dup(cpuset);
1002 } else {
1003 /* We got no chunk, just merge our cpuset to a previous one
1004 * (the first chunk cannot be empty)
1005 * so that this root doesn't get ignored.
1006 */
1007 assert(given);
1008 hwloc_bitmap_or(cpusetp[-1], cpusetp[-1], cpuset);
1009 }
1010 } else {
1011 /* Still more to distribute, recurse into children */
1012 hwloc_distrib(topology, root->children, root->arity, cpusetp, chunk, until, flags);
1013 }
1014 cpusetp += chunk;
1015 given += chunk;
1016 givenweight += weight;
1017 }
1018
1019 return 0;
1020}
1021
1023
1024
1025
1029
1041HWLOC_DECLSPEC hwloc_const_cpuset_t
1042 hwloc_topology_get_complete_cpuset(hwloc_topology_t topology) __hwloc_attribute_pure;
1043
1057HWLOC_DECLSPEC hwloc_const_cpuset_t
1058 hwloc_topology_get_topology_cpuset(hwloc_topology_t topology) __hwloc_attribute_pure;
1059
1078HWLOC_DECLSPEC hwloc_const_cpuset_t
1079 hwloc_topology_get_allowed_cpuset(hwloc_topology_t topology) __hwloc_attribute_pure;
1080
1092HWLOC_DECLSPEC hwloc_const_nodeset_t
1093 hwloc_topology_get_complete_nodeset(hwloc_topology_t topology) __hwloc_attribute_pure;
1094
1108HWLOC_DECLSPEC hwloc_const_nodeset_t
1109 hwloc_topology_get_topology_nodeset(hwloc_topology_t topology) __hwloc_attribute_pure;
1110
1129HWLOC_DECLSPEC hwloc_const_nodeset_t
1130 hwloc_topology_get_allowed_nodeset(hwloc_topology_t topology) __hwloc_attribute_pure;
1131
1133
1134
1135
1140
1155 static __hwloc_inline int
1156 hwloc_cpuset_to_nodeset(hwloc_topology_t topology, hwloc_const_cpuset_t _cpuset, hwloc_nodeset_t nodeset)
1157{
1158 int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NUMANODE);
1159 hwloc_obj_t obj = NULL;
1160 assert(depth != HWLOC_TYPE_DEPTH_UNKNOWN);
1161 hwloc_bitmap_zero(nodeset);
1162 while ((obj = hwloc_get_next_obj_covering_cpuset_by_depth(topology, _cpuset, depth, obj)) != NULL)
1163 if (hwloc_bitmap_set(nodeset, obj->os_index) < 0)
1164 return -1;
1165 return 0;
1166}
1167
1182 static __hwloc_inline int
1183 hwloc_cpuset_from_nodeset(hwloc_topology_t topology, hwloc_cpuset_t _cpuset, hwloc_const_nodeset_t nodeset)
1184{
1185 int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NUMANODE);
1186 hwloc_obj_t obj = NULL;
1187 assert(depth != HWLOC_TYPE_DEPTH_UNKNOWN);
1188 hwloc_bitmap_zero(_cpuset);
1189 while ((obj = hwloc_get_next_obj_by_depth(topology, depth, obj)) != NULL) {
1190 if (hwloc_bitmap_isset(nodeset, obj->os_index))
1191 /* no need to check obj->cpuset because objects in levels always have a cpuset */
1192 if (hwloc_bitmap_or(_cpuset, _cpuset, obj->cpuset) < 0)
1193 return -1;
1194 }
1195 return 0;
1196}
1197
1199
1200
1201
1205
1221 static __hwloc_inline hwloc_obj_t
1222 hwloc_get_non_io_ancestor_obj(hwloc_topology_t topology __hwloc_attribute_unused,
1223 hwloc_obj_t ioobj)
1224{
1225 hwloc_obj_t obj = ioobj;
1226 while (obj && !obj->cpuset) {
1227 obj = obj->parent;
1228 }
1229 return obj;
1230}
1231
1238 static __hwloc_inline hwloc_obj_t
1239 hwloc_get_next_pcidev(hwloc_topology_t topology, hwloc_obj_t prev)
1240{
1241 return hwloc_get_next_obj_by_type(topology, HWLOC_OBJ_PCI_DEVICE, prev);
1242}
1243
1249 static __hwloc_inline hwloc_obj_t
1250 hwloc_get_pcidev_by_busid(hwloc_topology_t topology,
1251 unsigned domain, unsigned bus, unsigned dev, unsigned func)
1252{
1253 hwloc_obj_t obj = NULL;
1254 while ((obj = hwloc_get_next_pcidev(topology, obj)) != NULL) {
1255 if (obj->attr->pcidev.domain == domain
1256 && obj->attr->pcidev.bus == bus
1257 && obj->attr->pcidev.dev == dev
1258 && obj->attr->pcidev.func == func)
1259 return obj;
1260 }
1261 return NULL;
1262}
1263
1269 static __hwloc_inline hwloc_obj_t
1270 hwloc_get_pcidev_by_busidstring(hwloc_topology_t topology, const char *busid)
1271{
1272 unsigned domain = 0; /* default */
1273 unsigned bus, dev, func;
1274
1275 if (sscanf(busid, "%x:%x.%x", &bus, &dev, &func) != 3
1276 && sscanf(busid, "%x:%x:%x.%x", &domain, &bus, &dev, &func) != 4) {
1277 errno = EINVAL;
1278 return NULL;
1279 }
1280
1281 return hwloc_get_pcidev_by_busid(topology, domain, bus, dev, func);
1282}
1283
1290 static __hwloc_inline hwloc_obj_t
1291 hwloc_get_next_osdev(hwloc_topology_t topology, hwloc_obj_t prev)
1292{
1293 return hwloc_get_next_obj_by_type(topology, HWLOC_OBJ_OS_DEVICE, prev);
1294}
1295
1302 static __hwloc_inline hwloc_obj_t
1303 hwloc_get_next_bridge(hwloc_topology_t topology, hwloc_obj_t prev)
1304{
1305 return hwloc_get_next_obj_by_type(topology, HWLOC_OBJ_BRIDGE, prev);
1306}
1307
1308/* \brief Checks whether a given bridge covers a given PCI bus.
1309 *
1310 * \return 1 if it covers, 0 if not.
1311 */
1312 static __hwloc_inline int
1313 hwloc_bridge_covers_pcibus(hwloc_obj_t bridge,
1314 unsigned domain, unsigned bus)
1315{
1316 return bridge->type == HWLOC_OBJ_BRIDGE
1317 && bridge->attr->bridge.downstream_type == HWLOC_OBJ_BRIDGE_PCI
1318 && bridge->attr->bridge.downstream.pci.domain == domain
1319 && bridge->attr->bridge.downstream.pci.secondary_bus <= bus
1320 && bridge->attr->bridge.downstream.pci.subordinate_bus >= bus;
1321}
1322
1324
1325
1326
1327#ifdef __cplusplus
1328} /* extern "C" */
1329#endif
1330
1331
1332#endif /* HWLOC_HELPER_H */
hwloc_const_cpuset_t
hwloc_const_bitmap_t hwloc_const_cpuset_t
A non-modifiable hwloc_cpuset_t.
Definition hwloc.h:167
hwloc_const_nodeset_t
hwloc_const_bitmap_t hwloc_const_nodeset_t
A non-modifiable hwloc_nodeset_t.
Definition hwloc.h:186
hwloc_nodeset_t
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_cpuset_t
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_cache_type_t
enum hwloc_obj_cache_type_e hwloc_obj_cache_type_t
Cache type.
hwloc_obj_type_t
hwloc_obj_type_t
Type of topology object.
Definition hwloc.h:202
HWLOC_OBJ_BRIDGE_PCI
@ HWLOC_OBJ_BRIDGE_PCI
PCI-side of a bridge.
Definition hwloc.h:373
HWLOC_OBJ_CACHE_UNIFIED
@ HWLOC_OBJ_CACHE_UNIFIED
Unified cache.
Definition hwloc.h:365
HWLOC_OBJ_MISC
@ HWLOC_OBJ_MISC
Miscellaneous objects (filtered out by default). Objects without particular meaning,...
Definition hwloc.h:321
HWLOC_OBJ_OS_DEVICE
@ HWLOC_OBJ_OS_DEVICE
Operating system device (filtered out by default).
Definition hwloc.h:310
HWLOC_OBJ_PCI_DEVICE
@ HWLOC_OBJ_PCI_DEVICE
PCI device (filtered out by default).
Definition hwloc.h:300
HWLOC_OBJ_BRIDGE
@ HWLOC_OBJ_BRIDGE
Bridge (filtered out by default). Any bridge (or PCI switch) that connects the host or an I/O bus,...
Definition hwloc.h:288
HWLOC_OBJ_NUMANODE
@ HWLOC_OBJ_NUMANODE
NUMA node. An object that contains memory that is directly and byte-accessible to the host processors...
Definition hwloc.h:262
HWLOC_OBJ_PU
@ HWLOC_OBJ_PU
Processing Unit, or (Logical) Processor. An execution unit (may share a core with some other logical ...
Definition hwloc.h:227
hwloc_obj_t
struct hwloc_obj * hwloc_obj_t
Convenience typedef; a pointer to a struct hwloc_obj.
Definition hwloc.h:637
hwloc_topology_t
struct hwloc_topology * hwloc_topology_t
Topology context.
Definition hwloc.h:748
hwloc_get_obj_by_type
hwloc_obj_t hwloc_get_obj_by_type(hwloc_topology_t topology, hwloc_obj_type_t type, unsigned idx)
Returns the topology object at logical index idx with type type.
hwloc_get_obj_by_depth
hwloc_obj_t hwloc_get_obj_by_depth(hwloc_topology_t topology, int depth, unsigned idx)
Returns the topology object at logical index idx from depth depth.
hwloc_get_next_obj_by_depth
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.
hwloc_get_next_obj_by_type
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.
hwloc_get_type_depth
int hwloc_get_type_depth(hwloc_topology_t topology, hwloc_obj_type_t type)
Returns the depth of objects of type type.
hwloc_get_root_obj
hwloc_obj_t hwloc_get_root_obj(hwloc_topology_t topology)
Returns the top-object of the topology-tree.
HWLOC_TYPE_DEPTH_UNKNOWN
@ HWLOC_TYPE_DEPTH_UNKNOWN
No object of given type exists in the topology.
Definition hwloc.h:885
HWLOC_TYPE_DEPTH_MULTIPLE
@ HWLOC_TYPE_DEPTH_MULTIPLE
Objects of given type exist at different depth in the topology (only for Groups).
Definition hwloc.h:886
hwloc_obj_type_is_memory
int hwloc_obj_type_is_memory(hwloc_obj_type_t type)
Check whether an object type is Memory.
hwloc_obj_type_is_cache
int hwloc_obj_type_is_cache(hwloc_obj_type_t type)
Check whether an object type is a CPU Cache (Data, Unified or Instruction).
hwloc_obj_type_is_dcache
int hwloc_obj_type_is_dcache(hwloc_obj_type_t type)
Check whether an object type is a CPU Data or Unified Cache.
hwloc_obj_type_is_normal
int hwloc_obj_type_is_normal(hwloc_obj_type_t type)
Check whether an object type is Normal.
hwloc_obj_type_is_icache
int hwloc_obj_type_is_icache(hwloc_obj_type_t type)
Check whether an object type is a CPU Instruction Cache,.
hwloc_obj_type_is_io
int hwloc_obj_type_is_io(hwloc_obj_type_t type)
Check whether an object type is I/O.
hwloc_get_largest_objs_inside_cpuset
int hwloc_get_largest_objs_inside_cpuset(hwloc_topology_t topology, hwloc_const_cpuset_t set, hwloc_obj_t *restrict objs, int max)
Get the set of largest objects covering exactly a given cpuset set.
hwloc_get_obj_inside_cpuset_by_depth
hwloc_obj_t hwloc_get_obj_inside_cpuset_by_depth(hwloc_topology_t topology, hwloc_const_cpuset_t set, int depth, unsigned idx)
Return the (logically) idx -th object at depth depth included in CPU set set.
Definition helper.h:224
hwloc_get_obj_index_inside_cpuset
int hwloc_get_obj_index_inside_cpuset(hwloc_topology_t topology, hwloc_const_cpuset_t set, hwloc_obj_t obj)
Return the logical index among the objects included in CPU set set.
Definition helper.h:347
hwloc_get_nbobjs_inside_cpuset_by_type
int hwloc_get_nbobjs_inside_cpuset_by_type(hwloc_topology_t topology, hwloc_const_cpuset_t set, hwloc_obj_type_t type)
Return the number of objects of type type included in CPU set set.
Definition helper.h:316
hwloc_get_first_largest_obj_inside_cpuset
hwloc_obj_t hwloc_get_first_largest_obj_inside_cpuset(hwloc_topology_t topology, hwloc_const_cpuset_t set)
Get the first largest object included in the given cpuset set.
Definition helper.h:124
hwloc_get_nbobjs_inside_cpuset_by_depth
unsigned hwloc_get_nbobjs_inside_cpuset_by_depth(hwloc_topology_t topology, hwloc_const_cpuset_t set, int depth)
Return the number of objects at depth depth included in CPU set set.
Definition helper.h:284
hwloc_get_next_obj_inside_cpuset_by_type
hwloc_obj_t hwloc_get_next_obj_inside_cpuset_by_type(hwloc_topology_t topology, hwloc_const_cpuset_t set, hwloc_obj_type_t type, hwloc_obj_t prev)
Return the next object of type type included in CPU set set.
Definition helper.h:201
hwloc_get_next_obj_inside_cpuset_by_depth
hwloc_obj_t hwloc_get_next_obj_inside_cpuset_by_depth(hwloc_topology_t topology, hwloc_const_cpuset_t set, int depth, hwloc_obj_t prev)
Return the next object at depth depth included in CPU set set.
Definition helper.h:171
hwloc_get_obj_inside_cpuset_by_type
hwloc_obj_t hwloc_get_obj_inside_cpuset_by_type(hwloc_topology_t topology, hwloc_const_cpuset_t set, hwloc_obj_type_t type, unsigned idx)
Return the idx -th object of type type included in CPU set set.
Definition helper.h:260
hwloc_get_child_covering_cpuset
hwloc_obj_t hwloc_get_child_covering_cpuset(hwloc_topology_t topology, hwloc_const_cpuset_t set, hwloc_obj_t parent)
Get the child covering at least CPU set set.
Definition helper.h:379
hwloc_get_obj_covering_cpuset
hwloc_obj_t hwloc_get_obj_covering_cpuset(hwloc_topology_t topology, hwloc_const_cpuset_t set)
Get the lowest object covering at least CPU set set.
Definition helper.h:402
hwloc_get_next_obj_covering_cpuset_by_depth
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_get_next_obj_covering_cpuset_by_type
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:457
hwloc_obj_is_in_subtree
int hwloc_obj_is_in_subtree(hwloc_topology_t topology, hwloc_obj_t obj, hwloc_obj_t subtree_root)
Returns true if obj is inside the subtree beginning with ancestor object subtree_root.
Definition helper.h:565
hwloc_get_next_child
hwloc_obj_t hwloc_get_next_child(hwloc_topology_t topology, hwloc_obj_t parent, hwloc_obj_t prev)
Return the next child.
Definition helper.h:581
hwloc_get_ancestor_obj_by_type
hwloc_obj_t hwloc_get_ancestor_obj_by_type(hwloc_topology_t topology, hwloc_obj_type_t type, hwloc_obj_t obj)
Returns the ancestor object of obj with type type.
Definition helper.h:518
hwloc_get_ancestor_obj_by_depth
hwloc_obj_t hwloc_get_ancestor_obj_by_depth(hwloc_topology_t topology, int depth, hwloc_obj_t obj)
Returns the ancestor object of obj at depth depth.
Definition helper.h:492
hwloc_get_common_ancestor_obj
hwloc_obj_t hwloc_get_common_ancestor_obj(hwloc_topology_t topology, hwloc_obj_t obj1, hwloc_obj_t obj2)
Returns the common parent object to objects obj1 and obj2.
Definition helper.h:535
hwloc_get_shared_cache_covering_obj
hwloc_obj_t hwloc_get_shared_cache_covering_obj(hwloc_topology_t topology, hwloc_obj_t obj)
Get the first data (or unified) cache shared between an object and somebody else.
Definition helper.h:698
hwloc_get_cache_type_depth
int hwloc_get_cache_type_depth(hwloc_topology_t topology, unsigned cachelevel, hwloc_obj_cache_type_t cachetype)
Find the depth of cache objects matching cache level and type.
Definition helper.h:643
hwloc_get_cache_covering_cpuset
hwloc_obj_t hwloc_get_cache_covering_cpuset(hwloc_topology_t topology, hwloc_const_cpuset_t set)
Get the first data (or unified) cache covering a cpuset set.
Definition helper.h:679
hwloc_bitmap_singlify_per_core
int hwloc_bitmap_singlify_per_core(hwloc_topology_t topology, hwloc_bitmap_t cpuset, unsigned which)
Remove simultaneous multithreading PUs from a CPU set.
hwloc_get_closest_objs
unsigned hwloc_get_closest_objs(hwloc_topology_t topology, hwloc_obj_t src, hwloc_obj_t *restrict objs, unsigned max)
Do a depth-first traversal of the topology to find and sort.
hwloc_get_obj_below_by_type
hwloc_obj_t hwloc_get_obj_below_by_type(hwloc_topology_t topology, hwloc_obj_type_t type1, unsigned idx1, hwloc_obj_type_t type2, unsigned idx2)
Find an object below another object, both specified by types and indexes.
Definition helper.h:824
hwloc_get_obj_with_same_locality
hwloc_obj_t hwloc_get_obj_with_same_locality(hwloc_topology_t topology, hwloc_obj_t src, hwloc_obj_type_t type, const char *subtype, const char *nameprefix, unsigned long flags)
Return an object of a different type with same locality.
hwloc_get_pu_obj_by_os_index
hwloc_obj_t hwloc_get_pu_obj_by_os_index(hwloc_topology_t topology, unsigned os_index)
Returns the object of type HWLOC_OBJ_PU with os_index.
Definition helper.h:759
hwloc_get_numanode_obj_by_os_index
hwloc_obj_t hwloc_get_numanode_obj_by_os_index(hwloc_topology_t topology, unsigned os_index)
Returns the object of type HWLOC_OBJ_NUMANODE with os_index.
Definition helper.h:782
hwloc_get_obj_below_array_by_type
hwloc_obj_t hwloc_get_obj_below_array_by_type(hwloc_topology_t topology, int nr, hwloc_obj_type_t *typev, unsigned *idxv)
Find an object below a chain of objects specified by types and indexes.
Definition helper.h:858
hwloc_distrib_flags_e
hwloc_distrib_flags_e
Flags to be given to hwloc_distrib().
Definition helper.h:923
hwloc_distrib
int hwloc_distrib(hwloc_topology_t topology, hwloc_obj_t *roots, unsigned n_roots, hwloc_cpuset_t *set, unsigned n, int until, unsigned long flags)
Distribute n items over the topology under roots.
Definition helper.h:961
HWLOC_DISTRIB_FLAG_REVERSE
@ HWLOC_DISTRIB_FLAG_REVERSE
Distrib in reverse order, starting from the last objects.
Definition helper.h:927
hwloc_topology_get_allowed_nodeset
hwloc_const_nodeset_t hwloc_topology_get_allowed_nodeset(hwloc_topology_t topology)
Get allowed node set.
hwloc_topology_get_topology_nodeset
hwloc_const_nodeset_t hwloc_topology_get_topology_nodeset(hwloc_topology_t topology)
Get topology node set.
hwloc_topology_get_allowed_cpuset
hwloc_const_cpuset_t hwloc_topology_get_allowed_cpuset(hwloc_topology_t topology)
Get allowed CPU set.
hwloc_topology_get_complete_nodeset
hwloc_const_nodeset_t hwloc_topology_get_complete_nodeset(hwloc_topology_t topology)
Get complete node set.
hwloc_topology_get_topology_cpuset
hwloc_const_cpuset_t hwloc_topology_get_topology_cpuset(hwloc_topology_t topology)
Get topology CPU set.
hwloc_topology_get_complete_cpuset
hwloc_const_cpuset_t hwloc_topology_get_complete_cpuset(hwloc_topology_t topology)
Get complete CPU set.
hwloc_cpuset_to_nodeset
int hwloc_cpuset_to_nodeset(hwloc_topology_t topology, hwloc_const_cpuset_t _cpuset, hwloc_nodeset_t nodeset)
Convert a CPU set into a NUMA node set.
Definition helper.h:1156
hwloc_cpuset_from_nodeset
int hwloc_cpuset_from_nodeset(hwloc_topology_t topology, hwloc_cpuset_t _cpuset, hwloc_const_nodeset_t nodeset)
Convert a NUMA node set into a CPU set.
Definition helper.h:1183
hwloc_get_pcidev_by_busid
hwloc_obj_t hwloc_get_pcidev_by_busid(hwloc_topology_t topology, unsigned domain, unsigned bus, unsigned dev, unsigned func)
Find the PCI device object matching the PCI bus id given domain, bus device and function PCI bus id.
Definition helper.h:1250
hwloc_get_next_bridge
hwloc_obj_t hwloc_get_next_bridge(hwloc_topology_t topology, hwloc_obj_t prev)
Get the next bridge in the system.
Definition helper.h:1303
hwloc_get_next_osdev
hwloc_obj_t hwloc_get_next_osdev(hwloc_topology_t topology, hwloc_obj_t prev)
Get the next OS device in the system.
Definition helper.h:1291
hwloc_get_next_pcidev
hwloc_obj_t hwloc_get_next_pcidev(hwloc_topology_t topology, hwloc_obj_t prev)
Get the next PCI device in the system.
Definition helper.h:1239
hwloc_get_non_io_ancestor_obj
hwloc_obj_t hwloc_get_non_io_ancestor_obj(hwloc_topology_t topology, hwloc_obj_t ioobj)
Get the first non-I/O ancestor object.
Definition helper.h:1222
hwloc_bridge_covers_pcibus
int hwloc_bridge_covers_pcibus(hwloc_obj_t bridge, unsigned domain, unsigned bus)
Definition helper.h:1313
hwloc_get_pcidev_by_busidstring
hwloc_obj_t hwloc_get_pcidev_by_busidstring(hwloc_topology_t topology, const char *busid)
Find the PCI device object matching the PCI bus id given as a string xxxx:yy:zz.t or yy:zz....
Definition helper.h:1270
hwloc_bitmap_weight
int hwloc_bitmap_weight(hwloc_const_bitmap_t bitmap)
Compute the "weight" of bitmap bitmap (i.e., number of indexes that are in the bitmap).
hwloc_bitmap_isincluded
int hwloc_bitmap_isincluded(hwloc_const_bitmap_t sub_bitmap, hwloc_const_bitmap_t super_bitmap)
Test whether bitmap sub_bitmap is part of bitmap super_bitmap.
hwloc_bitmap_set
int hwloc_bitmap_set(hwloc_bitmap_t bitmap, unsigned id)
Add index id in bitmap bitmap.
hwloc_bitmap_isset
int hwloc_bitmap_isset(hwloc_const_bitmap_t bitmap, unsigned id)
Test whether index id is part of bitmap bitmap.
hwloc_bitmap_or
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.
hwloc_bitmap_isequal
int hwloc_bitmap_isequal(hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2)
Test whether bitmap bitmap1 is equal to bitmap bitmap2.
hwloc_bitmap_iszero
int hwloc_bitmap_iszero(hwloc_const_bitmap_t bitmap)
Test whether bitmap bitmap is empty.
hwloc_bitmap_t
struct hwloc_bitmap_s * hwloc_bitmap_t
Set of bits represented as an opaque pointer to an internal bitmap.
Definition bitmap.h:70
hwloc_bitmap_zero
void hwloc_bitmap_zero(hwloc_bitmap_t bitmap)
Empty the bitmap bitmap.
hwloc_bitmap_dup
hwloc_bitmap_t hwloc_bitmap_dup(hwloc_const_bitmap_t bitmap)
Duplicate bitmap bitmap by allocating a new bitmap and copying bitmap contents.
hwloc_bitmap_intersects
int hwloc_bitmap_intersects(hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2)
Test whether bitmaps bitmap1 and bitmap2 intersects.
hwloc_obj
Structure of a topology object.
Definition hwloc.h:437
hwloc_obj::children
struct hwloc_obj ** children
Normal children, children[0 .. arity -1].
Definition hwloc.h:497
hwloc_obj::nodeset
hwloc_nodeset_t nodeset
NUMA nodes covered by this object or containing this object.
Definition hwloc.h:581
hwloc_obj::depth
int depth
Vertical index in the hierarchy.
Definition hwloc.h:460
hwloc_obj::misc_first_child
struct hwloc_obj * misc_first_child
First Misc child. Misc objects are listed here (misc_arity and misc_first_child) instead of in the no...
Definition hwloc.h:546
hwloc_obj::subtype
char * subtype
Subtype string to better describe the type field.
Definition hwloc.h:440
hwloc_obj::os_index
unsigned os_index
OS-provided physical index number. It is not guaranteed unique across the entire machine,...
Definition hwloc.h:442
hwloc_obj::cpuset
hwloc_cpuset_t cpuset
CPUs covered by this object.
Definition hwloc.h:553
hwloc_obj::next_sibling
struct hwloc_obj * next_sibling
Next object below the same parent (inside the same list of children).
Definition hwloc.h:489
hwloc_obj::next_cousin
struct hwloc_obj * next_cousin
Next object of same type and depth.
Definition hwloc.h:483
hwloc_obj::io_first_child
struct hwloc_obj * io_first_child
First I/O child. Bridges, PCI and OS devices are listed here (io_arity and io_first_child) instead of...
Definition hwloc.h:534
hwloc_obj::arity
unsigned arity
Number of normal children. Memory, Misc and I/O children are not listed here but rather in their dedi...
Definition hwloc.h:493
hwloc_obj::memory_first_child
struct hwloc_obj * memory_first_child
First Memory child. NUMA nodes and Memory-side caches are listed here (memory_arity and memory_first_...
Definition hwloc.h:516
hwloc_obj::prev_cousin
struct hwloc_obj * prev_cousin
Previous object of same type and depth.
Definition hwloc.h:484
hwloc_obj::type
hwloc_obj_type_t type
Type of object.
Definition hwloc.h:439
hwloc_obj::attr
union hwloc_obj_attr_u * attr
Object type-specific Attributes, may be NULL if no attribute value was found.
Definition hwloc.h:456
hwloc_obj::parent
struct hwloc_obj * parent
Parent, NULL if root (Machine object).
Definition hwloc.h:487
hwloc_obj::first_child
struct hwloc_obj * first_child
First normal child.
Definition hwloc.h:498
hwloc_obj_attr_u::pcidev
struct hwloc_obj_attr_u::hwloc_pcidev_attr_s pcidev
hwloc_obj_attr_u::bridge
struct hwloc_obj_attr_u::hwloc_bridge_attr_s bridge
hwloc_obj_attr_u::cache
struct hwloc_obj_attr_u::hwloc_cache_attr_s cache
hwloc_obj_attr_u::hwloc_cache_attr_s::depth
unsigned depth
Depth of cache (e.g., L1, L2, ...etc.).
Definition hwloc.h:659
hwloc_obj_attr_u::hwloc_cache_attr_s::type
hwloc_obj_cache_type_t type
Cache type.
Definition hwloc.h:663
hwloc_obj_attr_u::hwloc_pcidev_attr_s::dev
unsigned char dev
Device number (zz in the PCI BDF notation xxxx:yy:zz.t).
Definition hwloc.h:683
hwloc_obj_attr_u::hwloc_pcidev_attr_s::func
unsigned char func
Function number (t in the PCI BDF notation xxxx:yy:zz.t).
Definition hwloc.h:684
hwloc_obj_attr_u::hwloc_pcidev_attr_s::domain
unsigned short domain
Domain number (xxxx in the PCI BDF notation xxxx:yy:zz.t). Only 16bits PCI domains are supported by d...
Definition hwloc.h:676
hwloc_obj_attr_u::hwloc_pcidev_attr_s::bus
unsigned char bus
Bus number (yy in the PCI BDF notation xxxx:yy:zz.t).
Definition hwloc.h:682
hwloc_obj_attr_u::hwloc_bridge_attr_s::downstream
union hwloc_obj_attr_u::hwloc_bridge_attr_s::@255166366313070227124320376131062113240135013336 downstream
hwloc_obj_attr_u::hwloc_bridge_attr_s::pci
struct hwloc_pcidev_attr_s pci
PCI attribute of the upstream part as a PCI device.
Definition hwloc.h:701
hwloc_obj_attr_u::hwloc_bridge_attr_s::downstream_type
hwloc_obj_bridge_type_t downstream_type
Downstream Bridge type.
Definition hwloc.h:717