Explorar el Código

add mps output

Samuel Thibault hace 14 años
padre
commit
a0663790c6
Se han modificado 3 ficheros con 52 adiciones y 13 borrados
  1. 5 3
      doc/starpu.texi
  2. 1 1
      examples/lu/lu_example.c
  3. 46 9
      src/profiling/bound.c

+ 5 - 3
doc/starpu.texi

@@ -1117,9 +1117,11 @@ For history-based kernels, StarPU can very easily provide a theoretical lower
 bound for the execution time of a whole set of tasks. See for
 instance @code{examples/lu/lu_example.c}: before submitting tasks,
 call @code{starpu_bound_start}, and after complete execution, call
-@code{starpu_bound_stop}. @code{starpu_bound_print_lp} can then be used to
-output a Linear Programming problem corresponding to the schedule of your
-tasks. Run it through @code{lp_solve}, and that will give you a lower bound for the total execution time of your tasks.
+@code{starpu_bound_stop}. @code{starpu_bound_print_lp} or
+@code{starpu_bound_print_mps} can then be used to output a Linear Programming
+problem corresponding to the schedule of your tasks. Run it through
+@code{lp_solve} or any other linear programming solver, and that will give you a
+lower bound for the total execution time of your tasks.
 
 Note that this is not taking into account task dependencies and data
 transfers. It only takes into account the actual computations on processing

+ 1 - 1
examples/lu/lu_example.c

@@ -319,7 +319,7 @@ int main(int argc, char **argv)
 
 	if (bound) {
 		starpu_bound_stop();
-		starpu_bound_print_lp(stderr);
+		starpu_bound_print_mps(stderr);
 	}
 
 	if (check)

+ 46 - 9
src/profiling/bound.c

@@ -161,7 +161,7 @@ void starpu_bound_print_lp(FILE *output)
 		}
 		fprintf(output, "\n");
 
-		/* And we have to have computed exactly all tasks */
+		fprintf(output, "/* And we have to have computed exactly all tasks */\n");
 		for (t = 0, tp = task_pools; tp; t++, tp = tp->next) {
 			fprintf(output, "/* task %s key %lx */\n", tp->cl->model->symbol, (unsigned long) tp->footprint);
 			for (w = 0; w < nw; w++)
@@ -174,8 +174,8 @@ void starpu_bound_print_lp(FILE *output)
 			fprintf(output, "\t*/\n\n");
 		}
 
-		/* Optionally tell that tasks can not be divided */
-		fprintf(output, "int ");
+		fprintf(output, "/* Optionally tell that tasks can not be divided */\n");
+		fprintf(output, "/* int ");
 		int first = 1;
 		for (w = 0; w < nw; w++)
 			for (t = 0, tp = task_pools; tp; t++, tp = tp->next) {
@@ -185,7 +185,7 @@ void starpu_bound_print_lp(FILE *output)
 					first = 0;
 				fprintf(output, "w%dt%dn", w, t);
 			}
-		fprintf(output, ";\n");
+		fprintf(output, "; */\n");
 	}
 
 	PTHREAD_MUTEX_UNLOCK(&mutex);
@@ -210,13 +210,50 @@ void starpu_bound_print_mps(FILE *output)
 
 		_starpu_get_tasks_times(nw, nt, times);
 
-		fprintf(output, "NAME           StarPU theoretical bound");
-		fprintf(output, "ROWS");
-		fprintf(output, "TODO");
+		fprintf(output, "NAME           StarPU theoretical bound\n");
+
+		fprintf(output, "\nROWS\n");
+
+		fprintf(output, "* We want to minimize total execution time (ms)\n");
+		fprintf(output, " N  TMAX\n");
+
+		fprintf(output, "\n* Which is the maximum of all worker execution times (ms)\n");
+		for (w = 0; w < nw; w++) {
+			char name[32];
+			starpu_worker_get_name(w, name, sizeof(name));
+			fprintf(output, "* worker %s\n", name);
+			fprintf(output, " L  W%d\n", w);
+		}
+
+		fprintf(output, "\n* And we have to have computed exactly all tasks\n");
 		for (t = 0, tp = task_pools; tp; t++, tp = tp->next) {
-			for (w = 0; w < nw; w++)
-				;
+			fprintf(output, "* task %s key %lx\n", tp->cl->model->symbol, (unsigned long) tp->footprint);
+			fprintf(output, " E  T%d\n", t);
 		}
+
+		fprintf(output, "\nCOLUMNS\n");
+
+		fprintf(output, "\n* Execution times and completion of all tasks\n");
+		for (w = 0; w < nw; w++)
+			for (t = 0, tp = task_pools; tp; t++, tp = tp->next) {
+				char name[9];
+				snprintf(name, sizeof(name)-1, "W%dT%d", w, t);
+				fprintf(stderr,"    %-8s  W%-7d  %12f\n", name, w, times[w][t]);
+				fprintf(stderr,"    %-8s  T%-7d  %12u\n", name, t, 1);
+			}
+
+		fprintf(output, "\n* Total execution time\n");
+		for (w = 0; w < nw; w++)
+			fprintf(stderr,"    TMAX      W%-2d       %12d\n", w, -1);
+		fprintf(stderr,"    TMAX      TMAX      %12d\n", 1);
+
+		fprintf(output, "\nRHS\n");
+
+		fprintf(output, "\n* Total number of tasks\n");
+		for (t = 0, tp = task_pools; tp; t++, tp = tp->next)
+			fprintf(stderr,"    NT%-2d      T%-7d  %12lu\n", t, t, tp->n);
+
+		fprintf(output, "ENDATA\n");
 	}
 
 	PTHREAD_MUTEX_UNLOCK(&mutex);