Преглед изворни кода

Add dependency debugging facility

Samuel Thibault пре 14 година
родитељ
комит
db29ece0a3
1 измењених фајлова са 12 додато и 1 уклоњено
  1. 12 1
      src/core/dependencies/implicit_data_deps.c

+ 12 - 1
src/core/dependencies/implicit_data_deps.c

@@ -19,6 +19,12 @@
 #include <core/task.h>
 #include <datawizard/datawizard.h>
 
+#if 0
+# define _STARPU_DEBUG(fmt, args ...) fprintf(stderr, fmt, ##args);
+#else
+# define _STARPU_DEBUG(fmt, args ...)
+#endif
+
 /* This function adds the implicit task dependencies introduced by data
  * sequential consistency. Two tasks are provided: pre_sync and post_sync which
  * respectively indicates which task is going to depend on the previous deps
@@ -34,7 +40,6 @@ void _starpu_detect_implicit_data_deps_with_handle(struct starpu_task *pre_sync_
 
 	if (handle->sequential_consistency)
 	{
-
 #ifdef STARPU_USE_FXT
 		/* In case we are generating the DAG, we add an implicit
 		 * dependency between the pre and the post sync tasks in case
@@ -51,8 +56,10 @@ void _starpu_detect_implicit_data_deps_with_handle(struct starpu_task *pre_sync_
 	
 		if (mode & STARPU_W)
 		{
+			_STARPU_DEBUG("W %p\n", handle);
 			if (previous_mode & STARPU_W)
 			{
+				_STARPU_DEBUG("WAW %p\n", handle);
 				/* (Read) Write */
 				/* This task depends on the previous writer */
 				if (handle->last_submitted_writer)
@@ -80,6 +87,7 @@ void _starpu_detect_implicit_data_deps_with_handle(struct starpu_task *pre_sync_
 				 * mode: this task must depend on all those read-only
 				 * tasks and we get rid of the list of readers */
 			
+				_STARPU_DEBUG("WAR %p\n", handle);
 				/* Count the readers */
 				unsigned nreaders = 0;
 				struct starpu_task_wrapper_list *l;
@@ -89,6 +97,7 @@ void _starpu_detect_implicit_data_deps_with_handle(struct starpu_task *pre_sync_
 					nreaders++;
 					l = l->next;
 				}
+				_STARPU_DEBUG("%d readers\n", nreaders);
 
 				struct starpu_task *task_array[nreaders];
 
@@ -128,6 +137,7 @@ void _starpu_detect_implicit_data_deps_with_handle(struct starpu_task *pre_sync_
 	
 		}
 		else {
+			_STARPU_DEBUG("R %p\n", handle);
 			/* Add a reader */
 			STARPU_ASSERT(pre_sync_task);
 			STARPU_ASSERT(post_sync_task);
@@ -141,6 +151,7 @@ void _starpu_detect_implicit_data_deps_with_handle(struct starpu_task *pre_sync_
 			/* This task depends on the previous writer if any */
 			if (handle->last_submitted_writer)
 			{
+				_STARPU_DEBUG("RAW %p\n", handle);
 				struct starpu_task *task_array[1] = {handle->last_submitted_writer};
 				starpu_task_declare_deps_array(pre_sync_task, 1, task_array);
 			}