Browse Source

Make some example outputs nicer to plot

Samuel Thibault 10 years ago
parent
commit
3192fc5b08

+ 1 - 0
examples/cholesky/cholesky.h

@@ -31,6 +31,7 @@
 #include <starpu.h>
 
 #define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
+#define PRINTF(fmt, ...) do { if (!getenv("STARPU_SSILENT")) {printf(fmt, ## __VA_ARGS__); }} while(0)
 #define NMAXBLOCKS	32
 
 #define TAG11(k)	((starpu_tag_t)( (1ULL<<60) | (unsigned long long)(k)))

+ 4 - 3
examples/cholesky/cholesky_grain_tag.c

@@ -304,11 +304,12 @@ int cholesky_grain(float *matA, unsigned size, unsigned ld, unsigned nblocks, un
 	end = starpu_timing_now();
 
 	double timing = end - start;
-	FPRINTF(stderr, "Computation took (in ms)\n");
-	FPRINTF(stdout, "%2.2f\n", timing/1000);
 
 	double flop = (1.0f*size*size*size)/3.0f;
-	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+
+	PRINTF("# size\tms\tGFlops\n");
+	PRINTF("%u\t%.0f\t%.1f\n", size, timing/1000, (flop/timing/1000.0f));
+
 	return ret;
 }
 

+ 8 - 6
examples/cholesky/cholesky_implicit.c

@@ -122,10 +122,12 @@ static int _cholesky(starpu_data_handle_t dataA, unsigned nblocks)
 		update_sched_ctx_timing_results((flop/timing/1000.0f), (timing/1000000.0f));
 	else
 	{
-		FPRINTF(stderr, "Computation took (in ms)\n");
-		FPRINTF(stdout, "%2.2f\n", timing/1000);
-	
-		FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+		PRINTF("# size\tms\tGFlops");
+		if (bound)
+			PRINTF("\tTms\tTGFlops");
+		PRINTF("\n");
+
+		PRINTF("%u\t%.0f\t%.1f", n, timing/1000, (flop/timing/1000.0f));
 		if (bound_lp)
 		{
 			FILE *f = fopen("cholesky.lp", "w");
@@ -140,9 +142,9 @@ static int _cholesky(starpu_data_handle_t dataA, unsigned nblocks)
 		{
 			double res;
 			starpu_bound_compute(&res, NULL, 0);
-			FPRINTF(stderr, "Theoretical makespan: %2.2f\n", res);
-			FPRINTF(stderr, "Theoretical GFlops: %2.2f\n", (flop/res/1000000.0f));
+			PRINTF("\t%.0f\t%.1f", res, (flop/res/1000000.0f));
 		}
+		PRINTF("\n");
 	}
 	return 0;
 }

+ 3 - 3
examples/cholesky/cholesky_tag.c

@@ -212,13 +212,13 @@ static void _cholesky(starpu_data_handle_t dataA, unsigned nblocks)
 
 
 	double timing = end - start;
-	FPRINTF(stderr, "Computation took (in ms)\n");
-	FPRINTF(stdout, "%2.2f\n", timing/1000);
 
 	unsigned n = starpu_matrix_get_nx(dataA);
 
 	double flop = (1.0f*n*n*n)/3.0f;
-	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+
+	PRINTF("# size\tms\tGFlops\n");
+	PRINTF("%u\t%.0f\t%.1f\n", n, timing/1000, (flop/timing/1000.0f));
 }
 
 static int initialize_system(float **A, unsigned dim, unsigned pinned)

+ 2 - 3
examples/cholesky/cholesky_tile_tag.c

@@ -201,11 +201,10 @@ static int cholesky_no_stride(void)
 	end = starpu_timing_now();
 
 	double timing = end - start;
-	FPRINTF(stderr, "Computation took (in ms)\n");
-	FPRINTF(stdout, "%2.2f\n", timing/1000);
 
 	double flop = (1.0f*size*size*size)/3.0f;
-	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+	PRINTF("# size\tms\tGFlops\n");
+	PRINTF("%u\t%.0f\t%.1f\n", size, timing/1000, (flop/timing/1000.0f));
 
 	return 0;
 }

+ 6 - 6
examples/heat/dw_factolu.c

@@ -637,12 +637,12 @@ void dw_codelet_facto(starpu_data_handle_t dataA, unsigned nblocks)
 	end = starpu_timing_now();
 
 	double timing = end - start;
-	FPRINTF(stderr, "Computation took (in ms)\n");
-	FPRINTF(stdout, "%2.2f\n", timing/1000);
 
 	unsigned n = starpu_matrix_get_nx(dataA);
 	double flop = (2.0f*n*n*n)/3.0f;
-	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+
+	PRINTF("# size\tms\tGFlops\n");
+	PRINTF("%u\t%.0f\t%.1f\n", n, timing/1000, flop/timing/1000.0f);
 }
 
 void dw_codelet_facto_v2(starpu_data_handle_t dataA, unsigned nblocks)
