瀏覽代碼

change dynamically the total number of flops of a context

Andra Hugo 11 年之前
父節點
當前提交
0a164e277c
共有 2 個文件被更改,包括 12 次插入0 次删除
  1. 3 0
      sc_hypervisor/include/sc_hypervisor.h
  2. 9 0
      sc_hypervisor/src/sc_hypervisor.c

+ 3 - 0
sc_hypervisor/include/sc_hypervisor.h

@@ -128,6 +128,9 @@ unsigned sc_hypervisor_can_resize(unsigned sched_ctx);
 /* indicate the types of tasks a context will execute in order to better decide the sizing of ctxs */
 void sc_hypervisor_set_type_of_task(struct starpu_codelet *cl, unsigned sched_ctx, uint32_t footprint, size_t data_size);
 
+/* change dynamically the total number of flops of a context, move the deadline of the finishing time of the context */
+void sc_hypervisor_update_total_flops(unsigned sched_ctx, double total_flops);
+
 #ifdef __cplusplus
 }
 #endif

+ 9 - 0
sc_hypervisor/src/sc_hypervisor.c

@@ -982,3 +982,12 @@ struct types_of_workers* sc_hypervisor_get_types_of_workers(int *workers, unsign
         if(tw->ncuda > 0) tw->nw++;
 	return tw;
 }
+
+void sc_hypervisor_update_total_flops(unsigned sched_ctx, double total_flops)
+{
+	double diff = total_flops - hypervisor.sched_ctx_w[sched_ctx].total_flops;
+	starpu_pthread_mutex_lock(&act_hypervisor_mutex);
+	hypervisor.sched_ctx_w[sched_ctx].total_flops = total_flops;
+	hypervisor.sched_ctx_w[sched_ctx].remaining_flops += diff;	
+	starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
+}