瀏覽代碼

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

Samuel Thibault 12 年之前
父節點
當前提交
59a34928f9
共有 4 個文件被更改,包括 40 次插入1 次删除
  1. 12 0
      doc/chapters/basic-api.texi
  2. 3 0
      include/starpu_task.h
  3. 10 0
      src/core/task.c
  4. 15 1
      tools/valgrind/starpu.suppr

+ 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.
 does not destroy these tasks.
 @end deftypefun
 @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)
 @deftypefun {struct starpu_task *} starpu_task_get_current (void)
 This function returns the task currently executed by the worker, or
 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
 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. */
 /* This function waits until there is no more ready task. */
 int starpu_task_wait_for_no_ready(void);
 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_codelet_init(struct starpu_codelet *cl);
 
 
 void starpu_display_codelet_stats(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);
 	_STARPU_PTHREAD_MUTEX_UNLOCK(&submitted_mutex);
 }
 }
 
 
+int starpu_task_nsubmitted(void)
+{
+	return nsubmitted;
+}
+
 void _starpu_increment_nready_tasks(void)
 void _starpu_increment_nready_tasks(void)
 {
 {
 	_STARPU_PTHREAD_MUTEX_LOCK(&submitted_mutex);
 	_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)
 void _starpu_initialize_current_task_key(void)
 {
 {
 	_STARPU_PTHREAD_KEY_CREATE(&current_task_key, NULL);
 	_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.
    This is racy, but since we'll always put the same values, this is not a problem.
    Helgrind:Race
    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
    ...
    ...
 }
 }