Pārlūkot izejas kodu

Add theoretical bound support to cholesky, document that the result is in ms

Samuel Thibault 13 gadi atpakaļ
vecāks
revīzija
63d7799af6

+ 2 - 2
doc/starpu.texi

@@ -1429,9 +1429,9 @@ 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
 @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. If StarPU was compiled
 lower bound for the total execution time of your tasks. If StarPU was compiled
 with the glpk library installed, @code{starpu_bound_compute} can be used to
 with the glpk library installed, @code{starpu_bound_compute} can be used to
-solve it immediately and get the optimized minimum. Its @code{integer}
+solve it immediately and get the optimized minimum, in ms. Its @code{integer}
 parameter allows to decide whether integer resolution should be computed
 parameter allows to decide whether integer resolution should be computed
-and returned.
+and returned too.
 
 
 The @code{deps} parameter tells StarPU whether to take tasks and implicit data
 The @code{deps} parameter tells StarPU whether to take tasks and implicit data
 dependencies into account. It must be understood that the linear programming
 dependencies into account. It must be understood that the linear programming

+ 6 - 0
examples/cholesky/cholesky.h

@@ -30,6 +30,7 @@
 
 
 #include <common/blas.h>
 #include <common/blas.h>
 #include <starpu.h>
 #include <starpu.h>
+#include <starpu_bound.h>
 
 
 #define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 #define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 #define NMAXBLOCKS	32
 #define NMAXBLOCKS	32
@@ -61,6 +62,7 @@ static unsigned nbigblocks = 8;
 static unsigned pinned = 0;
 static unsigned pinned = 0;
 static unsigned noprio = 0;
 static unsigned noprio = 0;
 static unsigned check = 0;
 static unsigned check = 0;
+static unsigned bound = 0;
 
 
 void chol_cpu_codelet_update_u11(void **, void *);
 void chol_cpu_codelet_update_u11(void **, void *);
 void chol_cpu_codelet_update_u21(void **, void *);
 void chol_cpu_codelet_update_u21(void **, void *);
@@ -103,6 +105,10 @@ static void __attribute__((unused)) parse_args(int argc, char **argv)
 			noprio = 1;
 			noprio = 1;
 		}
 		}
 
 
+		if (strcmp(argv[i], "-bound") == 0) {
+			bound = 1;
+		}
+
 		if (strcmp(argv[i], "-check") == 0) {
 		if (strcmp(argv[i], "-check") == 0) {
 			check = 1;
 			check = 1;
 		}
 		}

+ 9 - 0
examples/cholesky/cholesky_implicit.c

@@ -80,6 +80,8 @@ static void _cholesky(starpu_data_handle dataA, unsigned nblocks)
 
 
 	gettimeofday(&start, NULL);
 	gettimeofday(&start, NULL);
 
 
+	if (bound)
+		starpu_bound_start(0, 0);
 	/* create all the DAG nodes */
 	/* create all the DAG nodes */
 	for (k = 0; k < nblocks; k++)
 	for (k = 0; k < nblocks; k++)
 	{
 	{
@@ -120,6 +122,8 @@ static void _cholesky(starpu_data_handle dataA, unsigned nblocks)
 	}
 	}
 
 
 	starpu_task_wait_for_all();
 	starpu_task_wait_for_all();
+	if (bound)
+		starpu_bound_stop();
 
 
 	starpu_data_unpartition(dataA, 0);
 	starpu_data_unpartition(dataA, 0);
 
 
@@ -133,6 +137,11 @@ static void _cholesky(starpu_data_handle dataA, unsigned nblocks)
 
 
 	double flop = (1.0f*n*n*n)/3.0f;
 	double flop = (1.0f*n*n*n)/3.0f;
 	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
 	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+	if (bound) {
+		double res;
+		starpu_bound_compute(&res, NULL, 0);
+		FPRINTF(stderr, "Theoretical GFlops: %2.2f\n", (flop/res/1000000.0f));
+	}
 }
 }
 
 
 static void cholesky(float *matA, unsigned size, unsigned ld, unsigned nblocks)
 static void cholesky(float *matA, unsigned size, unsigned ld, unsigned nblocks)

+ 1 - 1
include/starpu_bound.h

@@ -37,7 +37,7 @@ void starpu_bound_stop(void);
 /* Print the DAG that was recorded */
 /* Print the DAG that was recorded */
 void starpu_bound_print_dot(FILE *output);
 void starpu_bound_print_dot(FILE *output);
 
 
-/* Get theoretical upper bound (needs glpk support) */
+/* Get theoretical upper bound (in ms) (needs glpk support) */
 void starpu_bound_compute(double *res, double *integer_res, int integer);
 void starpu_bound_compute(double *res, double *integer_res, int integer);
 
 
 /* Emit Linear Programming system on output for the recorded tasks in lp format */
 /* Emit Linear Programming system on output for the recorded tasks in lp format */