Browse Source

Avoid the exclusion condition for tasks which already depend one on each other.

Samuel Thibault 14 years ago
parent
commit
6273c0f3c3
2 changed files with 20 additions and 6 deletions
  1. 1 1
      doc/starpu.texi
  2. 19 5
      src/profiling/bound.c

+ 1 - 1
doc/starpu.texi

@@ -1129,7 +1129,7 @@ immediately and get the optimized minimum.
 The @code{deps} parameter tells StarPU whether to take tasks and data
 dependencies into account. It must be understood that the linear programming
 problem size is quadratic with number of tasks and thus the time to solve it
-will be very long, typically 5 minutes for just 13 tasks. Setting @code{deps}
+will be very long, typically one minute for just 13 tasks. Setting @code{deps}
 to 0 will only takes into account the actual computations on processing
 units. It however still properly takes into account the varying performances of
 kernels and processing units, which is quite more accurate than just comparing

+ 19 - 5
src/profiling/bound.c

@@ -300,6 +300,17 @@ static void _starpu_get_tasks_times(int nw, int nt, double times[nw][nt]) {
 	}
 }
 
+static int ancestor(struct bound_task *child, struct bound_task *parent) {
+	int i;
+	for (i = 0; i < child->depsn; i++) {
+		if (parent == child->deps[i])
+			return 1;
+		if (ancestor(child->deps[i], parent))
+			return -1;
+	}
+	return 0;
+}
+
 /*
  * lp_solve format
  */
@@ -377,21 +388,24 @@ void starpu_bound_print_lp(FILE *output)
 		fprintf(output, "\n/* For each task pair and each worker, if both tasks are executed by the same worker,\n");
 		fprintf(output, "   one is started after the other's completion */\n");
 		for (t = tasks; t; t = t->next)
-			for (t2 = t->next; t2; t2 = t2->next) {
-				for (w = 0; w < nw; w++) {
+			for (t2 = t->next; t2; t2 = t2->next)
+			{
+				if (!ancestor(t, t2) && !ancestor(t2, t))
+				    for (w = 0; w < nw; w++) {
 					fprintf(output, "s%u - c%u >= -3e6 + 1e6 t%uw%u + 1e6 t%uw%u + 1e6 t%uafter%u;\n",
 							t->id, t2->id, t->id, w, t2->id, w, t->id, t2->id);
 					fprintf(output, "s%u - c%u >= -2e6 + 1e6 t%uw%u + 1e6 t%uw%u - 1e6 t%uafter%u;\n",
 							t2->id, t->id, t->id, w, t2->id, w, t->id, t2->id);
 				}
 			}
+		for (t = tasks; t; t = t->next)
+			for (t2 = t->next; t2; t2 = t2->next)
+				if (!ancestor(t, t2) && !ancestor(t2, t))
+				fprintf(output, "bin t%uafter%u;\n", t->id, t2->id);
 
 		for (t = tasks; t; t = t->next)
 			for (w = 0; w < nw; w++)
 				fprintf(output, "bin t%uw%u;\n", t->id, w);
-		for (t = tasks; t; t = t->next)
-			for (t2 = t->next; t2; t2 = t2->next)
-				fprintf(output, "bin t%uafter%u;\n", t->id, t2->id);
 	} else {
 		struct bound_task_pool *tp;
 		nt = 0;