Andra Hugo 12 anni fa
parent
commit
fbaab2c498

+ 5 - 3
sched_ctx_hypervisor/Makefile.am

@@ -17,9 +17,11 @@ SUBDIRS = src examples
 
 versincludedir = $(includedir)/starpu/$(STARPU_EFFECTIVE_VERSION)
 
-versinclude_HEADERS = 	include/sched_ctx_hypervisor.h \
-			include/sched_ctx_hypervisor_config.h \
-			include/sched_ctx_hypervisor_monitoring.h
+versinclude_HEADERS = 	include/sched_ctx_hypervisor.h 			\
+			include/sched_ctx_hypervisor_config.h 		\
+			include/sched_ctx_hypervisor_monitoring.h 	\
+			include/sched_ctx_hypervisor_policy.h 		\
+			include/sched_ctx_hypervisor_lp.h
 showcheck:
 	for i in $(SUBDIRS) ; do \
 		make -C $$i showcheck ; \

+ 1 - 1
sched_ctx_hypervisor/examples/lp_test/lp_test.c

@@ -91,7 +91,7 @@ int main()
 	/* indicate which strategy to use
 	   in this particular case we use app_driven which allows the user to resize 
 	   the ctxs dynamically at particular moments of the execution of the application */
-	policy.name = "lp";
+	policy.name = "feft_lp";
 	void *perf_counters = sched_ctx_hypervisor_init(&policy);
 
 	/* let starpu know which performance counters should use 

+ 17 - 3
sched_ctx_hypervisor/src/hypervisor_policies/lp_tools.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2012  INRIA
+ * Copyright (C) 2010-2013  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
@@ -14,9 +14,17 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include "policy_tools.h"
+#ifndef SCHED_CTX_HYPERVISOR_LP_H
+#define SCHED_CTX_HYPERVISOR_LP_H
+
+#include <sched_ctx_hypervisor.h>
 #include <starpu_config.h>
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 /*
  * GNU Linear Programming Kit backend
  */
