Prechádzať zdrojové kódy

Add starpu_task_nsubmitted starpu_task_nready, to let the application have an idea of the progression of StarPU

Samuel Thibault 12 rokov pred
rodič
commit
59a34928f9

+ 12 - 0
doc/chapters/basic-api.texi

@@ -1939,6 +1939,18 @@ This function blocks until all the tasks that were submitted are terminated. It
 does not destroy these tasks.
 @end deftypefun
 
+@deftypefun int starpu_task_nready (void)
+@end deftypefun
+
+@deftypefun int starpu_task_nsubmitted (void)
+Return the number of submitted tasks which have not completed yet.
+@end deftypefun
+
+@deftypefun int starpu_task_nready (void)
+Return the number of submitted tasks which are ready for execution are already
+executing. It thus does not include tasks waiting for dependencies.
+@end deftypefun
+
 @deftypefun {struct starpu_task *} starpu_task_get_current (void)
 This function returns the task currently executed by the worker, or
 NULL if it is called either from a thread that is not a task or simply

+ 3 - 0
include/starpu_task.h

@@ -321,6 +321,9 @@ int starpu_task_wait_for_all_in_ctx(unsigned sched_ctx_id);
 /* This function waits until there is no more ready task. */
 int starpu_task_wait_for_no_ready(void);
 
+int starpu_task_nready(void);
+int starpu_task_nsubmitted(void);
+
 void starpu_codelet_init(struct starpu_codelet *cl);
 
 void starpu_display_codelet_stats(struct starpu_codelet *cl);

+ 10 - 0
src/core/task.c

@@ -745,6 +745,11 @@ static void _starpu_increment_nsubmitted_tasks(void)
 	_STARPU_PTHREAD_MUTEX_UNLOCK(&submitted_mutex);
 }
 
+int starpu_task_nsubmitted(void)
+{
+	return nsubmitted;
+}
+
 void _starpu_increment_nready_tasks(void)
 {
 	_STARPU_PTHREAD_MUTEX_LOCK(&submitted_mutex);
@@ -765,6 +770,11 @@ void _starpu_decrement_nready_tasks(void)
 
 }
 
+int starpu_task_nready(void)
+{
+	return nready;
+}
+
 void _starpu_initialize_current_task_key(void)
 {
 	_STARPU_PTHREAD_KEY_CREATE(&current_task_key, NULL);

+ 15 - 1
tools/valgrind/starpu.suppr

@@ -64,7 +64,21 @@
 {
    This is racy, but since we'll always put the same values, this is not a problem.
    Helgrind:Race
-   fun:  _starpu_codelet_check_deprecated_fields
+   fun: _starpu_codelet_check_deprecated_fields
+   ...
+}
+
+{
+   This is racy, but we don't care, it's only a statistic
+   Helgrind:Race
+   fun: starpu_task_nsubmitted
+   ...
+}
+
+{
+   This is racy, but we don't care, it's only a statistic
+   Helgrind:Race
+   fun: starpu_task_nready
    ...
 }