Olivier Aumage лет назад: 6
Родитель
Сommit
a38cefb609
5 измененных файлов с 56 добавлено и 122 удалено
  1. 2 1
      configure.ac
  2. 37 0
      m4/ax_dlb_callback_arg.m4
  3. 0 118
      starpurm/src/config.h.in
  4. 1 1
      starpurm/src/starpurm.c
  5. 16 2
      starpurm/src/starpurm_dlb.c

+ 2 - 1
configure.ac

@@ -3444,6 +3444,7 @@ then
 	then
 		AC_DEFINE([STARPURM_HAVE_DLB], [1], [Define to 1 if dlb support is enabled.])
 		starpurm_dlb_support=yes
+		AX_DLB_CALLBACK_ARG()
 	fi
 	AC_SUBST(DLB_CFLAGS)
 	AC_SUBST(DLB_LIBS)
@@ -3579,7 +3580,7 @@ done
 AC_SUBST(SOCL_VENDORS)
 
 AC_CONFIG_FILES(tests/regression/regression.sh tests/regression/profiles tests/regression/profiles.build.only)
-AC_CONFIG_HEADER(src/common/config.h include/starpu_config.h gcc-plugin/include/starpu-gcc/config.h starpu-top/config.h starpurm/src/config.h starpurm/include/starpurm_config.h)
+AC_CONFIG_HEADER(src/common/config.h include/starpu_config.h gcc-plugin/include/starpu-gcc/config.h starpu-top/config.h starpurm/include/starpurm_config.h)
 
 SANITIZE=$(echo $CFLAGS | grep sanitize)
 AM_CONDITIONAL(STARPU_SANITIZE, test -n "$SANITIZE")

+ 37 - 0
m4/ax_dlb_callback_arg.m4

@@ -0,0 +1,37 @@
+# StarPU --- Runtime system for heterogeneous multicore architectures.
+#
+# Copyright (C) 2018                                     Inria
+#
+# StarPU is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or (at
+# your option) any later version.
+#
+# StarPU is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# See the GNU Lesser General Public License in COPYING.LGPL for more details.
+#
+
+# Check whether DLB callbacks expect an user argument
+AC_DEFUN([AX_DLB_CALLBACK_ARG],
+[AC_MSG_CHECKING([whether DLB callbacks expect an user argument])
+  AC_CACHE_VAL(ac_cv_dlb_callback_arg,dnl
+  [AC_TRY_COMPILE(dnl
+[#include <dlb_sp.h>
+dlb_handler_t dlb_handle;
+void _dlb_callback_disable_cpu(int cpuid, void *arg) {
+  (void)cpuid;
+  (void)arg;
+}
+void f(void) {
+(void)DLB_CallbackSet_sp(dlb_handle, dlb_callback_disable_cpu, (dlb_callback_t)_dlb_callback_disable_cpu, 0);
+}
+],, ac_cv_dlb_callback_arg=yes, ac_cv_dlb_callback_arg=no)
+  ])dnl AC_CACHE_VAL
+  AC_MSG_RESULT([$ac_cv_dlb_callback_arg])
+  if test $ac_cv_dlb_callback_arg = yes; then
+    AC_DEFINE(STARPURM_HAVE_DLB_CALLBACK_ARG,1,[Define to 1 if DLB callbacks expect an user argument])
+  fi
+])

+ 0 - 118
starpurm/src/config.h.in

