[Openmp-commits] [PATCH] D62332: Fixed build warning with -DLIBOMP_USE_HWLOC=1

Andrey Churbanov via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu May 23 11:12:17 PDT 2019


AndreyChurbanov created this revision.
AndreyChurbanov added reviewers: jlpeyton, hbae, tlwilmar.
AndreyChurbanov added a project: OpenMP.
Herald added subscribers: openmp-commits, jdoerfert.

HWLOC 2.0 changed the type depth field in hwloc_obj_t structure from unsigned to int. People can use either old or newer HWLOC during the build with -DLIBOMP_USE_HWLOC=1 option. The patch checks the version of HWLOC installed and use appropriate type to prevent build warning on signed-unsigned comparison.


Repository:
  rOMP OpenMP

https://reviews.llvm.org/D62332

Files:
  runtime/src/kmp.h
  runtime/src/kmp_affinity.cpp


Index: runtime/src/kmp_affinity.cpp
===================================================================
--- runtime/src/kmp_affinity.cpp
+++ runtime/src/kmp_affinity.cpp
@@ -457,7 +457,8 @@
 }
 
 static int __kmp_hwloc_count_children_by_depth(hwloc_topology_t t,
-                                               hwloc_obj_t o, unsigned depth,
+                                               hwloc_obj_t o,
+                                               kmp_hwloc_depth_t depth,
                                                hwloc_obj_t *f) {
   if (o->depth == depth) {
     if (*f == NULL)
Index: runtime/src/kmp.h
===================================================================
--- runtime/src/kmp.h
+++ runtime/src/kmp.h
@@ -96,6 +96,12 @@
 #ifndef HWLOC_OBJ_PACKAGE
 #define HWLOC_OBJ_PACKAGE HWLOC_OBJ_SOCKET
 #endif
+#if HWLOC_API_VERSION >= 0x00020000
+// hwloc 2.0 changed type of depth of object from unsigned to int
+typedef int kmp_hwloc_depth_t;
+#else
+typedef unsigned int kmp_hwloc_depth_t;
+#endif
 #endif
 
 #if KMP_ARCH_X86 || KMP_ARCH_X86_64


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62332.201019.patch
Type: text/x-patch
Size: 1067 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20190523/f51d0520/attachment.bin>


More information about the Openmp-commits mailing list