Browse Source

renames public lp functions

Andra Hugo 12 years ago
parent
commit
214d5d3628

+ 8 - 8
sc_hypervisor/include/sc_hypervisor_lp.h

@@ -33,29 +33,29 @@ extern "C"
 #endif //STARPU_HAVE_GLPK_H
 
 /* returns 1/tmax, and computes in table res the nr of workers needed by each context st the system ends up in the smallest tmax*/
-double _lp_compute_nworkers_per_ctx(int nsched_ctxs, int ntypes_of_workers, double velocity[nsched_ctxs][ntypes_of_workers], double flops[nsched_ctxs], 
+double sc_hypervisor_lp_compute_nworkers_per_ctx(int nsched_ctxs, int ntypes_of_workers, double velocity[nsched_ctxs][ntypes_of_workers], double flops[nsched_ctxs], 
 				    double res[nsched_ctxs][ntypes_of_workers], int total_nw[ntypes_of_workers]);
 
 /* returns tmax, and computes in table res the nr of workers needed by each context st the system ends up in the smallest tmax*/
-double _lp_get_nworkers_per_ctx(int nsched_ctxs, int ntypes_of_workers, double res[nsched_ctxs][ntypes_of_workers], int total_nw[ntypes_of_workers]);
+double sc_hypervisor_lp_get_nworkers_per_ctx(int nsched_ctxs, int ntypes_of_workers, double res[nsched_ctxs][ntypes_of_workers], int total_nw[ntypes_of_workers]);
 
 /* returns tmax of the system */
-double _lp_get_tmax(int nw, int *workers);
+double sc_hypervisor_lp_get_tmax(int nw, int *workers);
 
 /* the linear programme determins a rational number of ressources for each ctx, we round them depending on the type of ressource */
-void _lp_round_double_to_int(int ns, int nw, double res[ns][nw], int res_rounded[ns][nw]);
+void sc_hypervisor_lp_round_double_to_int(int ns, int nw, double res[ns][nw], int res_rounded[ns][nw]);
 
 /* redistribute the ressource in contexts by assigning the first x available ressources to each one */
-void _lp_redistribute_resources_in_ctxs(int ns, int nw, int res_rounded[ns][nw], double res[ns][nw]);
+void sc_hypervisor_lp_redistribute_resources_in_ctxs(int ns, int nw, int res_rounded[ns][nw], double res[ns][nw]);
 
 /* make the first distribution of ressource in contexts by assigning the first x available ressources to each one */
-void _lp_distribute_resources_in_ctxs(int* sched_ctxs, int ns, int nw, int res_rounded[ns][nw], double res[ns][nw], int *workers, int nworkers);
+void sc_hypervisor_lp_distribute_resources_in_ctxs(int* sched_ctxs, int ns, int nw, int res_rounded[ns][nw], double res[ns][nw], int *workers, int nworkers);
 
 /* place resources in contexts dependig on whether they already have workers or not */
-void _lp_place_resources_in_ctx(int ns, int nw, double w_in_s[ns][nw], int *sched_ctxs, int *workers, unsigned do_size);
+void sc_hypervisor_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 _lp_find_tmax(double t1, double t2);
+double sc_hypervisor_lp_find_tmax(double t1, double t2);
 
 #ifdef __cplusplus
 }

+ 1 - 1
sc_hypervisor/src/hypervisor_policies/debit_lp_policy.c

@@ -278,7 +278,7 @@ static void debit_lp_handle_poped_task(unsigned sched_ctx, int worker, struct st
 /* 					printf("%d: cpus = %lf gpus = %lf cpus_round = %d gpus_round = %d\n", s, nworkers[s][1], nworkers[s][0], */
 /* 					       nworkers_rounded[s][1], nworkers_rounded[s][0]); */
 
-				_lp_redistribute_resources_in_ctxs(ns, 2, nworkers_rounded, nworkers);
+				sc_hypervisor_lp_redistribute_resources_in_ctxs(ns, 2, nworkers_rounded, nworkers);
 
 			}
 		}

+ 7 - 7
sc_hypervisor/src/hypervisor_policies/feft_lp_policy.c

