|
@@ -24,45 +24,49 @@
|
|
|
|
|
|
void _starpu_driver_update_job_feedback(starpu_job_t j, struct starpu_worker_s *worker_args,
|
|
void _starpu_driver_update_job_feedback(starpu_job_t j, struct starpu_worker_s *worker_args,
|
|
struct starpu_task_profiling_info *profiling_info,
|
|
struct starpu_task_profiling_info *profiling_info,
|
|
- unsigned calibrate_model, enum starpu_perf_archtype perf_arch,
|
|
|
|
|
|
+ enum starpu_perf_archtype perf_arch,
|
|
struct timespec *codelet_start, struct timespec *codelet_end)
|
|
struct timespec *codelet_start, struct timespec *codelet_end)
|
|
{
|
|
{
|
|
struct timespec measured_ts;
|
|
struct timespec measured_ts;
|
|
double measured;
|
|
double measured;
|
|
int workerid = worker_args->workerid;
|
|
int workerid = worker_args->workerid;
|
|
|
|
+ struct starpu_codelet_t *cl = j->task->cl;
|
|
|
|
+ int calibrate_model;
|
|
|
|
+ int profiling = starpu_profiling_status_get();
|
|
|
|
+ int updated = 0;
|
|
|
|
+
|
|
|
|
+ if (cl->model && cl->model->benchmarking)
|
|
|
|
+ calibrate_model = 1;
|
|
|
|
|
|
if (profiling_info || calibrate_model)
|
|
if (profiling_info || calibrate_model)
|
|
{
|
|
{
|
|
starpu_timespec_sub(codelet_end, codelet_start, &measured_ts);
|
|
starpu_timespec_sub(codelet_end, codelet_start, &measured_ts);
|
|
measured = starpu_timing_timespec_to_us(&measured_ts);
|
|
measured = starpu_timing_timespec_to_us(&measured_ts);
|
|
|
|
|
|
- if (starpu_profiling_status_get())
|
|
|
|
|
|
+ if (profiling && profiling_info)
|
|
{
|
|
{
|
|
- if (profiling_info)
|
|
|
|
- {
|
|
|
|
- memcpy(&profiling_info->start_time, codelet_start, sizeof(struct timespec));
|
|
|
|
- memcpy(&profiling_info->end_time, codelet_end, sizeof(struct timespec));
|
|
|
|
|
|
+ memcpy(&profiling_info->start_time, codelet_start, sizeof(struct timespec));
|
|
|
|
+ memcpy(&profiling_info->end_time, codelet_end, sizeof(struct timespec));
|
|
|
|
|
|
- profiling_info->workerid = workerid;
|
|
|
|
-
|
|
|
|
- _starpu_worker_update_profiling_info_executing(workerid, &measured_ts, 1,
|
|
|
|
- profiling_info->used_cycles,
|
|
|
|
- profiling_info->stall_cycles,
|
|
|
|
- profiling_info->power_consumed);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- _starpu_worker_update_profiling_info_executing(workerid, 0, 1, 0, 0, 0);
|
|
|
|
|
|
+ profiling_info->workerid = workerid;
|
|
|
|
+
|
|
|
|
+ _starpu_worker_update_profiling_info_executing(workerid, &measured_ts, 1,
|
|
|
|
+ profiling_info->used_cycles,
|
|
|
|
+ profiling_info->stall_cycles,
|
|
|
|
+ profiling_info->power_consumed);
|
|
|
|
+ updated = 1;
|
|
}
|
|
}
|
|
|
|
|
|
- if (calibrate_model) {
|
|
|
|
- if (profiling_info && profiling_info->power_consumed) {
|
|
|
|
- /* TODO: update power model history */
|
|
|
|
- }
|
|
|
|
- _starpu_update_perfmodel_history(j, perf_arch, worker_args->devid, measured);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- _starpu_worker_update_profiling_info_executing(workerid, 0, 1, 0, 0, 0);
|
|
|
|
|
|
+ if (calibrate_model)
|
|
|
|
+ _starpu_update_perfmodel_history(j, j->task->cl->model, perf_arch, worker_args->devid, measured);
|
|
}
|
|
}
|
|
|
|
+ if (!updated)
|
|
|
|
+ _starpu_worker_update_profiling_info_executing(workerid, 0, 1, 0, 0, 0);
|
|
|
|
+
|
|
|
|
+printf("ici %p %lf %p %d\n", profiling_info, profiling_info->power_consumed, cl->power_model, cl->power_model->benchmarking);
|
|
|
|
+ if (profiling_info && profiling_info->power_consumed && cl->power_model && cl->power_model->benchmarking) {
|
|
|
|
+ _starpu_update_perfmodel_history(j, j->task->cl->power_model, perf_arch, worker_args->devid, profiling_info->power_consumed);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/* Workers may block when there is no work to do at all. We assume that the
|
|
/* Workers may block when there is no work to do at all. We assume that the
|