@@ -47,4 +55,10 @@ void _lp_distribute_resources_in_ctxs(int* sched_ctxs, int ns, int nw, int res_r
 void _lp_place_resources_in_ctx(int ns, int nw, double w_in_s[ns][nw], int *sched_ctxs, int *workers, unsigned do_size);
 
 /* dichotomy btw t1 & t2 */
-double _find_tmax(double t1, double t2);
+double _lp_find_tmax(double t1, double t2);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 15 - 0
sched_ctx_hypervisor/src/hypervisor_policies/policy_tools.h

@@ -14,8 +14,17 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
+#ifndef SCHED_CTX_HYPERVISOR_POLICY_H
+#define SCHED_CTX_HYPERVISOR_POLICY_H
+
 #include <sched_ctx_hypervisor.h>
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
 #define HYPERVISOR_REDIM_SAMPLE 0.02
 #define HYPERVISOR_START_REDIM_SAMPLE 0.1
 
@@ -62,3 +71,9 @@ double _get_ref_velocity_per_worker_type(struct sched_ctx_hypervisor_wrapper* sc
 int _velocity_gap_btw_ctxs(void);
 
 void _get_total_nw(int *workers, int nworkers, int ntypes_of_workers, int total_nw[ntypes_of_workers]);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 4 - 6
sched_ctx_hypervisor/src/Makefile.am

@@ -24,20 +24,18 @@ libsched_ctx_hypervisor_la_LIBADD = $(top_builddir)/src/libstarpu-@STARPU_EFFECT
 libsched_ctx_hypervisor_la_SOURCES = 			\
 	sched_ctx_hypervisor.c				\
 	sched_ctx_config.c				\
-	hypervisor_policies/policy_tools.c		\
-	hypervisor_policies/lp_tools.c			\
+	policies_utils/policy_tools.c			\
+	policies_utils/lp_tools.c			\
 	hypervisor_policies/idle_policy.c		\
 	hypervisor_policies/app_driven_policy.c		\
 	hypervisor_policies/gflops_rate_policy.c	\
-	hypervisor_policies/feft_lp_policy.c			\
+	hypervisor_policies/feft_lp_policy.c		\
 	hypervisor_policies/teft_lp_policy.c		\
 	hypervisor_policies/ispeed_policy.c		\
 	hypervisor_policies/ispeed_lp_policy.c		\
 	hypervisor_policies/debit_lp_policy.c
 
-noinst_HEADERS = sched_ctx_hypervisor_intern.h		\
-	hypervisor_policies/policy_tools.h		\
-	hypervisor_policies/lp_tools.h
+noinst_HEADERS = sched_ctx_hypervisor_intern.h		
 
 showcheck:
 	-cat /dev/null

+ 1 - 4
sched_ctx_hypervisor/src/hypervisor_policies/app_driven_policy.c

@@ -13,10 +13,7 @@
  *
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
-
-#include "policy_tools.h"
-
-#include <sched_ctx_hypervisor_intern.h>
+#include <sched_ctx_hypervisor_policy.h>
 
 static void app_driven_handle_post_exec_hook(unsigned sched_ctx, int task_tag)
 {

+ 2 - 1
sched_ctx_hypervisor/src/hypervisor_policies/debit_lp_policy.c

@@ -15,7 +15,8 @@
  */
 
 #include <starpu_config.h>
-#include "lp_tools.h"
+#include "sched_ctx_hypervisor_lp.h"
+#include "sched_ctx_hypervisor_policy.h"
 #include <math.h>
 #include <sys/time.h>
 

+ 1 - 1
sched_ctx_hypervisor/src/hypervisor_policies/feft_lp_policy.c

@@ -14,7 +14,7 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include "lp_tools.h"
+#include "sched_ctx_hypervisor_lp.h"
 #include <starpu_config.h>
 #include <sys/time.h>
 

+ 1 - 1
sched_ctx_hypervisor/src/hypervisor_policies/gflops_rate_policy.c

@@ -14,7 +14,7 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include "policy_tools.h"
+#include "sched_ctx_hypervisor_policy.h"
 
 static double _get_total_elapsed_flops_per_sched_ctx(unsigned sched_ctx)
 {

+ 1 - 1
sched_ctx_hypervisor/src/hypervisor_policies/idle_policy.c

@@ -14,7 +14,7 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include "policy_tools.h"
+#include "sched_ctx_hypervisor_policy.h"
 
 unsigned worker_belong_to_other_sched_ctx(unsigned sched_ctx, int worker)
 {

+ 4 - 3
sched_ctx_hypervisor/src/hypervisor_policies/ispeed_lp_policy.c

@@ -15,7 +15,8 @@
  */
 
 #include <starpu_config.h>
-#include "lp_tools.h"
+#include "sched_ctx_hypervisor_lp.h"
+#include "sched_ctx_hypervisor_policy.h"
 #include <math.h>
 #include <sys/time.h>
 
@@ -123,13 +124,13 @@ static unsigned _compute_flops_distribution_over_ctxs(int ns, int nw, double w_i
 				tmax = old_tmax;
 		}
 		if(tmin == tmax) break;
-		tmax = _find_tmax(tmin, tmax);
+		tmax = _lp_find_tmax(tmin, tmax);
 
 		if(tmax < smallest_tmax)
 		{
 			tmax = old_tmax;
 			tmin = smallest_tmax;
-			tmax = _find_tmax(tmin, tmax);
+			tmax = _lp_find_tmax(tmin, tmax);
 		}
 		nd++;
 	}

+ 1 - 1
sched_ctx_hypervisor/src/hypervisor_policies/ispeed_policy.c

@@ -14,7 +14,7 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include "policy_tools.h"
+#include "sched_ctx_hypervisor_policy.h"
 
 static unsigned _get_fastest_sched_ctx(void)
 {

+ 14 - 13
sched_ctx_hypervisor/src/hypervisor_policies/teft_lp_policy.c

@@ -15,7 +15,8 @@
  */
 
 #include <starpu_config.h>
-#include "lp_tools.h"
+#include "sched_ctx_hypervisor_lp.h"
+#include "sched_ctx_hypervisor_policy.h"
 #include <math.h>
 #include <sys/time.h>
 
@@ -99,13 +100,13 @@ static unsigned _compute_task_distribution_over_ctxs(int ns, int nw, int nt, dou
 				tmax = old_tmax;
 		}
 		if(tmin == tmax) break;
-		tmax = _find_tmax(tmin, tmax);
+		tmax = _lp_find_tmax(tmin, tmax);
 
 		if(tmax < smallest_tmax)
 		{
 			tmax = old_tmax;
 			tmin = smallest_tmax;
-			tmax = _find_tmax(tmin, tmax);
+			tmax = _lp_find_tmax(tmin, tmax);
 		}
 		nd++;
 	}
@@ -241,6 +242,16 @@ static void _remove_task_from_pool(struct starpu_task *task, uint32_t footprint)
 	}
 }
 
+static struct bound_task_pool* _clone_linked_list(struct bound_task_pool *tp)
+{
+	if(tp == NULL) return NULL;
+
+	struct bound_task_pool *tmp_tp = (struct bound_task_pool*)malloc(sizeof(struct bound_task_pool));
+	memcpy(tmp_tp, tp, sizeof(struct bound_task_pool));
+	tmp_tp->next = _clone_linked_list(tp->next);
+	return tmp_tp;
+}
+
 static void _get_tasks_times(int nw, int nt, double times[nw][nt], int *workers, unsigned size_ctxs)
 {
         struct bound_task_pool *tp;
@@ -516,16 +527,6 @@ static double _glp_resolve(int ns, int nw, int nt, double tasks[nw][nt], double
 	return res;
 }
 
-static struct bound_task_pool* _clone_linked_list(struct bound_task_pool *tp)
-{
-	if(tp == NULL) return NULL;
-
-	struct bound_task_pool *tmp_tp = (struct bound_task_pool*)malloc(sizeof(struct bound_task_pool));
-	memcpy(tmp_tp, tp, sizeof(struct bound_task_pool));
-	tmp_tp->next = _clone_linked_list(tp->next);
-	return tmp_tp;
-}
-
 static void teft_lp_handle_poped_task(unsigned sched_ctx, int worker, struct starpu_task *task, uint32_t footprint)
 {
 	struct sched_ctx_hypervisor_wrapper* sc_w = sched_ctx_hypervisor_get_wrapper(sched_ctx);

+ 3 - 2
sched_ctx_hypervisor/src/hypervisor_policies/lp_tools.c

@@ -15,7 +15,8 @@
  */
 
 #include <math.h>
-#include "lp_tools.h"
+#include "sched_ctx_hypervisor_lp.h"
+#include "sched_ctx_hypervisor_policy.h"
 #include <starpu_config.h>
 
 #ifdef STARPU_HAVE_GLPK_H
@@ -697,7 +698,7 @@ void _lp_place_resources_in_ctx(int ns, int nw, double w_in_s[ns][nw], int *sche
 	return;
 }
 
-double _find_tmax(double t1, double t2)
+double _lp_find_tmax(double t1, double t2)
 {
 	return t1 + ((t2 - t1)/2);
 }

+ 2 - 3
sched_ctx_hypervisor/src/hypervisor_policies/policy_tools.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2012  INRIA
+ * Copyright (C) 2010-2013  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
@@ -14,9 +14,8 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-/* #include <sched_ctx_hypervisor.h> */
 
-#include "policy_tools.h"
+#include "sched_ctx_hypervisor_policy.h"
 
 static int _compute_priority(unsigned sched_ctx)
 {