@@ -43,7 +43,7 @@ static void feft_lp_handle_poped_task(unsigned sched_ctx, int worker, struct sta
 			struct timeval end_time;
 			gettimeofday(&start_time, NULL);
 
-			double vmax = _lp_get_nworkers_per_ctx(nsched_ctxs, nw, nworkers, total_nw);
+			double vmax = sc_hypervisor_lp_get_nworkers_per_ctx(nsched_ctxs, nw, nworkers, total_nw);
 			gettimeofday(&end_time, NULL);
 
 			long diff_s = end_time.tv_sec  - start_time.tv_sec;
@@ -54,8 +54,8 @@ static void feft_lp_handle_poped_task(unsigned sched_ctx, int worker, struct sta
 			if(vmax != 0.0)
 			{
 				int nworkers_rounded[nsched_ctxs][nw];
-				_lp_round_double_to_int(nsched_ctxs, nw, nworkers, nworkers_rounded);
-				_lp_redistribute_resources_in_ctxs(nsched_ctxs, nw, nworkers_rounded, nworkers);
+				sc_hypervisor_lp_round_double_to_int(nsched_ctxs, nw, nworkers, nworkers_rounded);
+				sc_hypervisor_lp_redistribute_resources_in_ctxs(nsched_ctxs, nw, nworkers_rounded, nworkers);
 			}
 			starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 		}
@@ -74,7 +74,7 @@ static void feft_lp_size_ctxs(int *sched_ctxs, int ns, int *workers, int nworker
 	_get_total_nw(workers, nworkers, nw, total_nw);
 
 	starpu_pthread_mutex_lock(&act_hypervisor_mutex);
-	double vmax = _lp_get_nworkers_per_ctx(nsched_ctxs, nw, nworkers_per_type, total_nw);
+	double vmax = sc_hypervisor_lp_get_nworkers_per_ctx(nsched_ctxs, nw, nworkers_per_type, total_nw);
 	if(vmax != 0.0)
 	{
 // 		printf("********size\n");
@@ -89,7 +89,7 @@ static void feft_lp_size_ctxs(int *sched_ctxs, int ns, int *workers, int nworker
 /* #endif */
 /* 		} */
 		int nworkers_per_type_rounded[nsched_ctxs][nw];
-		_lp_round_double_to_int(nsched_ctxs, nw, nworkers_per_type, nworkers_per_type_rounded);
+		sc_hypervisor_lp_round_double_to_int(nsched_ctxs, nw, nworkers_per_type, nworkers_per_type_rounded);
 /*       	for( i = 0; i < nsched_ctxs; i++) */
 /* 		{ */
 /* 			printf("ctx %d/worker type %d: n = %d \n", i, 0, nworkers_per_type_rounded[i][0]); */
@@ -115,9 +115,9 @@ static void feft_lp_size_ctxs(int *sched_ctxs, int ns, int *workers, int nworker
 			}
 		}
 		if(has_workers)
-			_lp_redistribute_resources_in_ctxs(nsched_ctxs, nw, nworkers_per_type_rounded, nworkers_per_type);
+			sc_hypervisor_lp_redistribute_resources_in_ctxs(nsched_ctxs, nw, nworkers_per_type_rounded, nworkers_per_type);
 		else
-			_lp_distribute_resources_in_ctxs(sched_ctxs, nsched_ctxs, nw, nworkers_per_type_rounded, nworkers_per_type, workers, nworkers);
+			sc_hypervisor_lp_distribute_resources_in_ctxs(sched_ctxs, nsched_ctxs, nw, nworkers_per_type_rounded, nworkers_per_type, workers, nworkers);
 	}
 	starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 }

+ 3 - 3
sc_hypervisor/src/hypervisor_policies/ispeed_lp_policy.c

@@ -124,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 = _lp_find_tmax(tmin, tmax);
+		tmax = sc_hypervisor_lp_find_tmax(tmin, tmax);
 
 		if(tmax < smallest_tmax)
 		{
 			tmax = old_tmax;
 			tmin = smallest_tmax;
-			tmax = _lp_find_tmax(tmin, tmax);
+			tmax = sc_hypervisor_lp_find_tmax(tmin, tmax);
 		}
 		nd++;
 	}
@@ -409,7 +409,7 @@ static void ispeed_lp_handle_poped_task(unsigned sched_ctx, int worker, struct s
 /* 					printf("%d: cpus = %lf gpus = %lf cpus_round = %d gpus_round = %d\n", s, nworkers[s][1], nworkers[s][0], */
 /* 					       nworkers_rounded[s][1], nworkers_rounded[s][0]); */
 
-				_lp_redistribute_resources_in_ctxs(ns, 2, nworkers_rounded, nworkers);
+				sc_hypervisor_lp_redistribute_resources_in_ctxs(ns, 2, nworkers_rounded, nworkers);
 
 			}
 		}

