summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/test
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2015-11-30 20:02:59 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2015-11-30 20:02:59 +0000
commit01dcf36bd54be75dcf6c3cc9cc8d1f20e783d86a (patch)
tree538111ad7545036c7e9d75ab83e37da63b4ddaa9 /openmp/runtime/test
parent7a096596b2eead02405329a5504b0d71dd5b4a8d (diff)
downloadbcm5719-llvm-01dcf36bd54be75dcf6c3cc9cc8d1f20e783d86a.tar.gz
bcm5719-llvm-01dcf36bd54be75dcf6c3cc9cc8d1f20e783d86a.zip
Adding Hwloc library option for affinity mechanism
These changes allow libhwloc to be used as the topology discovery/affinity mechanism for libomp. It is supported on Unices. The code additions: * Canonicalize KMP_CPU_* interface macros so bitmask operations are implementation independent and work with both hwloc bitmaps and libomp bitmaps. So there are new KMP_CPU_ALLOC_* and KMP_CPU_ITERATE() macros and the like. These are all in kmp.h and appropriately placed. * Hwloc topology discovery code in kmp_affinity.cpp. This uses the hwloc interface to create a libomp address2os object which the rest of libomp knows how to handle already. * To build, use -DLIBOMP_USE_HWLOC=on and -DLIBOMP_HWLOC_INSTALL_DIR=/path/to/install/dir [default /usr/local]. If CMake can't find the library or hwloc.h, then it will tell you and exit. Differential Revision: http://reviews.llvm.org/D13991 llvm-svn: 254320
Diffstat (limited to 'openmp/runtime/test')
-rw-r--r--openmp/runtime/test/CMakeLists.txt11
-rw-r--r--openmp/runtime/test/lit.cfg29
-rw-r--r--openmp/runtime/test/lit.site.cfg.in2
3 files changed, 33 insertions, 9 deletions
diff --git a/openmp/runtime/test/CMakeLists.txt b/openmp/runtime/test/CMakeLists.txt
index ce917ee4790..1bccfc13edf 100644
--- a/openmp/runtime/test/CMakeLists.txt
+++ b/openmp/runtime/test/CMakeLists.txt
@@ -1,12 +1,23 @@
# CMakeLists.txt file for unit testing OpenMP Library
include(FindPythonInterp)
include(CheckTypeSize)
+
if(NOT PYTHONINTERP_FOUND)
libomp_warning_say("Could not find Python.")
libomp_warning_say("The check-libomp target will not be available!")
return()
endif()
+macro(pythonize_bool var)
+ if (${var})
+ set(${var} True)
+ else()
+ set(${var} False)
+ endif()
+endmacro()
+
+pythonize_bool(LIBOMP_USE_HWLOC)
+
set(LIBOMP_TEST_CFLAGS "" CACHE STRING
"Extra compiler flags to send to the test compiler")
diff --git a/openmp/runtime/test/lit.cfg b/openmp/runtime/test/lit.cfg
index 5529c4745d9..2f258eff748 100644
--- a/openmp/runtime/test/lit.cfg
+++ b/openmp/runtime/test/lit.cfg
@@ -9,11 +9,20 @@ if 'PYLINT_IMPORT' in os.environ:
config = object()
lit_config = object()
-def append_dynamic_library_path(name, value, sep):
+def append_dynamic_library_path(path):
+ if config.operating_system == 'Windows':
+ name = 'PATH'
+ sep = ';'
+ elif config.operating_system == 'Darwin':
+ name = 'DYLD_LIBRARY_PATH'
+ sep = ':'
+ else:
+ name = 'LD_LIBRARY_PATH'
+ sep = ':'
if name in config.environment:
- config.environment[name] = value + sep + config.environment[name]
+ config.environment[name] = path + sep + config.environment[name]
else:
- config.environment[name] = value
+ config.environment[name] = path
# name: The name of this test suite.
config.name = 'libomp'
@@ -38,13 +47,15 @@ config.test_cflags = config.test_openmp_flag + \
" " + config.test_extra_cflags
# Setup environment to find dynamic library at runtime
-if config.operating_system == 'Windows':
- append_dynamic_library_path('PATH', config.library_dir, ";")
-elif config.operating_system == 'Darwin':
- append_dynamic_library_path('DYLD_LIBRARY_PATH', config.library_dir, ":")
+append_dynamic_library_path(config.library_dir)
+if config.using_hwloc:
+ append_dynamic_library_path(config.hwloc_library_dir)
+
+# Rpath modifications for Darwin
+if config.operating_system == 'Darwin':
config.test_cflags += " -Wl,-rpath," + config.library_dir
-else: # Unices
- append_dynamic_library_path('LD_LIBRARY_PATH', config.library_dir, ":")
+ if config.using_hwloc:
+ config.test_cflags += " -Wl,-rpath," + config.hwloc_library_dir
# substitutions
config.substitutions.append(("%libomp-compile-and-run", \
diff --git a/openmp/runtime/test/lit.site.cfg.in b/openmp/runtime/test/lit.site.cfg.in
index c9cd7e78ba9..32daeb8647f 100644
--- a/openmp/runtime/test/lit.site.cfg.in
+++ b/openmp/runtime/test/lit.site.cfg.in
@@ -7,6 +7,8 @@ config.libomp_obj_root = "@CMAKE_CURRENT_BINARY_DIR@"
config.library_dir = "@LIBOMP_LIBRARY_DIR@"
config.omp_header_directory = "@LIBOMP_BINARY_DIR@/src"
config.operating_system = "@CMAKE_SYSTEM_NAME@"
+config.hwloc_library_dir = "@LIBOMP_HWLOC_LIBRARY_DIR@"
+config.using_hwloc = @LIBOMP_USE_HWLOC@
# Let the main config do the real work.
lit_config.load_config(config, "@LIBOMP_BASE_DIR@/test/lit.cfg")
OpenPOWER on IntegriCloud