Browse Source

include: create new include file starpu_driver.h to define driver functionalities

Nathalie Furmento 12 years ago
parent
commit
13c51acfc8
3 changed files with 70 additions and 31 deletions
  1. 2 1
      Makefile.am
  2. 1 30
      include/starpu.h
  3. 67 0
      include/starpu_driver.h

+ 2 - 1
Makefile.am

@@ -76,7 +76,8 @@ versinclude_HEADERS = 				\
 	include/starpu_deprecated_api.h         \
 	include/starpu_hash.h			\
 	include/starpu_rand.h			\
-	include/starpu_cublas.h
+	include/starpu_cublas.h			\
+	include/starpu_driver.h
 
 nodist_versinclude_HEADERS = 			\
 	include/starpu_config.h

+ 1 - 30
include/starpu.h

@@ -62,6 +62,7 @@ typedef unsigned long long uint64_t;
 #include <starpu_profiling.h>
 #include <starpu_top.h>
 #include <starpu_fxt.h>
+#include <starpu_driver.h>
 
 #ifdef __cplusplus
 extern "C"
@@ -72,31 +73,6 @@ extern "C"
 #define main starpu_main
 #endif
 
-struct starpu_driver
-{
-	enum starpu_archtype type;
-	union
-	{
-		unsigned cpu_id;
-		unsigned cuda_id;
-#if defined(STARPU_USE_OPENCL) && !defined(__CUDACC__)
-		cl_device_id opencl_id;
-#elif defined(STARPU_SIMGRID)
-		unsigned opencl_id;
-#endif
-		/*
-		 * HOWTO: add a new kind of device to the starpu_driver structure.
-		 * 1) Add a member to this union.
-		 * 2) Edit _starpu_launch_drivers() to make sure the driver is
-		 *    not always launched.
-		 * 3) Edit starpu_driver_run() so that it can handle another
-		 *    kind of architecture.
-		 * 4) Write _starpu_run_foobar() in the corresponding driver.
-		 * 5) Test the whole thing :)
-		 */
-	} id;
-};
-
 struct starpu_conf
 {
 	/* Will be initialized by starpu_conf_init */
@@ -173,12 +149,7 @@ int starpu_asynchronous_opencl_copy_disabled(void);
 
 void starpu_profiling_init();
 void starpu_display_stats();
-int starpu_driver_run(struct starpu_driver *d);
-void starpu_drivers_request_termination(void);
 
-int starpu_driver_init(struct starpu_driver *d);
-int starpu_driver_run_once(struct starpu_driver *d);
-int starpu_driver_deinit(struct starpu_driver *d);
 #ifdef __cplusplus
 }
 #endif

+ 67 - 0
include/starpu_driver.h

@@ -0,0 +1,67 @@
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2009-2013  Université de Bordeaux 1
+ * Copyright (C) 2010-2013  Centre National de la Recherche Scientifique
+ *
+ * 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.
+ */
+
+#ifndef __STARPU_DRIVER_H__
+#define __STARPU_DRIVER_H__
+
+#include <starpu_config.h>
+#if defined(STARPU_USE_OPENCL) && !defined(__CUDACC__)
+#include <starpu_opencl.h>
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct starpu_driver
+{
+	enum starpu_archtype type;
+	union
+	{
+		unsigned cpu_id;
+		unsigned cuda_id;
+#if defined(STARPU_USE_OPENCL) && !defined(__CUDACC__)
+		cl_device_id opencl_id;
+#elif defined(STARPU_SIMGRID)
+		unsigned opencl_id;
+#endif
+		/*
+		 * HOWTO: add a new kind of device to the starpu_driver structure.
+		 * 1) Add a member to this union.
+		 * 2) Edit _starpu_launch_drivers() to make sure the driver is
+		 *    not always launched.
+		 * 3) Edit starpu_driver_run() so that it can handle another
+		 *    kind of architecture.
+		 * 4) Write _starpu_run_foobar() in the corresponding driver.
+		 * 5) Test the whole thing :)
+		 */
+	} id;
+};
+
+int starpu_driver_run(struct starpu_driver *d);
+void starpu_drivers_request_termination(void);
+
+int starpu_driver_init(struct starpu_driver *d);
+int starpu_driver_run_once(struct starpu_driver *d);
+int starpu_driver_deinit(struct starpu_driver *d);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STARPU_DRIVER_H__ */