ソースを参照

when moving a task from one context to another we create a new job for the corresponding task, take care to sort its data before resubmiting it because starpu wants a sorted list of buffers at the end

Andra Hugo 10 年 前
コミット
09de7cee21
共有3 個のファイルを変更した17 個の追加6 個の削除を含む
  1. 11 6
      src/core/dependencies/data_concurrency.c
  2. 2 0
      src/core/dependencies/data_concurrency.h
  3. 4 0
      src/core/task.c

+ 11 - 6
src/core/dependencies/data_concurrency.c

@@ -277,16 +277,13 @@ static unsigned _submit_job_enforce_data_deps(struct _starpu_job *j, unsigned st
 	return 0;
 }
 
-/* Sort the data used by the given job by handle pointer value order, and
- * acquire them in that order */
-/* No  lock is held */
-unsigned _starpu_submit_job_enforce_data_deps(struct _starpu_job *j)
+void _starpu_submit_job_sort_data(struct _starpu_job *j)
 {
 	struct starpu_codelet *cl = j->task->cl;
-
+	
 	if ((cl == NULL) || (STARPU_TASK_GET_NBUFFERS(j->task) == 0))
 		return 0;
-
+	
 	/* Compute an ordered list of the different pieces of data so that we
 	 * grab then according to a total order, thus avoiding a deadlock
 	 * condition */
@@ -305,6 +302,14 @@ unsigned _starpu_submit_job_enforce_data_deps(struct _starpu_job *j)
 
 	_starpu_sort_task_handles(_STARPU_JOB_GET_ORDERED_BUFFERS(j), STARPU_TASK_GET_NBUFFERS(j->task));
 
+}
+
+/* Sort the data used by the given job by handle pointer value order, and
+ * acquire them in that order */
+/* No  lock is held */
+unsigned _starpu_submit_job_enforce_data_deps(struct _starpu_job *j)
+{
+	_starpu_submit_job_sort_data(j);
 	return _submit_job_enforce_data_deps(j, 0);
 }
 

+ 2 - 0
src/core/dependencies/data_concurrency.h

@@ -22,6 +22,8 @@
 
 unsigned _starpu_submit_job_enforce_data_deps(struct _starpu_job *j);
 
+void _starpu_submit_job_sort_data(struct _starpu_job *j);
+
 int _starpu_notify_data_dependencies(starpu_data_handle_t handle);
 
 unsigned _starpu_attempt_to_submit_data_request_from_apps(starpu_data_handle_t handle,

+ 4 - 0
src/core/task.c

@@ -35,6 +35,7 @@
 #include <core/sched_ctx.h>
 #include <time.h>
 #include <signal.h>
+#include <core/dependencies/data_concurrency.h>
 #ifdef STARPU_HAVE_WINDOWS
 #include <windows.h>
 #endif
@@ -685,6 +686,9 @@ int _starpu_task_submit_nodeps(struct starpu_task *task)
 	}
 
 	struct _starpu_job *j = _starpu_get_job_associated_to_task(task);
+	/* create a job for the task and also sort all the data because 
+	   starpu wants a sorted list of buffers at the end */
+	_starpu_submit_job_sort_data(j);
 
 	if (j->internal)
 	{