@@ -1,118 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2018                                     Inria
- *
- * StarPU is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at
- * your option) any later version.
- *
- * StarPU is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU Lesser General Public License in COPYING.LGPL for more details.
- */
-/* src/config.h.in.  Generated from configure.ac by autoheader.  */
-
-/* Define to 1 if you have the <dlb.h> header file. */
-#undef HAVE_DLB_H
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#undef HAVE_DLFCN_H
-
-/* Define to 1 if you have the <hwloc/glibc-sched.h> header file. */
-#undef HAVE_HWLOC_GLIBC_SCHED_H
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the `dlb' library (-ldlb). */
-#undef HAVE_LIBDLB
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
-   */
-#undef LT_OBJDIR
-
-/* Define to 1 if your C compiler doesn't accept -c and -o together. */
-#undef NO_MINUS_C_MINUS_O
-
-/* Name of package */
-#undef PACKAGE
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the home page for this package. */
-#undef PACKAGE_URL
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* Define to 1 if dlb support is enabled. */
-#undef STARPURM_HAVE_DLB
-
-/* Major version number of StarPU RM. */
-#undef STARPURM_MAJOR_VERSION
-
-/* Minor version number of StarPU RM. */
-#undef STARPURM_MINOR_VERSION
-
-/* Release version number of StarPU RM. */
-#undef STARPURM_RELEASE_VERSION
-
-/* Define to 1 if StarPU has support for worker callbacks. */
-#undef STARPURM_STARPU_HAVE_WORKER_CALLBACKS
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Version number of package */
-#undef VERSION
-
-/* Define to the equivalent of the C99 'restrict' keyword, or to
-   nothing if this is not supported.  Do not define if restrict is
-   supported directly.  */
-#undef restrict
-/* Work around a bug in Sun C++: it does not support _Restrict or
-   __restrict__, even though the corresponding Sun C compiler ends up with
-   "#define restrict _Restrict" or "#define restrict __restrict__" in the
-   previous line.  Perhaps some future version of Sun C++ will work with
-   restrict; if so, hopefully it defines __RESTRICT like Sun C does.  */
-#if defined __SUNPRO_CC && !defined __RESTRICT
-# define _Restrict
-# define __restrict__
-#endif

+ 1 - 1
starpurm/src/starpurm.c

@@ -21,7 +21,7 @@
 #include <hwloc.h>
 #include <starpu.h>
 #include <starpurm.h>
-#include <config.h>
+#include <common/config.h>
 #include <starpurm_private.h>
 
 #undef STARPURM_VERBOSE

+ 16 - 2
starpurm/src/starpurm_dlb.c

@@ -24,7 +24,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
-#include <config.h>
+#include <common/config.h>
 
 #include <hwloc.h>
 #ifdef HAVE_HWLOC_GLIBC_SCHED_H
@@ -251,8 +251,15 @@ int starpurm_dlb_notify_starpu_worker_mask_waking_up(const hwloc_cpuset_t hwloc_
 }
 
 #ifdef STARPURM_STARPU_HAVE_WORKER_CALLBACKS
+#ifdef STARPURM_HAVE_DLB_CALLBACK_ARG
+static void _dlb_callback_enable_cpu(int cpuid, void *arg)
+#else
 static void _dlb_callback_enable_cpu(int cpuid)
+#endif
 {
+#ifdef STARPURM_HAVE_DLB_CALLBACK_ARG
+	(void) arg;
+#endif
 	int unitid = glibc_cpuid_to_unitid[cpuid];
 #ifdef STARPURM_DLB_VERBOSE
 	fprintf(stderr, "%s: cpuid=%d, unitid=%d\n", __func__, cpuid, unitid);
@@ -263,8 +270,15 @@ static void _dlb_callback_enable_cpu(int cpuid)
 	}
 }
 
+#ifdef STARPURM_HAVE_DLB_CALLBACK_ARG
+static void _dlb_callback_disable_cpu(int cpuid, void *arg)
+#else
 static void _dlb_callback_disable_cpu(int cpuid)
+#endif
 {
+#ifdef STARPURM_HAVE_DLB_CALLBACK_ARG
+	(void) arg;
+#endif
 	int unitid = glibc_cpuid_to_unitid[cpuid];
 #ifdef STARPURM_DLB_VERBOSE
 	fprintf(stderr, "%s: cpuid=%d, unitid=%d\n", __func__, cpuid, unitid);
@@ -349,7 +363,7 @@ void starpurm_dlb_init(struct s_starpurm *rm)
 	 * we only register cpu-based callbacks */
 	int dlb_ret;
 #ifdef STARPURM_STARPU_HAVE_WORKER_CALLBACKS
-#ifdef DLB_HAVE_CALLBACK_ARG
+#ifdef STARPURM_HAVE_DLB_CALLBACK_ARG
 	dlb_ret = DLB_CallbackSet_sp(dlb_handle, dlb_callback_disable_cpu, (dlb_callback_t)_dlb_callback_disable_cpu, NULL);
 	_dlb_check("DLB_CallbackSet_sp", dlb_ret);
 	dlb_ret = DLB_CallbackSet_sp(dlb_handle, dlb_callback_enable_cpu, (dlb_callback_t)_dlb_callback_enable_cpu, NULL);