@@ -687,12 +687,12 @@ void dw_codelet_facto_v2(starpu_data_handle_t dataA, unsigned nblocks)
 	end = starpu_timing_now();
 
 	double timing = end - start;
-	FPRINTF(stderr, "Computation took (in ms)\n");
-	FPRINTF(stdout, "%2.2f\n", timing/1000);
 
 	unsigned n = starpu_matrix_get_nx(dataA);
 	double flop = (2.0f*n*n*n)/3.0f;
-	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+
+	PRINTF("# size\tms\tGFlops\n");
+	PRINTF("%u\t%.0f\t%.1f\n", n, timing/1000, flop/timing/1000.0f);
 
 	free(advance_11);
 	free(advance_12_21);

+ 2 - 1
examples/heat/dw_factolu.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009, 2010-2012  Université de Bordeaux
+ * Copyright (C) 2009, 2010-2012, 2014  Université de Bordeaux
  * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -33,6 +33,7 @@
 #include "lu_kernels_model.h"
 
 #define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
+#define PRINTF(fmt, ...) do { if (!getenv("STARPU_SSILENT")) {(fmt, ## __VA_ARGS__); }} while(0)
 
 #define BLAS3_FLOP(n1,n2,n3)    \
         (2*((uint64_t)n1)*((uint64_t)n2)*((uint64_t)n3))

+ 3 - 3
examples/heat/dw_factolu_grain.c

@@ -357,12 +357,12 @@ void dw_factoLU_grain(float *matA, unsigned size, unsigned ld, unsigned nblocks,
 	end = starpu_timing_now();
 
 	double timing = end - start;
-	FPRINTF(stderr, "Computation took (in ms)\n");
-	FPRINTF(stdout, "%2.2f\n", timing/1000);
 
 	unsigned n = size;
 	double flop = (2.0f*n*n*n)/3.0f;
-	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+
+	PRINTF("# size\tms\tGFlops\n");
+	PRINTF("%u\t%.0f\t%.1f\n", n, timing/1000, flop/timing/1000.0f);
 
 #ifdef CHECK_RESULTS
 	compare_A_LU(Asaved, matA, size, ld);

+ 3 - 3
examples/heat/dw_factolu_tag.c

@@ -277,12 +277,12 @@ static void dw_codelet_facto_v3(starpu_data_handle_t dataA, unsigned nblocks)
 	end = starpu_timing_now();
 
 	double timing = end - start;
-	FPRINTF(stderr, "Computation took (in ms)\n");
-	printf("%2.2f\n", timing/1000);
 
 	unsigned n = starpu_matrix_get_nx(dataA);
 	double flop = (2.0f*n*n*n)/3.0f;
-	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+
+	PRINTF("# size\tms\tGFlops\n");
+	PRINTF("%u\t%.0f\t%.1f\n", n, timing/1000, flop/timing/1000.0f);
 }
 
 void dw_factoLU_tag(float *matA, unsigned size, unsigned ld, unsigned nblocks, unsigned _no_prio)

+ 2 - 1
examples/heat/heat.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009, 2010, 2011-2012  Université de Bordeaux
+ * Copyright (C) 2009, 2010, 2011-2012, 2014  Université de Bordeaux
  * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -36,6 +36,7 @@
 #endif
 
 #define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
+#define PRINTF(fmt, ...) do { if (!getenv("STARPU_SSILENT")) {printf(fmt, ## __VA_ARGS__); }} while(0)
 
 #define X	0
 #define Y	1

+ 0 - 1
examples/lu/lu_example.c

@@ -422,7 +422,6 @@ int main(int argc, char **argv)
 
 	starpu_free(A);
 
-	FPRINTF(stderr, "Shutting down\n");
 	starpu_cublas_shutdown();
 
 	starpu_shutdown();

+ 3 - 4
examples/lu/xlu.c

@@ -224,12 +224,11 @@ static int dw_codelet_facto_v3(starpu_data_handle_t dataA, unsigned nblocks)
 	end = starpu_timing_now();
 
 	double timing = end - start;
-	FPRINTF(stderr, "Computation took (in ms)\n");
-	FPRINTF(stdout, "%2.2f\n", timing/1000);
-
 	unsigned n = starpu_matrix_get_nx(dataA);
 	double flop = (2.0f*n*n*n)/3.0f;
-	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+
+	PRINTF("# size\tms\tGFlops\n");
+	PRINTF("%u\t%.0f\t%.1f\n", n, timing/1000, flop/timing/1000.0f);
 
 	return 0;
 }

+ 1 - 0
examples/lu/xlu.h

@@ -33,6 +33,7 @@
 					| (unsigned long long)(i))))
 
 #define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
+#define PRINTF(fmt, ...) do { if (!getenv("STARPU_SSILENT")) {printf(fmt, ## __VA_ARGS__); }} while(0)
 
 #define BLAS3_FLOP(n1,n2,n3)    \
         (2*((uint64_t)n1)*((uint64_t)n2)*((uint64_t)n3))

+ 4 - 4
examples/lu/xlu_implicit.c

