From 0f3c2b921d044cd1dc6747b8db5082e4f930b59c Mon Sep 17 00:00:00 2001 From: Jonathan Peyton Date: Thu, 16 Jun 2016 20:23:11 +0000 Subject: Teach OpenMP Library to use Hwloc on Windows This patch allows a user to enable Hwloc on windows. There are three main changes in here: 1.kmp.h - Move definitions/declarations out of KMP_OS_WINDOWS guard (our windows implementation of affinity) because they need to be defined when KMP_USE_HWLOC is on as well. 2.teach __kmp_set_system_affinity, __kmp_get_system_affinity, __kmp_get_proc_group, and __kmp_affinity_bind_thread how to use hwloc. 3.teach CMake how to include hwloc when building Windows Another minor change in here is to make sure that anything under KMP_USE_HWLOC is also guarded by KMP_AFFINITY_SUPPORTED as well. This is to prevent Mac builds from requiring anything from Hwloc. Differential Revision: http://reviews.llvm.org/D21441 llvm-svn: 272951 --- openmp/runtime/src/kmp_global.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'openmp/runtime/src/kmp_global.c') diff --git a/openmp/runtime/src/kmp_global.c b/openmp/runtime/src/kmp_global.c index 63e9dc38c84..2cf0e2fa5e0 100644 --- a/openmp/runtime/src/kmp_global.c +++ b/openmp/runtime/src/kmp_global.c @@ -35,10 +35,6 @@ __thread kmp_stats_list* __kmp_stats_thread_ptr = &__kmp_stats_list; // gives reference tick for all events (considered the 0 tick) tsc_tick_count __kmp_stats_start_time; #endif -#if KMP_USE_HWLOC -int __kmp_hwloc_error = FALSE; -hwloc_topology_t __kmp_hwloc_topology = NULL; -#endif /* ----------------------------------------------------- */ /* INITIALIZATION VARIABLES */ @@ -220,6 +216,11 @@ enum mic_type __kmp_mic_type = non_mic; #if KMP_AFFINITY_SUPPORTED +# if KMP_USE_HWLOC +int __kmp_hwloc_error = FALSE; +hwloc_topology_t __kmp_hwloc_topology = NULL; +# endif + # if KMP_GROUP_AFFINITY int __kmp_num_proc_groups = 1; -- cgit v1.2.3