소스 검색

fix dependencies

Samuel Thibault 14 년 전
부모
커밋
78edbdcb26
3개의 변경된 파일17개의 추가작업 그리고 16개의 파일을 삭제
  1. 5 5
      src/core/dependencies/implicit_data_deps.c
  2. 8 7
      src/profiling/bound.c
  3. 4 4
      src/profiling/bound.h

+ 5 - 5
src/core/dependencies/implicit_data_deps.c

@@ -23,7 +23,7 @@
 #if 0
 # define _STARPU_DEP_DEBUG(fmt, args ...) fprintf(stderr, fmt, ##args);
 #else
-# define _STARPU_DEP_DEBUG(fmt, args ...)
+# define _STARPU_DEP_DEBUG(fmt, args ...) 0
 #endif
 
 /* This function adds the implicit task dependencies introduced by data
@@ -54,7 +54,7 @@ void _starpu_detect_implicit_data_deps_with_handle(struct starpu_task *pre_sync_
 			starpu_job_t pre_sync_job = _starpu_get_job_associated_to_task(pre_sync_task);
 			starpu_job_t post_sync_job = _starpu_get_job_associated_to_task(post_sync_task);
 			STARPU_TRACE_GHOST_TASK_DEPS(pre_sync_job->job_id, post_sync_job->job_id);
-			_starpu_bound_task_dep(pre_sync_job, post_sync_job);
+			_starpu_bound_task_dep(post_sync_job, pre_sync_job);
 		}
 
 		starpu_access_mode previous_mode = handle->last_submitted_mode;
@@ -86,7 +86,7 @@ void _starpu_detect_implicit_data_deps_with_handle(struct starpu_task *pre_sync_
 					{
 						starpu_job_t pre_sync_job = _starpu_get_job_associated_to_task(pre_sync_task);
 						STARPU_TRACE_GHOST_TASK_DEPS(handle->last_submitted_ghost_writer_id, pre_sync_job->job_id);
-						_starpu_bound_job_id_dep(handle->last_submitted_ghost_writer_id, pre_sync_job);
+						_starpu_bound_job_id_dep(pre_sync_job, handle->last_submitted_ghost_writer_id);
 						_STARPU_DEP_DEBUG("dep ID%lu -> %p\n", handle->last_submitted_ghost_writer_id, pre_sync_task);
 						handle->last_submitted_ghost_writer_id_is_valid = 0;
 					} else
@@ -138,7 +138,7 @@ void _starpu_detect_implicit_data_deps_with_handle(struct starpu_task *pre_sync_
 					{
 						unsigned long id = ghost_readers_id->id;
 						STARPU_TRACE_GHOST_TASK_DEPS(id, pre_sync_job->job_id);
-						_starpu_bound_job_id_dep(id, pre_sync_job);
+						_starpu_bound_job_id_dep(pre_sync_job, id);
 						_STARPU_DEP_DEBUG("dep ID%lu -> %p\n", id, pre_sync_task);
 
 						struct starpu_jobid_list *prev = ghost_readers_id;
@@ -188,7 +188,7 @@ void _starpu_detect_implicit_data_deps_with_handle(struct starpu_task *pre_sync_
 			{
 				starpu_job_t pre_sync_job = _starpu_get_job_associated_to_task(pre_sync_task);
 				STARPU_TRACE_GHOST_TASK_DEPS(handle->last_submitted_ghost_writer_id, pre_sync_job->job_id);
-				_starpu_bound_job_id_dep(handle->last_submitted_ghost_writer_id, pre_sync_job);
+				_starpu_bound_job_id_dep(pre_sync_job, handle->last_submitted_ghost_writer_id);
 				_STARPU_DEP_DEBUG("dep ID%lu -> %p\n", handle->last_submitted_ghost_writer_id, pre_sync_task);
 			}
 		}

+ 8 - 7
src/profiling/bound.c

@@ -291,14 +291,14 @@ static struct bound_task *find_job(unsigned long id)
 	return NULL;
 }
 
-void _starpu_bound_job_id_dep(unsigned long id, starpu_job_t dep_j)
+void _starpu_bound_job_id_dep(starpu_job_t j, unsigned long id)
 {
-	struct bound_task *t;
+	struct bound_task *t, *dep_t;
 
 	if (!_starpu_bound_recording || !recorddeps)
 		return;
 
-	if (!good_job(dep_j))
+	if (!good_job(j))
 		return;
 
 	PTHREAD_MUTEX_LOCK(&mutex);
@@ -308,15 +308,16 @@ void _starpu_bound_job_id_dep(unsigned long id, starpu_job_t dep_j)
 		return;
 	}
 
-	new_task(dep_j);
-	t = find_job(id);
-	if (!t) {
+	new_task(j);
+	dep_t = find_job(id);
+	if (!dep_t) {
 		fprintf(stderr,"dependency %lu not found !\n", id);
 		PTHREAD_MUTEX_UNLOCK(&mutex);
 		return;
 	}
+	t = j->bound_task;
 	t->deps = realloc(t->deps, ++t->depsn * sizeof(t->deps[0]));
-	t->deps[t->depsn-1] = dep_j->bound_task;
+	t->deps[t->depsn-1] = dep_t;
 	PTHREAD_MUTEX_UNLOCK(&mutex);
 }
 

+ 4 - 4
src/profiling/bound.h

@@ -27,13 +27,13 @@ extern int _starpu_bound_recording;
 /* Record task for bound computation */
 extern void _starpu_bound_record(starpu_job_t j);
 
-/* Record tag dependency */
+/* Record tag dependency: id depends on dep_id */
 extern void _starpu_bound_tag_dep(starpu_tag_t id, starpu_tag_t dep_id);
 
-/* Record task dependency */
+/* Record task dependency: j depends on dep_j */
 extern void _starpu_bound_task_dep(starpu_job_t j, starpu_job_t dep_j);
 
-/* Record job id dependency */
-extern void _starpu_bound_job_id_dep(unsigned long job_id, starpu_job_t dep_j);
+/* Record job id dependency: j depends on job_id */
+extern void _starpu_bound_job_id_dep(starpu_job_t dep_j, unsigned long job_id);
 
 #endif // __BOUND_H__