diff options
| author | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2015-11-30 20:02:59 +0000 |
|---|---|---|
| committer | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2015-11-30 20:02:59 +0000 |
| commit | 01dcf36bd54be75dcf6c3cc9cc8d1f20e783d86a (patch) | |
| tree | 538111ad7545036c7e9d75ab83e37da63b4ddaa9 /openmp/runtime/cmake/config-ix.cmake | |
| parent | 7a096596b2eead02405329a5504b0d71dd5b4a8d (diff) | |
| download | bcm5719-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/cmake/config-ix.cmake')
| -rw-r--r-- | openmp/runtime/cmake/config-ix.cmake | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/openmp/runtime/cmake/config-ix.cmake b/openmp/runtime/cmake/config-ix.cmake index 9c7848b3bcf..eccb8634b3b 100644 --- a/openmp/runtime/cmake/config-ix.cmake +++ b/openmp/runtime/cmake/config-ix.cmake @@ -12,6 +12,7 @@ include(CheckCCompilerFlag) include(CheckCSourceCompiles) include(CheckCXXCompilerFlag) +include(CheckIncludeFile) include(CheckLibraryExists) include(CheckIncludeFiles) include(LibompCheckLinkerFlag) @@ -211,3 +212,25 @@ else() endif() endif() +# Check if HWLOC support is available +if(${LIBOMP_USE_HWLOC}) + if(WIN32) + set(LIBOMP_HAVE_HWLOC FALSE) + libomp_say("Using hwloc not supported on Windows yet") + else() + set(CMAKE_REQUIRED_INCLUDES ${LIBOMP_HWLOC_INSTALL_DIR}/include) + check_include_file(hwloc.h LIBOMP_HAVE_HWLOC_H) + set(CMAKE_REQUIRED_INCLUDES) + check_library_exists(hwloc hwloc_topology_init + ${LIBOMP_HWLOC_INSTALL_DIR}/lib LIBOMP_HAVE_LIBHWLOC) + find_library(LIBOMP_HWLOC_LIBRARY hwloc ${LIBOMP_HWLOC_INSTALL_DIR}/lib) + get_filename_component(LIBOMP_HWLOC_LIBRARY_DIR ${LIBOMP_HWLOC_LIBRARY} PATH) + if(LIBOMP_HAVE_HWLOC_H AND LIBOMP_HAVE_LIBHWLOC AND LIBOMP_HWLOC_LIBRARY) + set(LIBOMP_HAVE_HWLOC TRUE) + else() + set(LIBOMP_HAVE_HWLOC FALSE) + libomp_say("Could not find hwloc") + endif() + endif() +endif() + |