+ 5 - 5
sc_hypervisor/src/hypervisor_policies/teft_lp_policy.c

@@ -48,7 +48,7 @@ static unsigned _compute_task_distribution_over_ctxs(int ns, int nw, int nt, dou
 
 	/* smallest possible tmax, difficult to obtain as we
 	   compute the nr of flops and not the tasks */
-	double possible_tmax = _lp_get_tmax(nw, workers);
+	double possible_tmax = sc_hypervisor_lp_get_tmax(nw, workers);
 	double smallest_tmax = possible_tmax / 3;
 	double tmax = possible_tmax * ns;
 	double res = 1.0;
@@ -100,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 = _lp_find_tmax(tmin, tmax);
+		tmax = sc_hypervisor_lp_find_tmax(tmin, tmax);
 
 		if(tmax < smallest_tmax)
 		{
 			tmax = old_tmax;
 			tmin = smallest_tmax;
-			tmax = _lp_find_tmax(tmin, tmax);
+			tmax = sc_hypervisor_lp_find_tmax(tmin, tmax);
 		}
 		nd++;
 	}
@@ -138,7 +138,7 @@ static void _size_ctxs(int *sched_ctxs, int nsched_ctxs , int *workers, int nwor
 	starpu_pthread_mutex_unlock(&mutex);
 	/* if we did find at least one solution redistribute the resources */
 	if(found_sol)
-		_lp_place_resources_in_ctx(ns, nw, w_in_s, sched_ctxs, workers, 1);
+		sc_hypervisor_lp_place_resources_in_ctx(ns, nw, w_in_s, sched_ctxs, workers, 1);
 }
 
 static void size_if_required()
