|
@@ -82,11 +82,19 @@ static double compute_expected_time(double now, double predicted_end, double pre
|
|
|
double starpu_mct_compute_fitness(struct _starpu_mct_data * d, double exp_end, double min_exp_end, double max_exp_end, double transfer_len, double local_energy)
|
|
|
{
|
|
|
|
|
|
-
|
|
|
- return d->alpha * (exp_end - min_exp_end)
|
|
|
- + d->beta * transfer_len
|
|
|
- + d->_gamma * local_energy
|
|
|
- + d->_gamma * d->idle_power * (exp_end - max_exp_end);
|
|
|
+
|
|
|
+
|
|
|
+ double fitness = d->alpha * (exp_end - min_exp_end) + d->beta * transfer_len + d->_gamma * local_energy;
|
|
|
+
|
|
|
+
|
|
|
+ additional energy penalty must be considered*/
|
|
|
+ if(exp_end > max_exp_end)
|
|
|
+ fitness += d->_gamma * d->idle_power * (exp_end - max_exp_end) / 1000000.0;
|
|
|
+ return fitness;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
unsigned starpu_mct_compute_execution_times(struct starpu_sched_component *component, struct starpu_task *task,
|
|
@@ -138,14 +146,38 @@ void starpu_mct_compute_expected_times(struct starpu_sched_component *component,
|
|
|
estimated_end,
|
|
|
estimated_lengths[icomponent],
|
|
|
estimated_transfer_length[icomponent]);
|
|
|
+
|
|
|
+
|
|
|
+ estimated_end: estimatated end of the worker
|
|
|
+ min_exp_end_with_task: minimum estimated execution time of the task over all workers
|
|
|
+ max_exp_end_with_task: maximum estimated end of all workers
|
|
|
+ */
|
|
|
if(estimated_ends_with_task[icomponent] < *min_exp_end_with_task)
|
|
|
*min_exp_end_with_task = estimated_ends_with_task[icomponent];
|
|
|
- if(estimated_ends_with_task[icomponent] > *max_exp_end_with_task)
|
|
|
- *max_exp_end_with_task = estimated_ends_with_task[icomponent];
|
|
|
+ if(estimated_end > *max_exp_end_with_task)
|
|
|
+ *max_exp_end_with_task = estimated_end;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void starpu_mct_compute_energy(struct starpu_sched_component *component, struct starpu_task *task , double *local_energy, unsigned *suitable_components, unsigned nsuitable_components)
|
|
|
+{
|
|
|
+ unsigned i;
|
|
|
+ for(i = 0; i < nsuitable_components; i++)
|
|
|
+ {
|
|
|
+ unsigned icomponent = suitable_components[i];
|
|
|
+ int nimpl = 0;
|
|
|
+ local_energy[icomponent] = starpu_task_worker_expected_energy(task, icomponent, component->tree->sched_ctx_id, nimpl);
|
|
|
+ for (nimpl = 1; nimpl < STARPU_MAXIMPLEMENTATIONS; nimpl++)
|
|
|
+ {
|
|
|
+ double e;
|
|
|
+ e = starpu_task_worker_expected_energy(task, icomponent, component->tree->sched_ctx_id, nimpl);
|
|
|
+ if (e < local_energy[icomponent])
|
|
|
+ local_energy[icomponent] = e;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-int starpu_mct_get_best_component(struct _starpu_mct_data *d, struct starpu_task *task, double *estimated_lengths, double *estimated_transfer_length, double *estimated_ends_with_task, double min_exp_end_with_task, double max_exp_end_with_task, unsigned *suitable_components, unsigned nsuitable_components)
|
|
|
+int starpu_mct_get_best_component(struct _starpu_mct_data *d, struct starpu_task *task, double *estimated_lengths, double *estimated_transfer_length, double *estimated_ends_with_task, double *local_energy, double min_exp_end_with_task, double max_exp_end_with_task, unsigned *suitable_components, unsigned nsuitable_components)
|
|
|
{
|
|
|
double best_fitness = DBL_MAX;
|
|
|
int best_icomponent = -1;
|
|
@@ -157,12 +189,13 @@ int starpu_mct_get_best_component(struct _starpu_mct_data *d, struct starpu_task
|
|
|
#ifdef STARPU_DEVEL
|
|
|
#warning FIXME: take energy consumption into account
|
|
|
#endif
|
|
|
+
|
|
|
double tmp = starpu_mct_compute_fitness(d,
|
|
|
estimated_ends_with_task[icomponent],
|
|
|
min_exp_end_with_task,
|
|
|
max_exp_end_with_task,
|
|
|
estimated_transfer_length[icomponent],
|
|
|
- 0.0);
|
|
|
+ local_energy[icomponent]);
|
|
|
|
|
|
if(tmp < best_fitness)
|
|
|
{
|