Sfoglia il codice sorgente

Export the starpu_sched_policy_s structure in the public API.

Cédric Augonnet 14 anni fa
parent
commit
1e209cbb0d

+ 2 - 1
Makefile.am

@@ -38,7 +38,8 @@ include_HEADERS = 				\
 	include/starpu_cuda.h			\
 	include/starpu_opencl.h			\
 	include/starpu_expert.h			\
-	include/starpu_profiling.h
+	include/starpu_profiling.h		\
+	include/starpu_scheduler.h
 
 noinst_HEADERS = \
 	include/pthread_win32/pthread.h		\

+ 2 - 0
include/starpu_config.h.in

@@ -41,6 +41,8 @@
 #undef STARPU_MAXOPENCLDEVS
 #undef STARPU_NMAXWORKERS
 
+#undef STARPU_HAVE_HWLOC
+
 #undef STARPU_HAVE_LIBNUMA
 
 #undef STARPU_HAVE_WINDOWS

+ 84 - 0
include/starpu_scheduler.h

@@ -0,0 +1,84 @@
+/*
+ * StarPU
+ * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (see AUTHORS file)
+ *
+ * This program 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.
+ *
+ * This program 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_SCHEDULER_H__
+#define __STARPU_SCHEDULER_H__
+
+#include <starpu.h>
+#include <starpu_config.h>
+
+#ifdef STARPU_HAVE_HWLOC
+#include <hwloc.h>
+#endif
+
+struct starpu_machine_topology_s {
+	unsigned nworkers;
+
+#ifdef STARPU_HAVE_HWLOC
+	hwloc_topology_t hwtopology;
+#endif
+
+	unsigned nhwcpus;
+        unsigned nhwcudagpus;
+        unsigned nhwopenclgpus;
+
+	unsigned ncpus;
+	unsigned ncudagpus;
+	unsigned nopenclgpus;
+	unsigned ngordon_spus;
+
+	/* Where to bind workers ? */
+	unsigned workers_bindid[STARPU_NMAXWORKERS];
+	
+	/* Which GPU(s) do we use for CUDA ? */
+	unsigned workers_cuda_gpuid[STARPU_NMAXWORKERS];
+
+	/* Which GPU(s) do we use for OpenCL ? */
+	unsigned workers_opencl_gpuid[STARPU_NMAXWORKERS];
+};
+
+
+
+struct starpu_sched_policy_s {
+	/* create all the queues */
+	void (*init_sched)(struct starpu_machine_topology_s *, struct starpu_sched_policy_s *);
+
+	/* cleanup method at termination */
+	void (*deinit_sched)(struct starpu_machine_topology_s *, struct starpu_sched_policy_s *);
+
+	/* some methods to manipulate the previous queue */
+	int (*push_task)(struct starpu_task *);
+	int (*push_prio_task)(struct starpu_task *);
+	struct starpu_task *(*pop_task)(void);
+
+	/* returns the number of tasks that were retrieved 
+ 	 * the function is reponsible for allocating the output but the driver
+ 	 * has to free it 
+ 	 *
+ 	 * NB : this function is non blocking
+ 	 * */
+	struct starpu_task_list *(*pop_every_task)(uint32_t where);
+
+	/* name of the policy (optionnal) */
+	const char *policy_name;
+
+	/* description of the policy (optionnal) */
+	const char *policy_description;
+};
+
+
+
+#endif // __STARPU_SCHEDULER_H__

+ 2 - 29
src/core/policies/sched_policy.h

@@ -20,36 +20,9 @@
 #include <starpu.h>
 #include <core/workers.h>
 
-struct starpu_machine_config_s;
-struct starpu_machine_topology_s;
-
-struct starpu_sched_policy_s {
-	/* create all the queues */
-	void (*init_sched)(struct starpu_machine_topology_s *, struct starpu_sched_policy_s *);
-
-	/* cleanup method at termination */
-	void (*deinit_sched)(struct starpu_machine_topology_s *, struct starpu_sched_policy_s *);
-
-	/* some methods to manipulate the previous queue */
-	int (*push_task)(struct starpu_task *);
-	int (*push_prio_task)(struct starpu_task *);
-	struct starpu_task *(*pop_task)(void);
-
-	/* returns the number of tasks that were retrieved 
- 	 * the function is reponsible for allocating the output but the driver
- 	 * has to free it 
- 	 *
- 	 * NB : this function is non blocking
- 	 * */
-	struct starpu_task_list *(*pop_every_task)(uint32_t where);
-
-	/* name of the policy (optionnal) */
-	const char *policy_name;
-
-	/* description of the policy (optionnal) */
-	const char *policy_description;
-};
+#include <starpu_scheduler.h>
 
+struct starpu_machine_config_s;
 struct starpu_sched_policy_s *_starpu_get_sched_policy(void);
 
 void _starpu_init_sched_policy(struct starpu_machine_config_s *config);

+ 1 - 28
src/core/workers.h

@@ -18,6 +18,7 @@
 #define __WORKERS_H__
 
 #include <starpu.h>
+#include <starpu_scheduler.h>
 #include <common/config.h>
 #include <pthread.h>
 #include <common/timing.h>
@@ -91,34 +92,6 @@ struct starpu_worker_set_s {
 	unsigned set_is_initialized;
 };
 
-struct starpu_machine_topology_s {
-	unsigned nworkers;
-
-#ifdef STARPU_HAVE_HWLOC
-	hwloc_topology_t hwtopology;
-#endif
-
-	unsigned nhwcpus;
-        unsigned nhwcudagpus;
-        unsigned nhwopenclgpus;
-
-	unsigned ncpus;
-	unsigned ncudagpus;
-	unsigned nopenclgpus;
-	unsigned ngordon_spus;
-
-	/* Where to bind workers ? */
-	unsigned workers_bindid[STARPU_NMAXWORKERS];
-	
-	/* Which GPU(s) do we use for CUDA ? */
-	unsigned workers_cuda_gpuid[STARPU_NMAXWORKERS];
-
-	/* Which GPU(s) do we use for OpenCL ? */
-	unsigned workers_opencl_gpuid[STARPU_NMAXWORKERS];
-};
-
-
-
 struct starpu_machine_config_s {
 
 	struct starpu_machine_topology_s topology;