Skip to content

Commit 33dfb12

Browse files
committed
Add requirement for HWLOC version
HWLOC library needs to be at least version 2.3.0 as it introduces the API used in NUMA node property querying used for memspace creation.
1 parent 20e0751 commit 33dfb12

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ if(WINDOWS)
167167
)
168168
endif()
169169

170-
pkg_check_modules(LIBHWLOC hwloc)
170+
pkg_check_modules(LIBHWLOC hwloc>=2.30.0)
171171
if(NOT LIBHWLOC_FOUND)
172-
find_package(LIBHWLOC REQUIRED hwloc)
172+
find_package(LIBHWLOC 2.3.0 REQUIRED hwloc)
173173
endif()
174174
# add PATH to DLL on Windows
175175
set(DLL_PATH_LIST

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ which includes the code of the basic [example](https://github.com/oneapi-src/uni
2525
### Requirements
2626

2727
Required packages:
28-
- libhwloc-dev (Linux) / hwloc (Windows)
28+
- libhwloc-dev >= 2.3.0 (Linux) / hwloc >= 2.3.0 (Windows)
2929
- C compiler
3030
- [CMake](https://cmake.org/) >= 3.14.0
3131

cmake/FindLIBHWLOC.cmake

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ find_file(LIBHWLOC_HEADER NAMES hwloc.h)
1414
get_filename_component(LIBHWLOC_INCLUDE_DIR ${LIBHWLOC_HEADER} DIRECTORY)
1515
set(LIBHWLOC_INCLUDE_DIRS ${LIBHWLOC_INCLUDE_DIR})
1616

17+
if (LIBHWLOC_INCLUDE_DIR)
18+
if (EXISTS "${LIBHWLOC_INCLUDE_DIR}/hwloc/autogen/config.h")
19+
file(STRINGS "${LIBHWLOC_INCLUDE_DIR}/hwloc/autogen/config.h" LIBHWLOC_VERSION
20+
REGEX "#define[ \t]HWLOC_VERSION[ \t]\"[0-9]+.[0-9]+.[0-9]+\"")
21+
string(REGEX REPLACE "#define[ \t]HWLOC_VERSION[ \t]\"([0-9]+.[0-9]+.[0-9]+)\"" "\\1" LIBHWLOC_VERSION ${LIBHWLOC_VERSION})
22+
else()
23+
message(WARNING "LIBHWLOC_INCLUDE_DIR found, but header with version info is missing")
24+
endif()
25+
endif()
26+
1727
if(WINDOWS)
1828
find_file(LIBHWLOC_DLL NAMES "bin/hwloc-15.dll" "bin/libhwloc-15.dll")
1929
get_filename_component(LIBHWLOC_DLL_DIR ${LIBHWLOC_DLL} DIRECTORY)
@@ -25,9 +35,16 @@ if(LIBHWLOC_LIBRARY)
2535
message(STATUS " LIBHWLOC_LIBRARIES = ${LIBHWLOC_LIBRARIES}")
2636
message(STATUS " LIBHWLOC_INCLUDE_DIRS = ${LIBHWLOC_INCLUDE_DIRS}")
2737
message(STATUS " LIBHWLOC_LIBRARY_DIRS = ${LIBHWLOC_LIBRARY_DIRS}")
38+
message(STATUS " LIBHWLOC_VERSION = ${LIBHWLOC_VERSION}")
2839
if(WINDOWS)
2940
message(STATUS " LIBHWLOC_DLL_DIRS = ${LIBHWLOC_DLL_DIRS}")
3041
endif()
42+
43+
if(LIBHWLOC_FIND_VERSION)
44+
if (NOT LIBHWLOC_VERSION OR NOT LIBHWLOC_VERSION VERSION_GREATER_EQUAL LIBHWLOC_FIND_VERSION)
45+
message(FATAL_ERROR " Required version: ${LIBHWLOC_FIND_VERSION}, found ${LIBHWLOC_VERSION}")
46+
endif()
47+
endif()
3148
else()
3249
set(MSG_NOT_FOUND
3350
"libhwloc NOT found (set CMAKE_PREFIX_PATH to point the location)")

0 commit comments

Comments
 (0)