@@ -145,12 +145,12 @@ static int dw_codelet_facto_v3(starpu_data_handle_t dataA, unsigned nblocks)
 	end = starpu_timing_now();
 
 	double timing = end - start;
-	FPRINTF(stderr, "Computation took (in ms)\n");
-	FPRINTF(stdout, "%2.2f\n", timing/1000);
-
 	unsigned n = starpu_matrix_get_nx(dataA);
 	double flop = (2.0f*n*n*n)/3.0f;
-	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+
+	PRINTF("# size\tms\tGFlops\n");
+	PRINTF("%u\t%.0f\t%.1f\n", n, timing/1000, flop/timing/1000.0f);
+
 	return 0;
 }
 

+ 8 - 8
examples/lu/xlu_implicit_pivot.c

@@ -251,12 +251,12 @@ int STARPU_LU(lu_decomposition_pivot)(TYPE *matA, unsigned *ipiv, unsigned size,
 	if (ret)
 		return ret;
 
-	FPRINTF(stderr, "Computation took (in ms)\n");
-	FPRINTF(stderr, "%2.2f\n", timing/1000);
-
 	unsigned n = starpu_matrix_get_nx(dataA);
 	double flop = (2.0f*n*n*n)/3.0f;
-	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+
+	PRINTF("# size\tms\tGFlops\n");
+	PRINTF("%u\t%.0f\t%.1f\n", n, timing/1000, flop/timing/1000.0f);
+
 
 	/* gather all the data */
 	starpu_data_unpartition(dataA, STARPU_MAIN_RAM);
@@ -306,12 +306,12 @@ int STARPU_LU(lu_decomposition_pivot_no_stride)(TYPE **matA, unsigned *ipiv, uns
 	if (ret)
 		return ret;
 
-	FPRINTF(stderr, "Computation took (in ms)\n");
-	FPRINTF(stderr, "%2.2f\n", timing/1000);
-
 	unsigned n = starpu_matrix_get_nx(dataAp[0])*nblocks;
 	double flop = (2.0f*n*n*n)/3.0f;
-	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+
+	PRINTF("# size\tms\tGFlops\n");
+	PRINTF("%u\t%.0f\t%.1f\n", n, timing/1000, flop/timing/1000.0f);
+
 
 	for (bj = 0; bj < nblocks; bj++)
 	for (bi = 0; bi < nblocks; bi++)

+ 6 - 8
examples/lu/xlu_pivot.c

@@ -371,12 +371,11 @@ int STARPU_LU(lu_decomposition_pivot)(TYPE *matA, unsigned *ipiv, unsigned size,
 	double timing=0.0;
 	int ret = dw_codelet_facto_pivot(&dataA, piv_description, nblocks, get_block_with_striding, &timing);
 
-	FPRINTF(stderr, "Computation took (in ms)\n");
-	FPRINTF(stderr, "%2.2f\n", timing/1000);
-
 	unsigned n = starpu_matrix_get_nx(dataA);
 	double flop = (2.0f*n*n*n)/3.0f;
-	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+
+	PRINTF("# size\tms\tGFlops\n");
+	PRINTF("%u\t%.0f\t%.1f\n", n, timing/1000, flop/timing/1000.0f);
 
 	/* gather all the data */
 	starpu_data_unpartition(dataA, STARPU_MAIN_RAM);
@@ -426,12 +425,11 @@ int STARPU_LU(lu_decomposition_pivot_no_stride)(TYPE **matA, unsigned *ipiv, uns
 	double timing=0.0;
 	int ret = dw_codelet_facto_pivot(dataAp, piv_description, nblocks, get_block_with_no_striding, &timing);
 
-	FPRINTF(stderr, "Computation took (in ms)\n");
-	FPRINTF(stderr, "%2.2f\n", timing/1000);
-
 	unsigned n = starpu_matrix_get_nx(dataAp[0])*nblocks;
 	double flop = (2.0f*n*n*n)/3.0f;
-	FPRINTF(stderr, "Synthetic GFlops : %2.2f\n", (flop/timing/1000.0f));
+
+	PRINTF("# size\tms\tGFlops\n");
+	PRINTF("%u\t%.0f\t%.1f\n", n, timing/1000, flop/timing/1000.0f);
 
 	for (bj = 0; bj < nblocks; bj++)
 	for (bi = 0; bi < nblocks; bi++)

+ 2 - 2
examples/ppm_downscaler/yuv_downscaler.c

@@ -277,8 +277,8 @@ int main(int argc, char **argv)
 	end = starpu_timing_now();
 
 	double timing = end - start;
-	fprintf(stderr, "Computation took %f seconds\n", timing/1000000);
-	fprintf(stderr, "FPS %f\n", (1000000*nframes)/timing);
+	printf("# s\tFPS\n");
+	printf("%f\t%f\n", timing/1000000, (1000000*nframes)/timing);
 
 	fwrite(yuv_out_buffer, NEW_FRAMESIZE, nframes, f_out);