@@ -568,7 +568,7 @@ static void teft_lp_handle_poped_task(unsigned sched_ctx, int worker, struct sta
 
 			/* if we did find at least one solution redistribute the resources */
 			if(found_sol)
-				_lp_place_resources_in_ctx(ns, nw, w_in_s, NULL, NULL, 0);
+				sc_hypervisor_lp_place_resources_in_ctx(ns, nw, w_in_s, NULL, NULL, 0);
 
 			struct bound_task_pool *next = NULL;
 			struct bound_task_pool *tmp_tp = tmp_task_pools;

+ 13 - 13
sc_hypervisor/src/policies_utils/lp_tools.c

@@ -21,7 +21,7 @@
 
 #ifdef STARPU_HAVE_GLPK_H
 
-double _lp_compute_nworkers_per_ctx(int ns, int nw, double v[ns][nw], double flops[ns], double res[ns][nw], int  total_nw[nw])
+double sc_hypervisor_lp_compute_nworkers_per_ctx(int ns, int nw, double v[ns][nw], double flops[ns], double res[ns][nw], int  total_nw[nw])
 {
 	int integer = 1;
 	int s, w;
@@ -221,7 +221,7 @@ double _lp_compute_nworkers_per_ctx(int ns, int nw, double v[ns][nw], double flo
 
 #endif //STARPU_HAVE_GLPK_H
 
-double _lp_get_nworkers_per_ctx(int nsched_ctxs, int ntypes_of_workers, double res[nsched_ctxs][ntypes_of_workers], int total_nw[ntypes_of_workers])
+double sc_hypervisor_lp_get_nworkers_per_ctx(int nsched_ctxs, int ntypes_of_workers, double res[nsched_ctxs][ntypes_of_workers], int total_nw[ntypes_of_workers])
 {
 	int *sched_ctxs = sc_hypervisor_get_sched_ctxs();
 #ifdef STARPU_HAVE_GLPK_H
@@ -249,13 +249,13 @@ double _lp_get_nworkers_per_ctx(int nsched_ctxs, int ntypes_of_workers, double r
 //		printf("%d: flops %lf\n", sched_ctxs[i], flops[i]);
 	}
 
-	return 1/_lp_compute_nworkers_per_ctx(nsched_ctxs, ntypes_of_workers, v, flops, res, total_nw);
+	return 1/sc_hypervisor_lp_compute_nworkers_per_ctx(nsched_ctxs, ntypes_of_workers, v, flops, res, total_nw);
 #else//STARPU_HAVE_GLPK_H
 	return 0.0;
 #endif//STARPU_HAVE_GLPK_H
 }
 
-double _lp_get_tmax(int nw, int *workers)
+double sc_hypervisor_lp_get_tmax(int nw, int *workers)
 {
 	int ntypes_of_workers = 2;
 	int total_nw[ntypes_of_workers];
@@ -264,10 +264,10 @@ double _lp_get_tmax(int nw, int *workers)
 	int nsched_ctxs = sc_hypervisor_get_nsched_ctxs();
 
 	double res[nsched_ctxs][ntypes_of_workers];
-	return _lp_get_nworkers_per_ctx(nsched_ctxs, ntypes_of_workers, res, total_nw) * 1000;
+	return sc_hypervisor_lp_get_nworkers_per_ctx(nsched_ctxs, ntypes_of_workers, res, total_nw) * 1000;
 }
 
-void _lp_round_double_to_int(int ns, int nw, double res[ns][nw], int res_rounded[ns][nw])
+void sc_hypervisor_lp_round_double_to_int(int ns, int nw, double res[ns][nw], int res_rounded[ns][nw])
 {
 	int s, w;
 	double left_res[nw];
@@ -480,7 +480,7 @@ void _lp_find_workers_to_remove(int nw, int tmp_nw_move[nw], int tmp_workers_mov
 	}
 }
 
-void _lp_redistribute_resources_in_ctxs(int ns, int nw, int res_rounded[ns][nw], double res[ns][nw])
+void sc_hypervisor_lp_redistribute_resources_in_ctxs(int ns, int nw, int res_rounded[ns][nw], double res[ns][nw])
 {
 	int *sched_ctxs = sc_hypervisor_get_sched_ctxs();
 	int s, s2, w;
@@ -556,7 +556,7 @@ void _lp_redistribute_resources_in_ctxs(int ns, int nw, int res_rounded[ns][nw],
 	}
 }
 
-void _lp_distribute_resources_in_ctxs(int* sched_ctxs, int ns, int nw, int res_rounded[ns][nw], double res[ns][nw], int *workers, int nworkers)
+void sc_hypervisor_lp_distribute_resources_in_ctxs(int* sched_ctxs, int ns, int nw, int res_rounded[ns][nw], double res[ns][nw], int *workers, int nworkers)
 {
 	unsigned current_nworkers = workers == NULL ? starpu_worker_get_count() : (unsigned)nworkers;
 	int s, w;
@@ -635,7 +635,7 @@ void _lp_distribute_resources_in_ctxs(int* sched_ctxs, int ns, int nw, int res_r
 }
 
 /* nw = all the workers (either in a list or on all machine) */
-void _lp_place_resources_in_ctx(int ns, int nw, double w_in_s[ns][nw], int *sched_ctxs_input, int *workers_input, unsigned do_size)
+void sc_hypervisor_lp_place_resources_in_ctx(int ns, int nw, double w_in_s[ns][nw], int *sched_ctxs_input, int *workers_input, unsigned do_size)
 {
 	int w, s;
 	double nworkers[ns][2];
@@ -674,7 +674,7 @@ void _lp_place_resources_in_ctx(int ns, int nw, double w_in_s[ns][nw], int *sche
 /* 		printf("%d: cpus = %d gpus = %d \n", s, nworkers_rounded[s][1], nworkers_rounded[s][0]); */
 
 	if(!do_size)
-		_lp_redistribute_resources_in_ctxs(ns, 2, nworkers_rounded, nworkers);
+		sc_hypervisor_lp_redistribute_resources_in_ctxs(ns, 2, nworkers_rounded, nworkers);
 	else
 	{
 		int *current_sched_ctxs = sched_ctxs_input == NULL ? sc_hypervisor_get_sched_ctxs() : sched_ctxs_input;
@@ -691,14 +691,14 @@ void _lp_place_resources_in_ctx(int ns, int nw, double w_in_s[ns][nw], int *sche
 			}
 		}
 		if(has_workers)
-			_lp_redistribute_resources_in_ctxs(ns, 2, nworkers_rounded, nworkers);
+			sc_hypervisor_lp_redistribute_resources_in_ctxs(ns, 2, nworkers_rounded, nworkers);
 		else
-			_lp_distribute_resources_in_ctxs(current_sched_ctxs, ns, 2, nworkers_rounded, nworkers, workers_input, nw);
+			sc_hypervisor_lp_distribute_resources_in_ctxs(current_sched_ctxs, ns, 2, nworkers_rounded, nworkers, workers_input, nw);
 	}
 	return;
 }
 
-double _lp_find_tmax(double t1, double t2)
+double sc_hypervisor_lp_find_tmax(double t1, double t2)
 {
 	return t1 + ((t2 - t1)/2);
 }