소스 검색

- implement cumulated time and power consumption support for discontinuous tasks

Olivier Aumage 11 년 전
부모
커밋
6f49c33eb9
2개의 변경된 파일65개의 추가작업 그리고 6개의 파일을 삭제
  1. 6 0
      src/core/jobs.h
  2. 59 6
      src/drivers/driver_common/driver_common.c

+ 6 - 0
src/core/jobs.h

@@ -130,6 +130,12 @@ LIST_TYPE(_starpu_job,
 
 	/* Job has been stopped at least once. */
 	unsigned discontinuous;
+
+	/* Cumulated execution time for discontinuous jobs */
+	struct timespec cumulated_ts;
+
+	/* Cumulated power consumption for discontinuous jobs */
+	double cumulated_power_consumed;
 #endif
 
 	/* Should that task appear in the debug tools ? (eg. the DAG generated

+ 59 - 6
src/drivers/driver_common/driver_common.c

@@ -117,9 +117,6 @@ void _starpu_driver_update_job_feedback(struct _starpu_job *j, struct _starpu_wo
 	int calibrate_model = 0;
 	int updated = 0;
 
-#ifdef STARPU_OPENMP
-#warning "TODO: [OPENMP] split profiling for discontinuous tasks"
-#endif
 #ifndef STARPU_SIMGRID
 	if (cl->model && cl->model->benchmarking)
 		calibrate_model = 1;
@@ -145,9 +142,41 @@ void _starpu_driver_update_job_feedback(struct _starpu_job *j, struct _starpu_wo
 		}
 
 		if (calibrate_model)
-			_starpu_update_perfmodel_history(j, j->task->cl->model,  perf_arch, worker_args->devid, measured,j->nimpl);
-
+		{
+#ifdef STARPU_OPENMP
+			double time_consumed = measured;
+			unsigned do_update_time_model;
+			if (j->continuation)
+			{
+				/* The job is only paused, thus we accumulate
+				 * its timing, but we don't update its
+				 * perfmodel now. */
+				starpu_timespec_accumulate(&j->cumulated_ts, &measured_ts);
+				do_update_time_model = 0;
+			}
+			else
+			{
+				if (j->discontinuous)
+				{
+					/* The job was paused at least once but is now
+					 * really completing. We need to take into
+					 * account its past execution time in its
+					 * perfmodel. */
+					starpu_timespec_accumulate(&measured_ts, &j->cumulated_ts);
+					time_consumed = starpu_timing_timespec_to_us(&measured_ts);
+				}
+				do_update_time_model = 1;
+			}
+#else
+			const unsigned do_update_time_model = 1;
+			const double time_consumed = measured;
+#endif
 
+			if (do_update_time_model)
+			{
+				_starpu_update_perfmodel_history(j, j->task->cl->model, perf_arch, worker_args->devid, time_consumed, j->nimpl);
+			}
+		}
 	}
 
 	if (!updated)
@@ -155,7 +184,31 @@ void _starpu_driver_update_job_feedback(struct _starpu_job *j, struct _starpu_wo
 
 	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,j->nimpl);
+#ifdef STARPU_OPENMP
+		double power_consumed = profiling_info->power_consumed;
+		unsigned do_update_power_model;
+		if (j->continuation)
+		{
+			j->cumulated_power_consumed += power_consumed;
+			do_update_power_model = 0;
+		}
+		else 
+		{
+			if (j->discontinuous)
+			{
+				power_consumed += j->cumulated_power_consumed;
+			}
+			do_update_power_model = 1;
+		}
+#else
+		const double power_consumed = profiling_info->power_consumed;
+		const unsigned do_update_power_model = 1;
+#endif
+
+		if (do_update_power_model)
+		{
+			_starpu_update_perfmodel_history(j, j->task->cl->power_model, perf_arch, worker_args->devid, power_consumed, j->nimpl);
+		}
 	}
 }