ソースを参照

Ensure we have hwloc over 1.10 to use clusters (in pkgconfig case). Also fix OpenMP includes.

Terry Cojean 9 年 前
コミット
f686a1643b
共有7 個のファイルを変更した21 個の追加12 個の削除を含む
  1. 8 1
      Makefile.am
  2. 8 5
      configure.ac
  3. 2 0
      examples/Makefile.am
  4. 0 2
      include/starpu_clusters_util.h
  5. 2 0
      src/Makefile.am
  6. 1 2
      src/util/starpu_clusters_create.c
  7. 0 2
      src/util/starpu_clusters_create.h

+ 8 - 1
Makefile.am

@@ -94,10 +94,17 @@ versinclude_HEADERS = 				\
 	include/starpu_thread.h			\
 	include/starpu_thread_util.h		\
 	include/starpu_tree.h			\
-	include/starpu_clusters_util.h 		\
 	include/starpu_simgrid_wrap.h		\
 	include/starpu_mod.f90
 
+if STARPU_HAVE_HWLOC
+if STARPU_HWLOC_HAVE_TOPOLOGY_DUP
+if STARPU_HAVE_OPENMP
+versinclude_HEADERS += include/starpu_clusters_util.h
+endif
+endif
+endif
+
 nodist_versinclude_HEADERS = 			\
 	include/starpu_config.h
 

+ 8 - 5
configure.ac

@@ -2465,16 +2465,18 @@ AS_IF([test "$use_hwloc" = "no"],
   [AS_IF([test "$use_hwloc_from_system" = "yes"],
   	  [PKG_CHECK_MODULES([HWLOC],[hwloc], [
 	      	have_valid_hwloc=yes
-		have_pkgconfig_hwloc=yes], [
-		have_valid_hwloc=no
-		have_pkgconfig_hwloc=no])
+            have_pkgconfig_hwloc=yes
+            HWLOC_MAJVERSION=`$PKG_CONFIG --modversion hwloc | cut -d'.' -f1`
+            HWLOC_MINVERSION=`$PKG_CONFIG --modversion hwloc | cut -d'.' -f2`], [
+            have_valid_hwloc=no
+            have_pkgconfig_hwloc=no])
 	  ],
 	  #else
 	  [have_pkgconfig_hwloc=no
 	   CPPFLAGS="${SAVED_CPPFLAGS} -I$hwloc_dir/include"
 	   AC_CHECK_HEADER([hwloc.h],[have_valid_hwloc=yes],[have_valid_hwloc=no])
 	   LDFLAGS="${SAVED_LDFLAGS} -L$hwloc_dir/lib"
-	   AC_HAVE_LIBRARY([hwloc],[have_valid_hwloc=yes],[have_valid_hwloc=no])
+       AC_HAVE_LIBRARY([hwloc],[have_valid_hwloc=yes],[have_valid_hwloc=no])
 	  ])
   ])
 AM_CONDITIONAL(STARPU_HAVE_HWLOC, test "x$have_valid_hwloc" = "xyes")
@@ -2494,8 +2496,9 @@ AS_IF([test "$have_valid_hwloc" = "yes"],
        AC_CHECK_DECLS([hwloc_cuda_get_device_osdev_by_index], [], [], [[#include <hwloc/cuda.h>]])
        AS_IF([test "$have_pkgconfig_hwloc" = "no"],
              [HWLOC_CFLAGS="-I$hwloc_dir/include"
-	      HWLOC_LIBS="-L$hwloc_dir/lib -lhwloc"]
+          HWLOC_LIBS="-L$hwloc_dir/lib -lhwloc"],
        )
+       AM_CONDITIONAL(STARPU_HWLOC_HAVE_TOPOLOGY_DUP, test $HWLOC_MAJVERSION -gt 1 -o \( $HWLOC_MAJVERSION -eq 1 -a $HWLOC_MINVERSION -ge 11 \))
       ])
 LDFLAGS="${SAVED_LDFLAGS}"
 CPPFLAGS="${SAVED_CPPFLAGS}"

+ 2 - 0
examples/Makefile.am

@@ -279,10 +279,12 @@ STARPU_EXAMPLES +=				\
 endif
 
 if STARPU_HAVE_HWLOC
+if STARPU_HWLOC_HAVE_TOPOLOGY_DUP
 STARPU_EXAMPLES +=				\
 	sched_ctx/parallel_tasks_with_cluster_api
 endif
 endif
+endif
 
 ##################
 # Basic examples #

+ 0 - 2
include/starpu_clusters_util.h

@@ -21,9 +21,7 @@
 
 #include <stdarg.h>
 #include <starpu.h>
-#ifdef STARPU_HAVE_HWLOC
 #include <hwloc.h>
-#endif
 
 #ifdef __cplusplus
 extern "C"

+ 2 - 0
src/Makefile.am

@@ -329,10 +329,12 @@ endif
 
 
 if STARPU_HAVE_HWLOC
+if STARPU_HWLOC_HAVE_TOPOLOGY_DUP
 if STARPU_HAVE_OPENMP
 libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES += util/starpu_clusters_create.c
 endif
 endif
+endif
 
 
 #########################################

+ 1 - 2
src/util/starpu_clusters_create.c

@@ -544,11 +544,10 @@ void _starpu_cluster_topology(hwloc_obj_type_t cluster_level,
 		free(workers);
 
 		/* Use new topology to fill in the cluster list */
-		hwloc_topology_dup(&machine->topology, topology);
+		machine->topology = topology;
 		_starpu_cluster_group(cluster_level, machine);
 
 		hwloc_bitmap_free(avail_cpus);
-		hwloc_topology_destroy(topology);
 
 		return;
 }

+ 0 - 2
src/util/starpu_clusters_create.h

@@ -23,9 +23,7 @@
 #include <core/workers.h>
 #include <common/list.h>
 #include <string.h>
-#ifdef STARPU_OPENMP
 #include <omp.h>
-#endif
 #ifdef STARPU_MKL
 #include <mkl_service.h>
 #endif