Browse Source

ispeed resizing policy: fix measurement units

Andra Hugo 12 years ago
parent
commit
3033bd4690

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

@@ -49,12 +49,13 @@ static unsigned _compute_flops_distribution_over_ctxs(int ns, int nw, double w_i
 				enum starpu_archtype arch = starpu_worker_get_type(worker);
 				velocity[s][w] = _get_velocity_per_worker_type(sched_ctx_hypervisor_get_wrapper(sched_ctxs[s]), arch);
 				if(velocity[s][w] == -1.0)
-					velocity[s][w] = arch == STARPU_CPU_WORKER ? 1 / 5.0 : 1 / 50.0;
+					velocity[s][w] = arch == STARPU_CPU_WORKER ? 5.0 : 50.0;
 			}
 			
+//			printf("v[w%d][s%d] = %lf\n",w, s, velocity[s][w]);
 		}
 		struct sched_ctx_hypervisor_policy_config *config = sched_ctx_hypervisor_get_config(sched_ctxs[s]);
-		flops[s] = config->ispeed_ctx_sample;
+		flops[s] = config->ispeed_ctx_sample/1000000000; /* in gflops */
 	}
 
 
@@ -284,7 +285,7 @@ static double _glp_resolve(int ns, int nw, double velocity[ns][nw], double flops
 		{
 			flops_on_w[s][w] = glp_get_col_prim(lp, colnum(w, s));
 			w_in_s[s][w] = glp_get_col_prim(lp, nw*ns+colnum(w,s));
-//			printf("%d/%d: w in s %lf flops %lf \n", w, s, w_in_s[s][w], flops_on_w[s][w]);
+//			printf("w_in_s[s%d][w%d] = %lf flops[s%d][w%d] = %lf \n", s, w, w_in_s[s][w], s, w, flops_on_w[s][w]);
 		}
 
 	glp_delete_prob(lp);

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

@@ -357,8 +357,8 @@ double _get_ctx_velocity(struct sched_ctx_hypervisor_wrapper* sc_w)
 	if(prc >= redim_sample)
         {
                 double curr_time = starpu_timing_now();
-                double elapsed_time = curr_time - sc_w->start_time;
-                return elapsed_flops/elapsed_time;
+                double elapsed_time = (curr_time - sc_w->start_time) / 1000000; /* in seconds */
+                return (elapsed_flops/1000000000)/elapsed_time;/* in Gflops/s */
         }
 	return 0.0;
 }
@@ -389,9 +389,9 @@ double _get_velocity_per_worker(struct sched_ctx_hypervisor_wrapper *sc_w, unsig
 	if(!starpu_sched_ctx_contains_worker(worker, sc_w->sched_ctx))
 		return -1.0;
 
-        double elapsed_flops = sc_w->elapsed_flops[worker];
+        double elapsed_flops = sc_w->elapsed_flops[worker] / 1000000000; /*in gflops */
 	struct sched_ctx_hypervisor_policy_config *config = sched_ctx_hypervisor_get_config(sc_w->sched_ctx);
-	double sample = config->ispeed_w_sample[worker];
+	double sample = config->ispeed_w_sample[worker] / 1000000000; /*in gflops */
 
 	double ctx_elapsed_flops = sched_ctx_hypervisor_get_elapsed_flops_per_sched_ctx(sc_w);
 	double ctx_sample = config->ispeed_ctx_sample;
@@ -401,8 +401,8 @@ double _get_velocity_per_worker(struct sched_ctx_hypervisor_wrapper *sc_w, unsig
         if( elapsed_flops >= sample)
         {
                 double curr_time = starpu_timing_now();
-                double elapsed_time = curr_time - sc_w->start_time;
-                return (elapsed_flops/elapsed_time);
+                double elapsed_time = (curr_time - sc_w->start_time) / 1000000; /* in seconds */
+                return (elapsed_flops/elapsed_time); /* in Gflops/s */
         }
 
         return -1.0;
@@ -423,15 +423,15 @@ double _get_velocity_per_worker(struct sched_ctx_hypervisor_wrapper *sc_w, unsig
 double _get_velocity_per_worker_type(struct sched_ctx_hypervisor_wrapper* sc_w, enum starpu_archtype arch)
 {
         int npus = 0;
-        double elapsed_flops = _get_elapsed_flops(sc_w, &npus, arch);
+        double elapsed_flops = _get_elapsed_flops(sc_w, &npus, arch) / 1000000000 ; /* in gflops */
 	double avg_elapsed_flops = elapsed_flops / npus;
-	double sample = _get_ispeed_sample_for_type_of_worker(sc_w, arch);
+	double sample = _get_ispeed_sample_for_type_of_worker(sc_w, arch) / 1000000000;
 
         if( avg_elapsed_flops >= sample)
         {
                 double curr_time = starpu_timing_now();
-                double elapsed_time = curr_time - sc_w->start_time;
-                return elapsed_flops/elapsed_time;
+                double elapsed_time = (curr_time - sc_w->start_time) / 1000000; /* in seconds */
+                return avg_elapsed_flops/elapsed_time; /* in Gflops/s */
         }
 
         return -1.0;