[Openmp-commits] [PATCH] D142036: [OpenMP] Add HWLOC compatibility check

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Jan 18 09:33:55 PST 2023


tianshilei1992 created this revision.
tianshilei1992 added reviewers: jdoerfert, jhuber6, jlpeyton.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
tianshilei1992 requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

Starting from LLVM 14 we are using HWLOC APIs from newer version, per
https://github.com/llvm/llvm-project/issues/54951, but our CMake check doesn't
include that part. Unfortunately HWLOC doesn't provide a proper CMake module for
`find_package`. We have to check if specific struct member exists before we use
that.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142036

Files:
  openmp/runtime/cmake/config-ix.cmake


Index: openmp/runtime/cmake/config-ix.cmake
===================================================================
--- openmp/runtime/cmake/config-ix.cmake
+++ openmp/runtime/cmake/config-ix.cmake
@@ -349,6 +349,9 @@
   if(LIBOMP_HWLOC_LIBRARY)
     check_library_exists(${LIBOMP_HWLOC_LIBRARY} hwloc_topology_init
       ${LIBOMP_HWLOC_INSTALL_DIR}/lib LIBOMP_HAVE_LIBHWLOC)
+    include(CheckStructHasMember)
+    # Check if struct hwloc_group_attr_s has kind as it is a new feature in HWLOC 2 and we need that.
+    check_struct_has_member("struct hwloc_group_attr_s" "kind" hwloc.h LIBOMP_HAVE_LIBHWLOC)
     get_filename_component(LIBOMP_HWLOC_LIBRARY_DIR ${LIBOMP_HWLOC_LIBRARY} PATH)
   endif()
   if(LIBOMP_HAVE_HWLOC_H AND LIBOMP_HAVE_LIBHWLOC AND LIBOMP_HWLOC_LIBRARY)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142036.490200.patch
Type: text/x-patch
Size: 776 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230118/17ab9ee0/attachment.bin>


More information about the Openmp-commits mailing list