Pārlūkot izejas kodu

add starpu_task_footprint function to return a task footprint

Samuel Thibault 12 gadi atpakaļ
vecāks
revīzija
d0f80337c1

+ 4 - 0
doc/chapters/advanced-api.texi

@@ -1034,6 +1034,10 @@ Check if the worker specified by workerid can execute the codelet. Schedulers ne
 Return the current date in µs
 Return the current date in µs
 @end deftypefun
 @end deftypefun
 
 
+@deftypefun uint32_t starpu_task_footprint ({struct starpu_perfmodel *}@var{model}, {struct starpu_task *} @var{task}, {enum starpu_perf_archtype} @var{arch}, unsigned @var{nimpl})
+Returns the footprint for a given task
+@end deftypefun
+
 @deftypefun double starpu_task_expected_length ({struct starpu_task *}@var{task}, {enum starpu_perf_archtype} @var{arch}, unsigned @var{nimpl})
 @deftypefun double starpu_task_expected_length ({struct starpu_task *}@var{task}, {enum starpu_perf_archtype} @var{arch}, unsigned @var{nimpl})
 Returns expected task duration in µs
 Returns expected task duration in µs
 @end deftypefun
 @end deftypefun

+ 8 - 5
doc/chapters/advanced-examples.texi

@@ -430,11 +430,14 @@ a name which is different from the execution time performance model.
 
 
 The application can request time estimations from the StarPU performance
 The application can request time estimations from the StarPU performance
 models by filling a task structure as usual without actually submitting
 models by filling a task structure as usual without actually submitting
-it. The data handles can be created by calling @code{starpu_data_register}
-functions with a @code{NULL} pointer (and need to be unregistered as usual)
-and the desired data sizes. The @code{starpu_task_expected_length} and
-@code{starpu_task_expected_power} functions can then be called to get an
-estimation of the task duration on a given arch. @code{starpu_task_destroy}
+it. The data handles can be created by calling @code{starpu_*_data_register}
+functions with a @code{NULL} pointer and @code{-1} node and the
+desired data sizes, and need to be unregistered as usual. The
+@code{starpu_task_expected_length} and @code{starpu_task_expected_power}
+functions can then be called to get an estimation of the task cost on a given
+arch. @code{starpu_task_footprint} can also be used to get the footprint used
+for indexing history-based performance models.
+@code{starpu_task_destroy}
 needs to be called to destroy the dummy task afterwards. See
 needs to be called to destroy the dummy task afterwards. See
 @code{tests/perfmodels/regression_based.c} for an example.
 @code{tests/perfmodels/regression_based.c} for an example.
 
 

+ 3 - 1
include/starpu_scheduler.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  *
- * Copyright (C) 2010-2012  Université de Bordeaux 1
+ * Copyright (C) 2010-2013  Université de Bordeaux 1
  * Copyright (C) 2011  Télécom-SudParis
  * Copyright (C) 2011  Télécom-SudParis
  *
  *
  * StarPU is free software; you can redistribute it and/or modify
  * StarPU is free software; you can redistribute it and/or modify
@@ -183,6 +183,8 @@ int starpu_prefetch_task_input_on_node(struct starpu_task *task, unsigned node);
 
 
 /* Return the current date in us */
 /* Return the current date in us */
 double starpu_timing_now(void);
 double starpu_timing_now(void);
+/* Returns the perfmodel footprint for the task */
+uint32_t starpu_task_footprint(struct starpu_perfmodel *model, struct starpu_task *task, enum starpu_perf_archtype arch, unsigned nimpl);
 /* Returns expected task duration in us */
 /* Returns expected task duration in us */
 double starpu_task_expected_length(struct starpu_task *task, enum starpu_perf_archtype arch, unsigned nimpl);
 double starpu_task_expected_length(struct starpu_task *task, enum starpu_perf_archtype arch, unsigned nimpl);
 /* Returns an estimated speedup factor relative to CPU speed */
 /* Returns an estimated speedup factor relative to CPU speed */

+ 8 - 1
src/datawizard/footprint.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  *
- * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
+ * Copyright (C) 2009, 2010-2011, 2013  Université de Bordeaux 1
  * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  *
  * StarPU is free software; you can redistribute it and/or modify
  * StarPU is free software; you can redistribute it and/or modify
@@ -17,6 +17,7 @@
 
 
 #include <datawizard/footprint.h>
 #include <datawizard/footprint.h>
 #include <starpu_hash.h>
 #include <starpu_hash.h>
+#include <core/task.h>
 
 
 uint32_t _starpu_compute_buffers_footprint(struct starpu_perfmodel *model, enum starpu_perf_archtype arch, unsigned nimpl, struct _starpu_job *j)
 uint32_t _starpu_compute_buffers_footprint(struct starpu_perfmodel *model, enum starpu_perf_archtype arch, unsigned nimpl, struct _starpu_job *j)
 {
 {
@@ -66,3 +67,9 @@ uint32_t _starpu_compute_data_footprint(starpu_data_handle_t handle)
 
 
 	return starpu_crc32_be(handle_footprint, interfaceid);
 	return starpu_crc32_be(handle_footprint, interfaceid);
 }
 }
+
+uint32_t starpu_task_footprint(struct starpu_perfmodel *model, struct starpu_task *task, enum starpu_perf_archtype arch, unsigned nimpl)
+{
+	struct _starpu_job *j = _starpu_get_job_associated_to_task(task);
+	return _starpu_compute_buffers_footprint(model, arch, nimpl, j);
+}