summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src/kmp_affinity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'openmp/runtime/src/kmp_affinity.cpp')
-rw-r--r--openmp/runtime/src/kmp_affinity.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp
index fe987d82c8b..251ee0c2971 100644
--- a/openmp/runtime/src/kmp_affinity.cpp
+++ b/openmp/runtime/src/kmp_affinity.cpp
@@ -3611,6 +3611,31 @@ static int __kmp_aff_depth = 0;
__kmp_apply_thread_places(NULL, 0); \
return;
+static int
+__kmp_affinity_cmp_Address_child_num(const void *a, const void *b)
+{
+ const Address *aa = (const Address *)&(((AddrUnsPair *)a)
+ ->first);
+ const Address *bb = (const Address *)&(((AddrUnsPair *)b)
+ ->first);
+ unsigned depth = aa->depth;
+ unsigned i;
+ KMP_DEBUG_ASSERT(depth == bb->depth);
+ KMP_DEBUG_ASSERT((unsigned)__kmp_affinity_compact <= depth);
+ KMP_DEBUG_ASSERT(__kmp_affinity_compact >= 0);
+ for (i = 0; i < (unsigned)__kmp_affinity_compact; i++) {
+ int j = depth - i - 1;
+ if (aa->childNums[j] < bb->childNums[j]) return -1;
+ if (aa->childNums[j] > bb->childNums[j]) return 1;
+ }
+ for (; i < depth; i++) {
+ int j = i - __kmp_affinity_compact;
+ if (aa->childNums[j] < bb->childNums[j]) return -1;
+ if (aa->childNums[j] > bb->childNums[j]) return 1;
+ }
+ return 0;
+}
+
static void
__kmp_aux_affinity_initialize(void)
{
OpenPOWER on IntegriCloud