aboutsummaryrefslogtreecommitdiff
path: root/runtime/src/kmp_affinity.cpp
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2015-11-09 16:24:53 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2015-11-09 16:24:53 +0000
commit9543a7dad8f9d10bd735f0a7646e90997437dbfe (patch)
tree3aae8ab26f710c6e757812b2fbd57770ce68f049 /runtime/src/kmp_affinity.cpp
parent5677b5095c8510d8f7845cc1da4e8855cd39c21c (diff)
Improvements to machine_hierarchy code for re-sizing
These changes include: 1) Machine hierarchy now uses the base_num_threads field to indicate the maximum number of threads the current hierarchy can handle without a resize. 2) In __kmp_get_hierarchy, we need to get depth after any potential resize is done. 3) Cleanup of hierarchy resize code to support 1 above. Differential Revision: http://reviews.llvm.org/D14455 git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@252475 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'runtime/src/kmp_affinity.cpp')
-rw-r--r--runtime/src/kmp_affinity.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/runtime/src/kmp_affinity.cpp b/runtime/src/kmp_affinity.cpp
index e45301d..0dc0d48 100644
--- a/runtime/src/kmp_affinity.cpp
+++ b/runtime/src/kmp_affinity.cpp
@@ -33,12 +33,13 @@ void __kmp_get_hierarchy(kmp_uint32 nproc, kmp_bstate_t *thr_bar) {
if (TCR_1(machine_hierarchy.uninitialized))
machine_hierarchy.init(NULL, nproc);
- depth = machine_hierarchy.depth;
- KMP_DEBUG_ASSERT(depth > 0);
// Adjust the hierarchy in case num threads exceeds original
- if (nproc > machine_hierarchy.skipPerLevel[depth-1])
+ if (nproc > machine_hierarchy.base_num_threads)
machine_hierarchy.resize(nproc);
+ depth = machine_hierarchy.depth;
+ KMP_DEBUG_ASSERT(depth > 0);
+
thr_bar->depth = depth;
thr_bar->base_leaf_kids = (kmp_uint8)machine_hierarchy.numPerLevel[0]-1;
thr_bar->skip_per_level = machine_hierarchy.skipPerLevel;