20#if KMP_AFFINITY_SUPPORTED
22class KMPHwlocAffinity :
public KMPAffinity {
24 class Mask :
public KMPAffinity::Mask {
29 mask = hwloc_bitmap_alloc();
32 ~Mask() { hwloc_bitmap_free(
mask); }
33 void set(
int i)
override { hwloc_bitmap_set(
mask,
i); }
34 bool is_set(
int i)
const override {
return hwloc_bitmap_isset(
mask,
i); }
35 void clear(
int i)
override { hwloc_bitmap_clr(
mask,
i); }
36 void zero()
override { hwloc_bitmap_zero(
mask); }
37 bool empty()
const override {
return hwloc_bitmap_iszero(
mask); }
38 void copy(
const KMPAffinity::Mask *src)
override {
39 const Mask *convert =
static_cast<const Mask *
>(src);
40 hwloc_bitmap_copy(
mask, convert->mask);
42 void bitwise_and(
const KMPAffinity::Mask *rhs)
override {
43 const Mask *convert =
static_cast<const Mask *
>(rhs);
44 hwloc_bitmap_and(
mask,
mask, convert->mask);
46 void bitwise_or(
const KMPAffinity::Mask *rhs)
override {
47 const Mask *convert =
static_cast<const Mask *
>(rhs);
48 hwloc_bitmap_or(
mask,
mask, convert->mask);
50 void bitwise_not()
override { hwloc_bitmap_not(
mask,
mask); }
51 bool is_equal(
const KMPAffinity::Mask *rhs)
const override {
52 const Mask *convert =
static_cast<const Mask *
>(rhs);
53 return hwloc_bitmap_isequal(
mask, convert->mask);
55 int begin()
const override {
return hwloc_bitmap_first(
mask); }
56 int end()
const override {
return -1; }
57 int next(
int previous)
const override {
58 return hwloc_bitmap_next(
mask, previous);
60 int get_system_affinity(
bool abort_on_error)
override {
62 "Illegal get affinity operation when not capable");
64 hwloc_get_cpubind(__kmp_hwloc_topology,
mask, HWLOC_CPUBIND_THREAD);
75 int set_system_affinity(
bool abort_on_error)
const override {
77 "Illegal set affinity operation when not capable");
79 hwloc_set_cpubind(__kmp_hwloc_topology,
mask, HWLOC_CPUBIND_THREAD);
91 int set_process_affinity(
bool abort_on_error)
const override {
93 "Illegal set process affinity operation when not capable");
95 const hwloc_topology_support *support =
96 hwloc_topology_get_support(__kmp_hwloc_topology);
97 if (support->cpubind->set_proc_cpubind) {
99 retval = hwloc_set_cpubind(__kmp_hwloc_topology,
mask,
100 HWLOC_CPUBIND_PROCESS);
111 int get_proc_group()
const override {
114 if (__kmp_num_proc_groups == 1) {
117 for (
int i = 0;
i < __kmp_num_proc_groups;
i++) {
119 unsigned long first_32_bits = hwloc_bitmap_to_ith_ulong(
mask,
i * 2);
120 unsigned long second_32_bits =
121 hwloc_bitmap_to_ith_ulong(
mask,
i * 2 + 1);
122 if (first_32_bits == 0 && second_32_bits == 0) {
134 void determine_capable(
const char *var)
override {
135 const hwloc_topology_support *topology_support;
136 if (__kmp_hwloc_topology == NULL) {
137 if (hwloc_topology_init(&__kmp_hwloc_topology) < 0) {
138 __kmp_hwloc_error =
TRUE;
139 if (__kmp_affinity.flags.verbose) {
140 KMP_WARNING(AffHwlocErrorOccurred, var,
"hwloc_topology_init()");
143 if (hwloc_topology_load(__kmp_hwloc_topology) < 0) {
144 __kmp_hwloc_error =
TRUE;
145 if (__kmp_affinity.flags.verbose) {
146 KMP_WARNING(AffHwlocErrorOccurred, var,
"hwloc_topology_load()");
150 topology_support = hwloc_topology_get_support(__kmp_hwloc_topology);
155 if (topology_support && topology_support->cpubind->set_thisthread_cpubind &&
156 topology_support->cpubind->get_thisthread_cpubind &&
157 topology_support->discovery->pu && !__kmp_hwloc_error) {
159 KMP_AFFINITY_ENABLE(
TRUE);
162 __kmp_hwloc_error =
TRUE;
163 KMP_AFFINITY_DISABLE();
166 void bind_thread(
int which)
override {
168 "Illegal set affinity operation when not capable");
169 KMPAffinity::Mask *
mask;
170 KMP_CPU_ALLOC_ON_STACK(
mask);
172 KMP_CPU_SET(which,
mask);
173 __kmp_set_system_affinity(
mask,
TRUE);
174 KMP_CPU_FREE_FROM_STACK(
mask);
176 KMPAffinity::Mask *allocate_mask()
override {
return new Mask(); }
177 void deallocate_mask(KMPAffinity::Mask *m)
override {
delete m; }
178 KMPAffinity::Mask *allocate_mask_array(
int num)
override {
179 return new Mask[num];
181 void deallocate_mask_array(KMPAffinity::Mask *array)
override {
182 Mask *hwloc_array =
static_cast<Mask *
>(array);
183 delete[] hwloc_array;
185 KMPAffinity::Mask *index_mask_array(KMPAffinity::Mask *array,
186 int index)
override {
187 Mask *hwloc_array =
static_cast<Mask *
>(array);
188 return &(hwloc_array[index]);
190 api_type get_api_type()
const override {
return HWLOC; }
194#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_DRAGONFLY || \
201#include <sys/syscall.h>
202#if KMP_ARCH_X86 || KMP_ARCH_ARM
203#ifndef __NR_sched_setaffinity
204#define __NR_sched_setaffinity 241
205#elif __NR_sched_setaffinity != 241
206#error Wrong code for setaffinity system call.
208#ifndef __NR_sched_getaffinity
209#define __NR_sched_getaffinity 242
210#elif __NR_sched_getaffinity != 242
211#error Wrong code for getaffinity system call.
213#elif KMP_ARCH_AARCH64
214#ifndef __NR_sched_setaffinity
215#define __NR_sched_setaffinity 122
216#elif __NR_sched_setaffinity != 122
217#error Wrong code for setaffinity system call.
219#ifndef __NR_sched_getaffinity
220#define __NR_sched_getaffinity 123
221#elif __NR_sched_getaffinity != 123
222#error Wrong code for getaffinity system call.
225#ifndef __NR_sched_setaffinity
226#define __NR_sched_setaffinity 203
227#elif __NR_sched_setaffinity != 203
228#error Wrong code for setaffinity system call.
230#ifndef __NR_sched_getaffinity
231#define __NR_sched_getaffinity 204
232#elif __NR_sched_getaffinity != 204
233#error Wrong code for getaffinity system call.
236#ifndef __NR_sched_setaffinity
237#define __NR_sched_setaffinity 222
238#elif __NR_sched_setaffinity != 222
239#error Wrong code for setaffinity system call.
241#ifndef __NR_sched_getaffinity
242#define __NR_sched_getaffinity 223
243#elif __NR_sched_getaffinity != 223
244#error Wrong code for getaffinity system call.
247#ifndef __NR_sched_setaffinity
248#define __NR_sched_setaffinity 4239
249#elif __NR_sched_setaffinity != 4239
250#error Wrong code for setaffinity system call.
252#ifndef __NR_sched_getaffinity
253#define __NR_sched_getaffinity 4240
254#elif __NR_sched_getaffinity != 4240
255#error Wrong code for getaffinity system call.
258#ifndef __NR_sched_setaffinity
259#define __NR_sched_setaffinity 5195
260#elif __NR_sched_setaffinity != 5195
261#error Wrong code for setaffinity system call.
263#ifndef __NR_sched_getaffinity
264#define __NR_sched_getaffinity 5196
265#elif __NR_sched_getaffinity != 5196
266#error Wrong code for getaffinity system call.
268#elif KMP_ARCH_LOONGARCH64
269#ifndef __NR_sched_setaffinity
270#define __NR_sched_setaffinity 122
271#elif __NR_sched_setaffinity != 122
272#error Wrong code for setaffinity system call.
274#ifndef __NR_sched_getaffinity
275#define __NR_sched_getaffinity 123
276#elif __NR_sched_getaffinity != 123
277#error Wrong code for getaffinity system call.
279#elif KMP_ARCH_RISCV64
280#ifndef __NR_sched_setaffinity
281#define __NR_sched_setaffinity 122
282#elif __NR_sched_setaffinity != 122
283#error Wrong code for setaffinity system call.
285#ifndef __NR_sched_getaffinity
286#define __NR_sched_getaffinity 123
287#elif __NR_sched_getaffinity != 123
288#error Wrong code for getaffinity system call.
291#ifndef __NR_sched_setaffinity
292#define __NR_sched_setaffinity 203
293#elif __NR_sched_setaffinity != 203
294#error Wrong code for setaffinity system call.
296#ifndef __NR_sched_getaffinity
297#define __NR_sched_getaffinity 204
298#elif __NR_sched_getaffinity != 204
299#error Wrong code for getaffinity system call.
302#ifndef __NR_sched_setaffinity
303#define __NR_sched_setaffinity 239
304#elif __NR_sched_setaffinity != 239
305#error Wrong code for setaffinity system call.
307#ifndef __NR_sched_getaffinity
308#define __NR_sched_getaffinity 240
309#elif __NR_sched_getaffinity != 240
310#error Wrong code for getaffinity system call.
313#error Unknown or unsupported architecture
315#elif KMP_OS_FREEBSD || KMP_OS_DRAGONFLY
317#include <pthread_np.h>
324#define VMI_MAXRADS 64
325#define GET_NUMBER_SMT_SETS 0x0004
326extern "C" int syssmt(
int flags,
int,
int,
int *);
328class KMPNativeAffinity :
public KMPAffinity {
329 class Mask :
public KMPAffinity::Mask {
330 typedef unsigned long mask_t;
331 typedef decltype(__kmp_affin_mask_size) mask_size_type;
332 static const unsigned int BITS_PER_MASK_T =
sizeof(mask_t) * CHAR_BIT;
333 static const mask_t ONE = 1;
334 mask_size_type get_num_mask_types()
const {
335 return __kmp_affin_mask_size /
sizeof(mask_t);
345 void set(
int i)
override {
346 mask[
i / BITS_PER_MASK_T] |= (ONE << (
i % BITS_PER_MASK_T));
348 bool is_set(
int i)
const override {
349 return (
mask[
i / BITS_PER_MASK_T] & (ONE << (
i % BITS_PER_MASK_T)));
351 void clear(
int i)
override {
352 mask[
i / BITS_PER_MASK_T] &= ~(ONE << (
i % BITS_PER_MASK_T));
354 void zero()
override {
355 mask_size_type e = get_num_mask_types();
356 for (mask_size_type
i = 0;
i < e; ++
i)
359 bool empty()
const override {
360 mask_size_type e = get_num_mask_types();
361 for (mask_size_type
i = 0;
i < e; ++
i)
362 if (
mask[
i] != (mask_t)0)
366 void copy(
const KMPAffinity::Mask *src)
override {
367 const Mask *convert =
static_cast<const Mask *
>(src);
368 mask_size_type e = get_num_mask_types();
369 for (mask_size_type
i = 0;
i < e; ++
i)
370 mask[
i] = convert->mask[
i];
372 void bitwise_and(
const KMPAffinity::Mask *rhs)
override {
373 const Mask *convert =
static_cast<const Mask *
>(rhs);
374 mask_size_type e = get_num_mask_types();
375 for (mask_size_type
i = 0;
i < e; ++
i)
376 mask[
i] &= convert->mask[
i];
378 void bitwise_or(
const KMPAffinity::Mask *rhs)
override {
379 const Mask *convert =
static_cast<const Mask *
>(rhs);
380 mask_size_type e = get_num_mask_types();
381 for (mask_size_type
i = 0;
i < e; ++
i)
382 mask[
i] |= convert->mask[
i];
384 void bitwise_not()
override {
385 mask_size_type e = get_num_mask_types();
386 for (mask_size_type
i = 0;
i < e; ++
i)
389 bool is_equal(
const KMPAffinity::Mask *rhs)
const override {
390 const Mask *convert =
static_cast<const Mask *
>(rhs);
391 mask_size_type e = get_num_mask_types();
392 for (mask_size_type
i = 0;
i < e; ++
i)
393 if (
mask[
i] != convert->mask[
i])
397 int begin()
const override {
399 while (retval <
end() && !is_set(retval))
403 int end()
const override {
408 int next(
int previous)
const override {
409 int retval = previous + 1;
410 while (retval <
end() && !is_set(retval))
417 int get_system_affinity(
bool abort_on_error)
override {
419 "Illegal get affinity operation when not capable");
421 (
void)abort_on_error;
425 KMP_CPU_SET(
i,
this);
428 int set_system_affinity(
bool abort_on_error)
const override {
431 "Illegal set affinity operation when not capable");
435 int tid = thread_self();
439 int retval = bindprocessor(BINDTHREAD, tid, PROCESSOR_CLASS_ANY);
443 KMP_CPU_SET_ITERATE(location,
this) {
444 if (KMP_CPU_ISSET(location,
this)) {
445 retval = bindprocessor(BINDTHREAD, tid, location);
446 if (retval == -1 && errno == 1) {
451 rsh = rs_alloc(RS_EMPTY);
452 rsid.at_pid = getpid();
453 if (RS_DEFAULT_RSET != ra_getrset(R_PROCESS, rsid, 0, rsh)) {
454 retval = ra_detachrset(R_PROCESS, rsid, 0);
455 retval = bindprocessor(BINDTHREAD, tid, location);
459 KA_TRACE(10, (
"__kmp_set_system_affinity: Done binding "
465 if (abort_on_error) {
468 KA_TRACE(10, (
"__kmp_set_system_affinity: Error binding "
469 "T#%d to cpu=%d, errno=%d.\n",
470 gtid, location, error));
478 int get_system_affinity(
bool abort_on_error)
override {
480 "Illegal get affinity operation when not capable");
483 syscall(__NR_sched_getaffinity, 0, __kmp_affin_mask_size,
mask);
484#elif KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_DRAGONFLY
485 int r = pthread_getaffinity_np(pthread_self(), __kmp_affin_mask_size,
486 reinterpret_cast<cpuset_t *
>(
mask));
487 int retval = (
r == 0 ? 0 : -1);
493 if (abort_on_error) {
499 int set_system_affinity(
bool abort_on_error)
const override {
501 "Illegal set affinity operation when not capable");
504 syscall(__NR_sched_setaffinity, 0, __kmp_affin_mask_size,
mask);
505#elif KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_DRAGONFLY
506 int r = pthread_setaffinity_np(pthread_self(), __kmp_affin_mask_size,
507 reinterpret_cast<cpuset_t *
>(
mask));
508 int retval = (
r == 0 ? 0 : -1);
514 if (abort_on_error) {
522 void determine_capable(
const char *env_var)
override {
526 KMPAffinity::Mask *allocate_mask()
override {
527 KMPNativeAffinity::Mask *retval =
new Mask();
530 void deallocate_mask(KMPAffinity::Mask *m)
override {
531 KMPNativeAffinity::Mask *native_mask =
532 static_cast<KMPNativeAffinity::Mask *
>(m);
535 KMPAffinity::Mask *allocate_mask_array(
int num)
override {
536 return new Mask[num];
538 void deallocate_mask_array(KMPAffinity::Mask *array)
override {
539 Mask *linux_array =
static_cast<Mask *
>(array);
540 delete[] linux_array;
542 KMPAffinity::Mask *index_mask_array(KMPAffinity::Mask *array,
543 int index)
override {
544 Mask *linux_array =
static_cast<Mask *
>(array);
545 return &(linux_array[index]);
547 api_type get_api_type()
const override {
return NATIVE_OS; }
553class KMPNativeAffinity :
public KMPAffinity {
554 class Mask :
public KMPAffinity::Mask {
555 typedef ULONG_PTR mask_t;
556 static const int BITS_PER_MASK_T =
sizeof(mask_t) * CHAR_BIT;
567 void set(
int i)
override {
568 mask[
i / BITS_PER_MASK_T] |= ((mask_t)1 << (
i % BITS_PER_MASK_T));
570 bool is_set(
int i)
const override {
571 return (
mask[
i / BITS_PER_MASK_T] & ((mask_t)1 << (
i % BITS_PER_MASK_T)));
573 void clear(
int i)
override {
574 mask[
i / BITS_PER_MASK_T] &= ~((mask_t)1 << (
i % BITS_PER_MASK_T));
576 void zero()
override {
577 for (
int i = 0;
i < __kmp_num_proc_groups; ++
i)
580 bool empty()
const override {
581 for (
size_t i = 0;
i < __kmp_num_proc_groups; ++
i)
586 void copy(
const KMPAffinity::Mask *src)
override {
587 const Mask *convert =
static_cast<const Mask *
>(src);
588 for (
int i = 0;
i < __kmp_num_proc_groups; ++
i)
589 mask[
i] = convert->mask[
i];
591 void bitwise_and(
const KMPAffinity::Mask *rhs)
override {
592 const Mask *convert =
static_cast<const Mask *
>(rhs);
593 for (
int i = 0;
i < __kmp_num_proc_groups; ++
i)
594 mask[
i] &= convert->mask[
i];
596 void bitwise_or(
const KMPAffinity::Mask *rhs)
override {
597 const Mask *convert =
static_cast<const Mask *
>(rhs);
598 for (
int i = 0;
i < __kmp_num_proc_groups; ++
i)
599 mask[
i] |= convert->mask[
i];
601 void bitwise_not()
override {
602 for (
int i = 0;
i < __kmp_num_proc_groups; ++
i)
605 bool is_equal(
const KMPAffinity::Mask *rhs)
const override {
606 const Mask *convert =
static_cast<const Mask *
>(rhs);
607 for (
size_t i = 0;
i < __kmp_num_proc_groups; ++
i)
608 if (
mask[
i] != convert->mask[
i])
612 int begin()
const override {
614 while (retval <
end() && !is_set(retval))
618 int end()
const override {
return __kmp_num_proc_groups * BITS_PER_MASK_T; }
619 int next(
int previous)
const override {
620 int retval = previous + 1;
621 while (retval <
end() && !is_set(retval))
625 int set_process_affinity(
bool abort_on_error)
const override {
626 if (__kmp_num_proc_groups <= 1) {
627 if (!SetProcessAffinityMask(GetCurrentProcess(), *
mask)) {
628 DWORD error = GetLastError();
629 if (abort_on_error) {
638 int set_system_affinity(
bool abort_on_error)
const override {
639 if (__kmp_num_proc_groups > 1) {
642 int group = get_proc_group();
644 if (abort_on_error) {
645 KMP_FATAL(AffinityInvalidMask,
"kmp_set_affinity");
652 ga.Mask =
mask[group];
653 ga.Reserved[0] = ga.Reserved[1] = ga.Reserved[2] = 0;
656 if (__kmp_SetThreadGroupAffinity(GetCurrentThread(), &ga, NULL) == 0) {
657 DWORD error = GetLastError();
658 if (abort_on_error) {
665 if (!SetThreadAffinityMask(GetCurrentThread(), *
mask)) {
666 DWORD error = GetLastError();
667 if (abort_on_error) {
676 int get_system_affinity(
bool abort_on_error)
override {
677 if (__kmp_num_proc_groups > 1) {
681 if (__kmp_GetThreadGroupAffinity(GetCurrentThread(), &ga) == 0) {
682 DWORD error = GetLastError();
683 if (abort_on_error) {
689 if ((ga.Group < 0) || (ga.Group > __kmp_num_proc_groups) ||
693 mask[ga.Group] = ga.Mask;
695 mask_t newMask, sysMask, retval;
696 if (!GetProcessAffinityMask(GetCurrentProcess(), &newMask, &sysMask)) {
697 DWORD error = GetLastError();
698 if (abort_on_error) {
704 retval = SetThreadAffinityMask(GetCurrentThread(), newMask);
706 DWORD error = GetLastError();
707 if (abort_on_error) {
713 newMask = SetThreadAffinityMask(GetCurrentThread(), retval);
715 DWORD error = GetLastError();
716 if (abort_on_error) {
725 int get_proc_group()
const override {
727 if (__kmp_num_proc_groups == 1) {
730 for (
int i = 0;
i < __kmp_num_proc_groups;
i++) {
740 void determine_capable(
const char *env_var)
override {
744 KMPAffinity::Mask *allocate_mask()
override {
return new Mask(); }
745 void deallocate_mask(KMPAffinity::Mask *m)
override {
delete m; }
746 KMPAffinity::Mask *allocate_mask_array(
int num)
override {
747 return new Mask[num];
749 void deallocate_mask_array(KMPAffinity::Mask *array)
override {
750 Mask *windows_array =
static_cast<Mask *
>(array);
751 delete[] windows_array;
753 KMPAffinity::Mask *index_mask_array(KMPAffinity::Mask *array,
754 int index)
override {
755 Mask *windows_array =
static_cast<Mask *
>(array);
756 return &(windows_array[index]);
758 api_type get_api_type()
const override {
return NATIVE_OS; }
813#if KMP_AFFINITY_SUPPORTED
814 bool contains(
const kmp_affinity_attrs_t &attr)
const {
815 if (!
valid && !attr.valid)
817 if (
valid && attr.valid) {
835#if KMP_AFFINITY_SUPPORTED
886 int num_core_efficiencies;
911#if KMP_GROUP_AFFINITY
913 void _insert_windows_proc_groups();
919 void _gather_enumeration_information();
923 void _remove_radix1_layers();
926 void _discover_uniformity();
937 void _set_last_level_cache();
942 int _get_ncores_with_attr(
const kmp_hw_attr_t &attr,
int above,
943 bool find_all =
false)
const;
959 return hw_threads[index];
963 return hw_threads[index];
976 void canonicalize(
int pkgs,
int cores_per_pkg,
int thr_per_core,
int cores);
980#if KMP_AFFINITY_SUPPORTED
982 void set_granularity(kmp_affinity_t &stgs)
const;
983 bool is_close(
int hwt1,
int hwt2,
const kmp_affinity_t &stgs)
const;
984 bool restrict_to_mask(
const kmp_affin_mask_t *
mask);
985 bool filter_hw_subset();
993 return equivalent[
type];
999 kmp_hw_t real_type2 = equivalent[type2];
1002 equivalent[type1] = real_type2;
1006 if (equivalent[
type] == type1) {
1007 equivalent[
type] = real_type2;
1023 return ratio[
level];
1028 return types[
level];
1032 int eq_type = equivalent[
type];
1035 for (
int i = 0;
i < depth; ++
i)
1036 if (types[
i] == eq_type)
1046 return _get_ncores_with_attr(attr, -1,
true);
1051 return _get_ncores_with_attr(attr, above,
false);
1054#if KMP_AFFINITY_SUPPORTED
1056 void sort_compact(kmp_affinity_t &affinity) {
1057 compact = affinity.compact;
1062 void print(
const char *env_var =
"KMP_AFFINITY")
const;
1080 const static int USE_ALL = (std::numeric_limits<int>::max)();
1092 static int hw_subset_compare(
const void *i1,
const void *i2) {
1097 return level1 - level2;
1109 int initial_capacity = 5;
1113 retval->capacity = initial_capacity;
1115 retval->absolute =
false;
1126 for (
int i = 0;
i < depth; ++
i) {
1131 if ((
size_t)idx >= MAX_ATTRS)
1133 items[
i].
num[idx] = num;
1134 items[
i].
offset[idx] = offset;
1135 items[
i].
attr[idx] = attr;
1139 if (depth == capacity - 1) {
1142 for (
int i = 0;
i < depth; ++
i)
1143 new_items[
i] = items[
i];
1149 items[depth].
num[0] = num;
1150 items[depth].
offset[0] = offset;
1151 items[depth].
attr[0] = attr;
1153 set |= (1ull <<
type);
1158 return items[index];
1162 return items[index];
1166 set &= ~(1ull << items[index].
type);
1167 for (
int j = index + 1;
j < depth; ++
j) {
1168 items[
j - 1] = items[
j];
1174 qsort(items, depth,
sizeof(
item_t), hw_subset_compare);
1222 printf(
"**********************\n");
1223 printf(
"*** kmp_hw_subset: ***\n");
1224 printf(
"* depth: %d\n", depth);
1225 printf(
"* items:\n");
1226 for (
int i = 0;
i < depth; ++
i) {
1229 printf(
" num: %d, offset: %d, attr: ", items[
i].num[
j],
1230 items[
i].offset[
j]);
1231 if (!items[
i].attr[
j]) {
1232 printf(
" (none)\n");
1235 " core_type = %s, core_eff = %d\n",
1237 items[
i].attr[
j].get_core_eff());
1241 printf(
"* set: 0x%llx\n", set);
1242 printf(
"* absolute: %d\n", absolute);
1243 printf(
"**********************\n");
1287 for (
int i = hier_depth - 1,
level = 0;
i >= 0; --
i, ++
level) {
1306 if (bool_result == 0) {
1361 branch = branch >> 1;
1379 while (bool_result == 0) {
1400 if (nproc > old_sz) {
1401 while (nproc > old_sz) {
kmp_uint32 * numPerLevel
Level 0 corresponds to leaves.
static const kmp_uint32 maxLeaves
kmp_uint32 * skipPerLevel
void resize(kmp_uint32 nproc)
kmp_uint32 base_num_threads
volatile kmp_int8 uninitialized
kmp_uint32 maxLevels
Number of levels in the hierarchy.
kmp_uint32 depth
This is specifically the depth of the machine configuration hierarchy, in terms of the number of leve...
volatile kmp_int8 resizing
static const kmp_uint32 minBranch
bool specified(kmp_hw_t type) const
void push_back(int num, kmp_hw_t type, int offset, kmp_hw_attr_t attr)
kmp_hw_subset_t(kmp_hw_subset_t &&t)=delete
void canonicalize(const kmp_topology_t *top)
static kmp_hw_subset_t * allocate()
static void deallocate(kmp_hw_subset_t *subset)
kmp_hw_subset_t(const kmp_hw_subset_t &t)=delete
const item_t & at(int index) const
kmp_hw_subset_t & operator=(kmp_hw_subset_t &&t)=delete
kmp_hw_subset_t & operator=(const kmp_hw_subset_t &t)=delete
static const int UNKNOWN_ID
static int compare_compact(const void *a, const void *b)
static int compare_ids(const void *a, const void *b)
static const int MULTIPLE_ID
kmp_hw_thread_t & at(int index)
int get_level(kmp_hw_t type) const
int get_count(int level) const
int get_ratio(int level) const
static void deallocate(kmp_topology_t *)
kmp_hw_t get_equivalent_type(kmp_hw_t type) const
void set_equivalent_type(kmp_hw_t type1, kmp_hw_t type2)
int get_num_hw_threads() const
int get_ncores_with_attr_per(const kmp_hw_attr_t &attr, int above) const
const kmp_hw_thread_t & at(int index) const
int calculate_ratio(int level1, int level2) const
static kmp_topology_t * allocate(int nproc, int ndepth, const kmp_hw_t *types)
void print(const char *env_var="KMP_AFFINITY") const
kmp_topology_t & operator=(kmp_topology_t &&t)=delete
kmp_topology_t(const kmp_topology_t &t)=delete
kmp_hw_t get_type(int level) const
kmp_topology_t(kmp_topology_t &&t)=delete
kmp_topology_t & operator=(const kmp_topology_t &t)=delete
int get_ncores_with_attr(const kmp_hw_attr_t &attr) const
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int mask
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp end
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp begin
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t count
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark d int
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type type
#define KMP_HW_MAX_NUM_CORE_EFFS
#define KMP_FOREACH_HW_TYPE(type)
#define __kmp_entry_gtid()
const char * __kmp_hw_get_keyword(kmp_hw_t type, bool plural=false)
#define __kmp_allocate(size)
const char * __kmp_hw_get_core_type_string(kmp_hw_core_type_t type)
@ KMP_HW_MAX_NUM_CORE_TYPES
@ KMP_HW_CORE_TYPE_UNKNOWN
static void __kmp_type_convert(T1 src, T2 *dest)
#define KMP_DEBUG_ASSERT_VALID_HW_TYPE(type)
kmp_hw_subset_t * __kmp_hw_subset
kmp_topology_t * __kmp_topology
KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 kmp_int8
#define KMP_BUILD_ASSERT(expr)
#define KMP_DEBUG_ASSERT(cond)
#define KMP_ASSERT2(cond, msg)
unsigned long long kmp_uint64
void __kmp_fatal(kmp_msg_t message,...)
#define KMP_COMPARE_AND_STORE_ACQ8(p, cv, sv)
bool contains(const kmp_hw_attr_t &other) const
bool is_core_type_valid() const
kmp_hw_core_type_t get_core_type() const
void set_core_type(kmp_hw_core_type_t type)
static const int UNKNOWN_CORE_EFF
void set_core_eff(int eff)
bool operator==(const kmp_hw_attr_t &rhs) const
bool is_core_eff_valid() const
bool operator!=(const kmp_hw_attr_t &rhs) const
kmp_hw_attr_t attr[MAX_ATTRS]
void __kmp_affinity_determine_capable(const char *env_var)
void __kmp_affinity_bind_thread(int proc)