Bläddra i källkod

small fixes + commented all use of htbl32 (resize policies using it does not work)

Andra Hugo 12 år sedan
förälder
incheckning
e12ffc4fa4

+ 2 - 1
include/starpu.h

@@ -71,7 +71,8 @@ enum starpu_archtype
 	STARPU_CPU_WORKER,    /* CPU core */
 	STARPU_CUDA_WORKER,   /* NVIDIA CUDA device */
 	STARPU_OPENCL_WORKER, /* OpenCL device */
-	STARPU_GORDON_WORKER  /* Cell SPU */
+	STARPU_GORDON_WORKER,  /* Cell SPU */
+	STARPU_ALL
 };
 
 struct starpu_driver

+ 2 - 0
include/starpu_task_util.h

@@ -44,6 +44,8 @@ void starpu_create_sync_task(starpu_tag_t sync_tag, unsigned ndeps, starpu_tag_t
 #define STARPU_EXECUTE_ON_DATA	(1<<10)	/* Used by MPI to define which task is going to execute the codelet */
 #define STARPU_DATA_ARRAY       (1<<11) /* Array of data handles */
 #define STARPU_TAG       (1<<12) /* Tag */
+#define STARPU_HYPERVISOR_TAG	(1<<13)	/* Used to tag a task after whose execution we'll execute  a code */
+#define STARPU_HYPERVISOR_FLOPS	(1<<14)	/* Used to specify the number of flops needed to be executed by a task */
 
 /* Wrapper to create a task. */
 int starpu_insert_task(struct starpu_codelet *cl, ...);

+ 0 - 11
include/starpu_util.h

@@ -250,17 +250,6 @@ void starpu_execute_on_specific_workers(void (*func)(void*), void * arg, unsigne
  * copied, and it is given the callback_arg pointer as argument.*/
 int starpu_data_cpy(starpu_data_handle_t dst_handle, starpu_data_handle_t src_handle, int asynchronous, void (*callback_func)(void*), void *callback_arg);
 
-/* Constants used by the starpu_insert_task helper to determine the different types of argument */
-#define STARPU_VALUE		(1<<4)	/* Pointer to a constant value */
-#define STARPU_CALLBACK		(1<<5)	/* Callback function */
-#define STARPU_CALLBACK_WITH_ARG	(1<<6)	/* Callback function */
-#define STARPU_CALLBACK_ARG	(1<<7)	/* Argument of the callback function (of type void *) */
-#define STARPU_PRIORITY		(1<<8)	/* Priority associated to the task */
-#define STARPU_EXECUTE_ON_NODE	(1<<9)	/* Used by MPI to define which task is going to execute the codelet */
-#define STARPU_EXECUTE_ON_DATA	(1<<10)	/* Used by MPI to define which task is going to execute the codelet */
-#define STARPU_HYPERVISOR_TAG	(1<<11)	/* Used to tag a task after whose execution we'll execute  a code */
-#define STARPU_HYPERVISOR_FLOPS	(1<<12)	/* Used to specify the number of flops needed to be executed by a task */
-
 /* Wrapper to create a task. */
 int starpu_insert_task(struct starpu_codelet *cl, ...);
 

+ 1 - 1
libstarpu.pc.in

@@ -26,4 +26,4 @@ Cflags: -I${includedir}/starpu/@STARPU_EFFECTIVE_VERSION@ @STARPU_CUDA_CPPFLAGS@
 Libs: -L${libdir} -lstarpu-@STARPU_EFFECTIVE_VERSION@ @STARPU_CUDA_LDFLAGS@ @STARPU_OPENCL_LDFLAGS@ @STARPU_SCHED_CTX_HYPERVISOR@
 Libs.private: @LDFLAGS@ @LIBS@
 Requires: @HWLOC_REQUIRES@
-Requires.private: @GORDON_REQUIRES@
+#Requires.private: @GORDON_REQUIRES@

+ 1 - 1
sched_ctx_hypervisor/include/sched_ctx_hypervisor.h

@@ -100,7 +100,7 @@ struct hypervisor_policy {
 	void (*handle_pushed_task)(unsigned sched_ctx, int worker);
 	void (*handle_poped_task)(unsigned sched_ctx, int worker);
 	void (*handle_idle_end)(unsigned sched_ctx, int worker);
-	void (*handle_post_exec_hook)(unsigned sched_ctx, struct starpu_htbl32_node* resize_requests, int task_tag);
+//	void (*handle_post_exec_hook)(unsigned sched_ctx, struct starpu_htbl32_node* resize_requests, int task_tag);
 	void (*handle_submitted_job)(struct starpu_task *task, unsigned footprint);
 };
 

+ 10 - 10
sched_ctx_hypervisor/src/hypervisor_policies/app_driven_policy.c

@@ -16,16 +16,16 @@
 
 #include "policy_tools.h"
 
-void app_driven_handle_post_exec_hook(unsigned sched_ctx, struct starpu_htbl32_node_s* resize_requests, int task_tag)
-{
-	void* sched_ctx_pt =  _starpu_htbl_search_32(resize_requests, (uint32_t)task_tag);
-	if(sched_ctx_pt && sched_ctx_pt != resize_requests)
-	{
-		_resize_to_unknown_receiver(sched_ctx, 1);
-		_starpu_htbl_insert_32(&resize_requests, (uint32_t)task_tag, NULL);
-	}
+/* void app_driven_handle_post_exec_hook(unsigned sched_ctx, struct starpu_htbl32_node_s* resize_requests, int task_tag) */
+/* { */
+/* 	void* sched_ctx_pt =  _starpu_htbl_search_32(resize_requests, (uint32_t)task_tag); */
+/* 	if(sched_ctx_pt && sched_ctx_pt != resize_requests) */
+/* 	{ */
+/* 		_resize_to_unknown_receiver(sched_ctx, 1); */
+/* 		_starpu_htbl_insert_32(&resize_requests, (uint32_t)task_tag, NULL); */
+/* 	} */
 
-}
+/* } */
 
 struct hypervisor_policy app_driven_policy = {
 	.size_ctxs = NULL,
@@ -33,7 +33,7 @@ struct hypervisor_policy app_driven_policy = {
 	.handle_pushed_task = NULL,
 	.handle_idle_cycle = NULL,
 	.handle_idle_end = NULL,
-	.handle_post_exec_hook = app_driven_handle_post_exec_hook,
+//	.handle_post_exec_hook = app_driven_handle_post_exec_hook,
 	.handle_submitted_job = NULL,
 	.custom = 0,
 	.name = "app_driven"

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

@@ -260,7 +260,7 @@ static void gflops_rate_resize(unsigned sched_ctx)
 				config->min_nworkers = 0;
 				config->max_nworkers = 0;
 				printf("ctx %d finished & gives away the res to %d; slow_left %lf\n", sched_ctx, slowest_sched_ctx, slowest_flops_left_pct);
-				_resize(sched_ctx, slowest_sched_ctx, 1);
+				_resize(sched_ctx, slowest_sched_ctx, 1, 1);
 				sched_ctx_hypervisor_stop_resize(slowest_sched_ctx);
 			}
 		}
@@ -300,7 +300,7 @@ struct hypervisor_policy gflops_rate_policy = {
 	.handle_pushed_task = NULL,
 	.handle_idle_cycle = NULL,
 	.handle_idle_end = NULL,
-	.handle_post_exec_hook = NULL,
+//	.handle_post_exec_hook = NULL,
 	.handle_submitted_job = NULL,
 	.custom = 0,
 	.name = "gflops_rate"

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

@@ -47,7 +47,7 @@ struct hypervisor_policy idle_policy = {
 	.handle_pushed_task = NULL,
 	.handle_idle_cycle = idle_handle_idle_cycle,
 	.handle_idle_end = NULL,
-	.handle_post_exec_hook = NULL,
+//	.handle_post_exec_hook = NULL,
 	.handle_submitted_job = NULL,
 	.custom = 0,
 	.name = "idle"

+ 202 - 199
sched_ctx_hypervisor/src/hypervisor_policies/lp2_policy.c

@@ -20,6 +20,206 @@
 static struct bound_task_pool *task_pools = NULL;
 
 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+static double _glp_resolve(int ns, int nw, int nt, double tasks[nw][nt], double tmax, double w_in_s[ns][nw], int *in_sched_ctxs, int *workers);
+static double _find_tmax(double t1, double t2);
+static unsigned _compute_task_distribution_over_ctxs(int ns, int nw, int nt, double w_in_s[ns][nw], double tasks[nw][nt], int *sched_ctxs, int *workers)
+{	
+	double draft_tasks[nw][nt];
+	double draft_w_in_s[ns][nw];
+	
+	int w,t, s;
+	for(w = 0; w < nw; w++)
+		for(t = 0; t < nt; t++)
+		{
+			tasks[w][t] = 0.0;
+			draft_tasks[w][t] == 0.0;
+		}
+	
+	for(s = 0; s < ns; s++)
+		for(w = 0; w < nw; w++)
+		{
+			w_in_s[s][w] = 0.0;
+			draft_w_in_s[s][w] = 0.0;
+		}
+
+	/* smallest possible tmax, difficult to obtain as we 
+	   compute the nr of flops and not the tasks */
+	double smallest_tmax = _lp_get_tmax(nw, workers);
+	double tmax = smallest_tmax * ns;
+	
+	double res = 1.0;
+	unsigned has_sol = 0;
+	double tmin = 0.0;
+	double old_tmax = 0.0;
+	unsigned found_sol = 0;
+
+	struct timeval start_time;
+	struct timeval end_time;
+	int nd = 0;
+	gettimeofday(&start_time, NULL);
+
+	/* we fix tmax and we do not treat it as an unknown
+	   we just vary by dichotomy its values*/
+	while(tmax > 1.0)
+	{
+		/* find solution and save the values in draft tables
+		   only if there is a solution for the system we save them
+		   in the proper table */
+		res = _glp_resolve(ns, nw, nt, draft_tasks, tmax, draft_w_in_s, sched_ctxs, workers);
+		if(res != 0.0)
+		{
+			for(w = 0; w < nw; w++)
+				for(t = 0; t < nt; t++)
+					tasks[w][t] = draft_tasks[w][t];
+			for(s = 0; s < ns; s++)
+				for(w = 0; w < nw; w++)
+					w_in_s[s][w] = draft_w_in_s[s][w];
+			has_sol = 1;
+			found_sol = 1;
+		}
+		else
+			has_sol = 0;
+		
+		/* if we have a solution with this tmax try a smaller value
+		   bigger than the old min */
+		if(has_sol)
+		{
+			if(old_tmax != 0.0 && (old_tmax - tmax) < 0.5)
+				break;
+			old_tmax = tmax;
+		}
+		else /*else try a bigger one but smaller than the old tmax */
+		{
+			tmin = tmax;
+			if(old_tmax != 0.0)
+				tmax = old_tmax;
+		}
+		if(tmin == tmax) break;
+		tmax = _find_tmax(tmin, tmax);
+		
+		if(tmax < smallest_tmax)
+		{
+			tmax = old_tmax;
+			tmin = smallest_tmax;
+			tmax = _find_tmax(tmin, tmax);
+		}
+		nd++;
+	}
+	gettimeofday(&end_time, NULL);
+
+	long diff_s = end_time.tv_sec  - start_time.tv_sec;
+        long diff_us = end_time.tv_usec  - start_time.tv_usec;
+
+        float timing = (float)(diff_s*1000000 + diff_us)/1000;
+
+        fprintf(stdout, "nd = %d total time: %f ms \n", nd, timing);
+
+	return found_sol;
+}
+
+static void _redistribute_resources_in_ctxs(int ns, int nw, int nt, double w_in_s[ns][nw], unsigned first_time, int *in_sched_ctxs, int *workers)
+{
+	int *sched_ctxs = in_sched_ctxs == NULL ? sched_ctx_hypervisor_get_sched_ctxs() : in_sched_ctxs;
+        struct bound_task_pool * tp;
+	int s, s2, w, t;
+
+	for(s = 0; s < ns; s++)
+	{
+		int workers_to_add[nw], workers_to_remove[nw];
+		int destination_ctx[nw][ns];
+
+		for(w = 0; w < nw; w++)
+		{
+			workers_to_add[w] = -1;
+			workers_to_remove[w] = -1;
+			for(s2 = 0; s2 < ns; s2++)
+				destination_ctx[w][s2] = -1;
+		}
+
+		int nadd = 0, nremove = 0;
+
+		for(w = 0; w < nw; w++)
+		{
+			enum starpu_perf_archtype arch = workers == NULL ? starpu_worker_get_type(w) :
+				starpu_worker_get_type(workers[w]);
+
+			if(arch == STARPU_CPU_WORKER)
+			{
+				if(w_in_s[s][w] >= 0.5)
+				{
+					workers_to_add[nadd++] = workers == NULL ? w : workers[w];
+				}
+				else
+				{
+					workers_to_remove[nremove++] = workers == NULL ? w : workers[w];
+					for(s2 = 0; s2 < ns; s2++)
+						if(s2 != s && w_in_s[s2][w] >= 0.5)
+							destination_ctx[w][s2] = 1;
+						else
+							destination_ctx[w][s2] = 0;	
+				}
+			}
+			else
+			{
+				if(w_in_s[s][w] >= 0.3)
+				{
+					workers_to_add[nadd++] = workers == NULL ? w : workers[w];
+				}
+				else
+				{
+					workers_to_remove[nremove++] = workers == NULL ? w : workers[w];
+					for(s2 = 0; s2 < ns; s2++)
+						if(s2 != s && w_in_s[s2][w] >= 0.3)
+							destination_ctx[w][s2] = 1;
+						else
+							destination_ctx[w][s2] = 0;
+				}
+			}
+	
+		}
+
+		sched_ctx_hypervisor_add_workers_to_sched_ctx(workers_to_add, nadd, sched_ctxs[s]);
+		struct policy_config *new_config = sched_ctx_hypervisor_get_config(sched_ctxs[s]);
+		int i;
+		for(i = 0; i < nadd; i++)
+			new_config->max_idle[workers_to_add[i]] = new_config->max_idle[workers_to_add[i]] != MAX_IDLE_TIME ? new_config->max_idle[workers_to_add[i]] :  new_config->new_workers_max_idle;
+		
+		if(!first_time)
+		{
+			/* do not remove workers if they can't go anywhere */
+			int w2;
+			unsigned found_one_dest[nremove];
+			unsigned all_have_dest = 1;
+			for(w2 = 0; w2 < nremove; w2++)
+				found_one_dest[w2] = 0;
+
+			for(w2 = 0; w2 < nremove; w2++)
+				for(s2 = 0; s2 < ns; s2++)
+				{
+					/* if the worker has to be removed we should find a destination
+					   otherwise we are not interested */
+					if(destination_ctx[w2][s2] == -1)
+						found_one_dest[w2] = -1;
+					if(destination_ctx[w2][s2] == 1)// && sched_ctx_hypervisor_can_resize(sched_ctxs[s2]))
+					{
+						found_one_dest[w2] = 1;
+						break;
+					}
+				}
+			for(w2 = 0; w2 < nremove; w2++)
+			{
+				if(found_one_dest[w2] == 0)
+				{
+					all_have_dest = 0;
+					break;
+				}
+			}
+			if(all_have_dest)
+				sched_ctx_hypervisor_remove_workers_from_sched_ctx(workers_to_remove, nremove, sched_ctxs[s], 0);
+		}
+	}
+
+}
 
 static void _size_ctxs(int *sched_ctxs, int nsched_ctxs , int *workers, int nworkers)
 {
@@ -32,7 +232,7 @@ static void _size_ctxs(int *sched_ctxs, int nsched_ctxs , int *workers, int nwor
 	
 	double w_in_s[ns][nw];
 	
-	unsigned found_sol = _compute_task_distribution_over_ctxs(ns, nw, nt, w_in_s, sched_ctxs, workers);
+	unsigned found_sol = _compute_task_distribution_over_ctxs(ns, nw, nt, w_in_s, NULL, sched_ctxs, workers);
 	/* if we did find at least one solution redistribute the resources */
 	if(found_sol)
 		_redistribute_resources_in_ctxs(ns, nw, nt, w_in_s, 1, sched_ctxs, workers);
@@ -294,209 +494,12 @@ static double _glp_resolve(int ns, int nw, int nt, double tasks[nw][nt], double
 	return res;
 }
 
-static void _redistribute_resources_in_ctxs(int ns, int nw, int nt, double w_in_s[ns][nw], unsigned first_time, int *in_sched_ctxs, int *workers)
-{
-	int *sched_ctxs = in_sched_ctxs == NULL ? sched_ctx_hypervisor_get_sched_ctxs() : in_sched_ctxs;
-        struct bound_task_pool * tp;
-	int s, s2, w, t;
-
-	for(s = 0; s < ns; s++)
-	{
-		int workers_to_add[nw], workers_to_remove[nw];
-		int destination_ctx[nw][ns];
-
-		for(w = 0; w < nw; w++)
-		{
-			workers_to_add[w] = -1;
-			workers_to_remove[w] = -1;
-			for(s2 = 0; s2 < ns; s2++)
-				destination_ctx[w][s2] = -1;
-		}
-
-		int nadd = 0, nremove = 0;
-
-		for(w = 0; w < nw; w++)
-		{
-			enum starpu_perf_archtype arch = workers == NULL ? starpu_worker_get_type(w) :
-				starpu_worker_get_type(workers[w]);
-
-			if(arch == STARPU_CPU_WORKER)
-			{
-				if(w_in_s[s][w] >= 0.5)
-				{
-					workers_to_add[nadd++] = workers == NULL ? w : workers[w];
-				}
-				else
-				{
-					workers_to_remove[nremove++] = workers == NULL ? w : workers[w];
-					for(s2 = 0; s2 < ns; s2++)
-						if(s2 != s && w_in_s[s2][w] >= 0.5)
-							destination_ctx[w][s2] = 1;
-						else
-							destination_ctx[w][s2] = 0;	
-				}
-			}
-			else
-			{
-				if(w_in_s[s][w] >= 0.3)
-				{
-					workers_to_add[nadd++] = workers == NULL ? w : workers[w];
-				}
-				else
-				{
-					workers_to_remove[nremove++] = workers == NULL ? w : workers[w];
-					for(s2 = 0; s2 < ns; s2++)
-						if(s2 != s && w_in_s[s2][w] >= 0.3)
-							destination_ctx[w][s2] = 1;
-						else
-							destination_ctx[w][s2] = 0;
-				}
-			}
-	
-		}
-
-		sched_ctx_hypervisor_add_workers_to_sched_ctx(workers_to_add, nadd, sched_ctxs[s]);
-		struct policy_config *new_config = sched_ctx_hypervisor_get_config(sched_ctxs[s]);
-		int i;
-		for(i = 0; i < nadd; i++)
-			new_config->max_idle[workers_to_add[i]] = new_config->max_idle[workers_to_add[i]] != MAX_IDLE_TIME ? new_config->max_idle[workers_to_add[i]] :  new_config->new_workers_max_idle;
-		
-		if(!first_time)
-		{
-			/* do not remove workers if they can't go anywhere */
-			int w2;
-			unsigned found_one_dest[nremove];
-			unsigned all_have_dest = 1;
-			for(w2 = 0; w2 < nremove; w2++)
-				found_one_dest[w2] = 0;
-
-			for(w2 = 0; w2 < nremove; w2++)
-				for(s2 = 0; s2 < ns; s2++)
-				{
-					/* if the worker has to be removed we should find a destination
-					   otherwise we are not interested */
-					if(destination_ctx[w2][s2] == -1)
-						found_one_dest[w2] = -1;
-					if(destination_ctx[w2][s2] == 1)// && sched_ctx_hypervisor_can_resize(sched_ctxs[s2]))
-					{
-						found_one_dest[w2] = 1;
-						break;
-					}
-				}
-			for(w2 = 0; w2 < nremove; w2++)
-			{
-				if(found_one_dest[w2] == 0)
-				{
-					all_have_dest = 0;
-					break;
-				}
-			}
-			if(all_have_dest)
-				sched_ctx_hypervisor_remove_workers_from_sched_ctx(workers_to_remove, nremove, sched_ctxs[s], 0);
-		}
-	}
-
-}
 
 static double _find_tmax(double t1, double t2)
 {
 	return t1 + ((t2 - t1)/2);
 }
 
-static unsigned _compute_task_distribution_over_ctxs(int ns, int nw, int nt, double w_in_s[ns][nw], double tasks[nw][nt], int *sched_ctxs, int *workers)
-{	
-	double draft_tasks[nw][nt];
-	double draft_w_in_s[ns][nw];
-	
-	int w,t, s;
-	for(w = 0; w < nw; w++)
-		for(t = 0; t < nt; t++)
-		{
-			tasks[w][t] = 0.0;
-			draft_tasks[w][t] == 0.0;
-		}
-	
-	for(s = 0; s < ns; s++)
-		for(w = 0; w < nw; w++)
-		{
-			w_in_s[s][w] = 0.0;
-			draft_w_in_s[s][w] = 0.0;
-		}
-
-	/* smallest possible tmax, difficult to obtain as we 
-	   compute the nr of flops and not the tasks */
-	double smallest_tmax = _lp_get_tmax(nw, workers);
-	double tmax = smallest_tmax * ns;
-	
-	double res = 1.0;
-	unsigned has_sol = 0;
-	double tmin = 0.0;
-	double old_tmax = 0.0;
-	unsigned found_sol = 0;
-
-	struct timeval start_time;
-	struct timeval end_time;
-	int nd = 0;
-	gettimeofday(&start_time, NULL);
-
-	/* we fix tmax and we do not treat it as an unknown
-	   we just vary by dichotomy its values*/
-	while(tmax > 1.0)
-	{
-		/* find solution and save the values in draft tables
-		   only if there is a solution for the system we save them
-		   in the proper table */
-		res = _glp_resolve(ns, nw, nt, draft_tasks, tmax, draft_w_in_s, sched_ctxs, workers);
-		if(res != 0.0)
-		{
-			for(w = 0; w < nw; w++)
-				for(t = 0; t < nt; t++)
-					tasks[w][t] = draft_tasks[w][t];
-			for(s = 0; s < ns; s++)
-				for(w = 0; w < nw; w++)
-					w_in_s[s][w] = draft_w_in_s[s][w];
-			has_sol = 1;
-			found_sol = 1;
-		}
-		else
-			has_sol = 0;
-		
-		/* if we have a solution with this tmax try a smaller value
-		   bigger than the old min */
-		if(has_sol)
-		{
-			if(old_tmax != 0.0 && (old_tmax - tmax) < 0.5)
-				break;
-			old_tmax = tmax;
-		}
-		else /*else try a bigger one but smaller than the old tmax */
-		{
-			tmin = tmax;
-			if(old_tmax != 0.0)
-				tmax = old_tmax;
-		}
-		if(tmin == tmax) break;
-		tmax = _find_tmax(tmin, tmax);
-		
-		if(tmax < smallest_tmax)
-		{
-			tmax = old_tmax;
-			tmin = smallest_tmax;
-			tmax = _find_tmax(tmin, tmax);
-		}
-		nd++;
-	}
-	gettimeofday(&end_time, NULL);
-
-	long diff_s = end_time.tv_sec  - start_time.tv_sec;
-        long diff_us = end_time.tv_usec  - start_time.tv_usec;
-
-        float timing = (float)(diff_s*1000000 + diff_us)/1000;
-
-        fprintf(stdout, "nd = %d total time: %f ms \n", nd, timing);
-
-	return found_sol;
-}
 
 static void lp2_handle_poped_task(unsigned sched_ctx, int worker)
 {
@@ -583,7 +586,7 @@ struct hypervisor_policy lp2_policy = {
 	.handle_pushed_task = NULL,
 	.handle_idle_cycle = NULL,
 	.handle_idle_end = NULL,
-	.handle_post_exec_hook = NULL,
+//	.handle_post_exec_hook = NULL,
 	.handle_submitted_job = lp2_handle_submitted_job,
 	.custom = 0,
 	.name = "lp2"

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

@@ -106,7 +106,7 @@ struct hypervisor_policy lp_policy = {
 	.handle_pushed_task = NULL,
 	.handle_idle_cycle = NULL,
 	.handle_idle_end = NULL,
-	.handle_post_exec_hook = NULL,
+//	.handle_post_exec_hook = NULL,
 	.handle_submitted_job = NULL,
 	.custom = 0,
 	.name = "lp"

+ 1 - 1
sched_ctx_hypervisor/src/hypervisor_policies/policy_tools.h

@@ -28,7 +28,7 @@ unsigned _get_potential_nworkers(struct policy_config *config, unsigned sched_ct
 
 unsigned _get_nworkers_to_move(unsigned req_sched_ctx);
 
-unsigned _resize(unsigned sender_sched_ctx, unsigned receiver_sched_ctx, unsigned force_resize);
+unsigned _resize(unsigned sender_sched_ctx, unsigned receiver_sched_ctx, unsigned force_resize, unsigned now);
 
 unsigned _resize_to_unknown_receiver(unsigned sender_sched_ctx, unsigned now);
 

+ 1 - 1
sched_ctx_hypervisor/src/sched_ctx_config.c

@@ -233,7 +233,7 @@ void sched_ctx_hypervisor_ioctl(unsigned sched_ctx, ...)
 	if(config != NULL)
 	{
 		pthread_mutex_lock(&hypervisor.conf_mut[sched_ctx]);
-		_starpu_htbl_insert_32(&hypervisor.configurations[sched_ctx], (uint32_t)task_tag, config);
+//		_starpu_htbl_insert_32(&hypervisor.configurations[sched_ctx], (uint32_t)task_tag, config);
 		pthread_mutex_unlock(&hypervisor.conf_mut[sched_ctx]);
 	}
 

+ 15 - 15
sched_ctx_hypervisor/src/sched_ctx_hypervisor.c

@@ -60,7 +60,7 @@ static void _load_hypervisor_policy(struct hypervisor_policy *policy)
 	hypervisor.policy.handle_pushed_task = policy->handle_pushed_task;
 	hypervisor.policy.handle_idle_cycle = policy->handle_idle_cycle;
 	hypervisor.policy.handle_idle_end = policy->handle_idle_end;
-	hypervisor.policy.handle_post_exec_hook = policy->handle_post_exec_hook;
+//	hypervisor.policy.handle_post_exec_hook = policy->handle_post_exec_hook;
 	hypervisor.policy.handle_submitted_job = policy->handle_submitted_job;
 }
 
@@ -223,8 +223,8 @@ void sched_ctx_hypervisor_shutdown(void)
 void sched_ctx_hypervisor_register_ctx(unsigned sched_ctx, double total_flops)
 {	
 	pthread_mutex_lock(&act_hypervisor_mutex);
-	hypervisor.configurations[sched_ctx] = (struct starpu_htbl32_node*)malloc(sizeof(struct starpu_htbl32_node));
-	hypervisor.resize_requests[sched_ctx] = (struct starpu_htbl32_node*)malloc(sizeof(struct starpu_htbl32_node));
+/* 	hypervisor.configurations[sched_ctx] = (struct starpu_htbl32_node*)malloc(sizeof(struct starpu_htbl32_node)); */
+/* 	hypervisor.resize_requests[sched_ctx] = (struct starpu_htbl32_node*)malloc(sizeof(struct starpu_htbl32_node)); */
 	pthread_mutex_init(&hypervisor.conf_mut[sched_ctx], NULL);
 	pthread_mutex_init(&hypervisor.resize_mut[sched_ctx], NULL);
 
@@ -627,7 +627,7 @@ static unsigned _ack_resize_completed(unsigned sched_ctx, int worker)
 void sched_ctx_hypervisor_resize(unsigned sched_ctx, int task_tag)
 {
 	pthread_mutex_lock(&hypervisor.resize_mut[sched_ctx]);
-	_starpu_htbl_insert_32(&hypervisor.resize_requests[sched_ctx], (uint32_t)task_tag, (void*)sched_ctx);	
+//	_starpu_htbl_insert_32(&hypervisor.resize_requests[sched_ctx], (uint32_t)task_tag, (void*)sched_ctx);	
 	pthread_mutex_unlock(&hypervisor.resize_mut[sched_ctx]);
 }
 
@@ -708,24 +708,24 @@ static void notify_post_exec_hook(unsigned sched_ctx, int task_tag)
 	{
 		conf_sched_ctx = hypervisor.sched_ctxs[i];
 		pthread_mutex_lock(&hypervisor.conf_mut[conf_sched_ctx]);
-		void *_config = _starpu_htbl_search_32(hypervisor.configurations[conf_sched_ctx], (uint32_t)task_tag);
-
-		if(_config)// && config != hypervisor.configurations[conf_sched_ctx])
-		{
-			sched_ctx_hypervisor_set_config(conf_sched_ctx, _config);
-			free(_config);
-			_starpu_htbl_insert_32(&hypervisor.configurations[sched_ctx], (uint32_t)task_tag, NULL);
-		}
+/* 		void *_config = _starpu_htbl_search_32(hypervisor.configurations[conf_sched_ctx], (uint32_t)task_tag); */
+
+/* 		if(_config)// && config != hypervisor.configurations[conf_sched_ctx]) */
+/* 		{ */
+/* 			sched_ctx_hypervisor_set_config(conf_sched_ctx, _config); */
+/* 			free(_config); */
+/* 			_starpu_htbl_insert_32(&hypervisor.configurations[sched_ctx], (uint32_t)task_tag, NULL); */
+/* 		} */
 		pthread_mutex_unlock(&hypervisor.conf_mut[conf_sched_ctx]);
 	}	
 		
 	if(hypervisor.resize[sched_ctx])
 	{
 		pthread_mutex_lock(&hypervisor.resize_mut[sched_ctx]);
-		struct starpu_htbl32_node* resize_requests = hypervisor.resize_requests[sched_ctx];
+/* 		struct starpu_htbl32_node* resize_requests = hypervisor.resize_requests[sched_ctx]; */
 		
-		if(hypervisor.policy.handle_post_exec_hook)
-			hypervisor.policy.handle_post_exec_hook(sched_ctx, resize_requests, task_tag);
+/* 		if(hypervisor.policy.handle_post_exec_hook) */
+/* 			hypervisor.policy.handle_post_exec_hook(sched_ctx, resize_requests, task_tag); */
 		pthread_mutex_unlock(&hypervisor.resize_mut[sched_ctx]);
 	}
 	return;

+ 4 - 1
sched_ctx_hypervisor/src/sched_ctx_hypervisor_intern.h

@@ -15,7 +15,10 @@
  */
 
 #include <sched_ctx_hypervisor.h>
-#include <common/htable32.h>
+#include <common/uthash.h>
+
+#define HASH_ADD_UINT32_T(head,field,add) HASH_ADD(hh,head,field,sizeof(uint32_t),add)
+#define HASH_FIND_UINT32_T(head,find,out) HASH_FIND(hh,head,find,sizeof(uint32_t),out)
 
 struct size_request {
 	int *workers;

+ 8 - 8
src/core/jobs.c

@@ -342,29 +342,29 @@ unsigned _starpu_enforce_deps_and_schedule(struct _starpu_job *j)
 	if (_starpu_not_all_tag_deps_are_fulfilled(j))
 	{
 		_STARPU_PTHREAD_MUTEX_UNLOCK(&j->sync_mutex);
-                _STARPU_LOG_OUT_TAG("not_all_tag_deps_are_fulfilled");
+		_STARPU_LOG_OUT_TAG("not_all_tag_deps_are_fulfilled");
 		return 0;
-        }
-
+	}
+	
 	/* enfore task dependencies */
 	if (_starpu_not_all_task_deps_are_fulfilled(j))
 	{
 		_STARPU_PTHREAD_MUTEX_UNLOCK(&j->sync_mutex);
-                _STARPU_LOG_OUT_TAG("not_all_task_deps_are_fulfilled");
+		_STARPU_LOG_OUT_TAG("not_all_task_deps_are_fulfilled");
 		return 0;
-        }
+	}
 	_STARPU_PTHREAD_MUTEX_UNLOCK(&j->sync_mutex);
 
 	/* enforce data dependencies */
 	if (_starpu_submit_job_enforce_data_deps(j))
 	{
-                _STARPU_LOG_OUT_TAG("enforce_data_deps");
+		_STARPU_LOG_OUT_TAG("enforce_data_deps");
 		return 0;
-        }
+	}
 
 	ret = _starpu_push_task(j);
 
-        _STARPU_LOG_OUT();
+	_STARPU_LOG_OUT();
 	return ret;
 }
 

+ 3 - 3
src/core/sched_ctx.c

@@ -96,9 +96,9 @@ static void _starpu_update_workers(int *workerids, int nworkers, int sched_ctx_i
 			worker[i]->tasks[sched_ctx_id]->destroy = 1;
 			worker[i]->tasks[sched_ctx_id]->control_task = 1;
 			int worker_sched_ctx_id = _starpu_worker_get_sched_ctx_id(worker[i], sched_ctx_id);
-                        /* if the ctx is not in the worker's list it means the update concerns the addition of ctxs*/
-                        if(worker_sched_ctx_id == STARPU_NMAX_SCHED_CTXS)
-                                worker[i]->tasks[sched_ctx_id]->priority = 1;
+			/* if the ctx is not in the worker's list it means the update concerns the addition of ctxs*/
+			if(worker_sched_ctx_id == STARPU_NMAX_SCHED_CTXS)
+				worker[i]->tasks[sched_ctx_id]->priority = 1;
 
 			_starpu_exclude_task_from_dag(worker[i]->tasks[sched_ctx_id]);
 

+ 8 - 8
src/core/sched_policy.c

@@ -336,8 +336,8 @@ int _starpu_push_task(struct _starpu_job *j)
 			}
 		}
 	}
-
-        _STARPU_LOG_IN();
+	
+	_STARPU_LOG_IN();
 
 	_starpu_increment_nready_tasks();
 	task->status = STARPU_TASK_READY;
@@ -349,11 +349,11 @@ int _starpu_push_task(struct _starpu_job *j)
 	if (task->cl == NULL)
 	{
 		_starpu_handle_job_termination(j, -1);
-                _STARPU_LOG_OUT_TAG("handle_job_termination");
+		_STARPU_LOG_OUT_TAG("handle_job_termination");
 		return 0;
 	}
 
-        int ret;
+	int ret;
 	if (STARPU_UNLIKELY(task->execute_on_a_specific_worker))
 	{
 		ret = _starpu_push_task_on_specific_worker(task, task->workerid);
@@ -369,11 +369,11 @@ int _starpu_push_task(struct _starpu_job *j)
 			ret = _starpu_push_task(j);
 		}
 	}
-
+	
 	_starpu_profiling_set_task_push_end_time(task);
-
-        _STARPU_LOG_OUT();
-        return ret;
+	
+	_STARPU_LOG_OUT();
+	return ret;
 }
 
 /*

+ 12 - 11
src/core/task.c

@@ -204,7 +204,7 @@ int _starpu_submit_job(struct _starpu_job *j)
 
 	struct starpu_task *task = j->task;
 
-        _STARPU_LOG_IN();
+	_STARPU_LOG_IN();
 	/* notify bound computation of a new task */
 	_starpu_bound_record(j);
 
@@ -224,7 +224,8 @@ int _starpu_submit_job(struct _starpu_job *j)
 	/* We retain handle reference count */
 	if (task->cl) {
 		unsigned i;
-		for (i=0; i<task->cl->nbuffers; i++) {
+		for (i=0; i<task->cl->nbuffers; i++) 
+		{
 			starpu_data_handle_t handle = task->handles[i];
 			_starpu_spin_lock(&handle->header_lock);
 			handle->busy_count++;
@@ -244,8 +245,8 @@ int _starpu_submit_job(struct _starpu_job *j)
 
 	int ret = _starpu_enforce_deps_and_schedule(j);
 
-        _STARPU_LOG_OUT();
-        return ret;
+	_STARPU_LOG_OUT();
+	return ret;
 }
 
 void _starpu_codelet_check_deprecated_fields(struct starpu_codelet *cl)
@@ -375,11 +376,11 @@ int starpu_task_submit(struct starpu_task *task)
 	{
 		/* Perhaps it is not possible to submit a synchronous
 		 * (blocking) task */
-                if (STARPU_UNLIKELY(!_starpu_worker_may_perform_blocking_calls()))
+		if (STARPU_UNLIKELY(!_starpu_worker_may_perform_blocking_calls()))
 		{
-                        _STARPU_LOG_OUT_TAG("EDEADLK");
+			_STARPU_LOG_OUT_TAG("EDEADLK");
 			return -EDEADLK;
-                }
+		}
 
 		task->detach = 0;
 	}
@@ -407,18 +408,18 @@ int starpu_task_submit(struct starpu_task *task)
 		/* Check the type of worker(s) required by the task exist */
 		if (!_starpu_worker_exists(task))
 		{
-                        _STARPU_LOG_OUT_TAG("ENODEV");
+			_STARPU_LOG_OUT_TAG("ENODEV");
 			return -ENODEV;
-                }
+		}
 
 		/* In case we require that a task should be explicitely
 		 * executed on a specific worker, we make sure that the worker
 		 * is able to execute this task.  */
 		if (task->execute_on_a_specific_worker && !starpu_combined_worker_can_execute_task(task->workerid, task, 0))
 		{
-                        _STARPU_LOG_OUT_TAG("ENODEV");
+			_STARPU_LOG_OUT_TAG("ENODEV");
 			return -ENODEV;
-                }
+		}
 
 		_starpu_detect_implicit_data_deps(task);
 

+ 1 - 0
src/sched_policies/heft.c

@@ -639,6 +639,7 @@ static int heft_push_task(struct starpu_task *task)
 
 	ret_val = _heft_push_task(task, 0, sched_ctx_id);
 	_STARPU_PTHREAD_MUTEX_UNLOCK(changing_ctx_mutex);
+
 	return ret_val;
 }
 

+ 1 - 1
starpu-1.0.pc.in

@@ -34,4 +34,4 @@ Libs: -L${libdir} -lstarpu-@STARPU_EFFECTIVE_VERSION@
 @STARPU_SCHED_CTX_HYPERVISOR@
 Libs.private: @LDFLAGS@ @LIBS@ @LIBSTARPU_LDFLAGS@
 Requires: @HWLOC_REQUIRES@
-Requires.private: @GORDON_REQUIRES@
+#Requires.private: @GORDON_REQUIRES@