Browse Source

Add a -profile option to the LU example which displays the bus consumption during the execution

Cédric Augonnet 15 years ago
parent
commit
1acbb7acf9
1 changed files with 14 additions and 0 deletions
  1. 14 0
      examples/lu/lu_example.c

+ 14 - 0
examples/lu/lu_example.c

@@ -20,6 +20,7 @@
 #include <time.h>
 #include <time.h>
 #include <math.h>
 #include <math.h>
 #include <starpu.h>
 #include <starpu.h>
+#include <starpu_profiling.h>
 
 
 #include "xlu.h"
 #include "xlu.h"
 #include "xlu_kernels.h"
 #include "xlu_kernels.h"
@@ -29,6 +30,7 @@ static unsigned nblocks = 16;
 static unsigned check = 0;
 static unsigned check = 0;
 static unsigned pivot = 0;
 static unsigned pivot = 0;
 static unsigned no_stride = 0;
 static unsigned no_stride = 0;
+static unsigned profile = 0;
 
 
 TYPE *A, *A_saved;
 TYPE *A, *A_saved;
 
 
@@ -61,6 +63,9 @@ static void parse_args(int argc, char **argv)
 			no_stride = 1;
 			no_stride = 1;
 		}
 		}
 
 
+		if (strcmp(argv[i], "-profile") == 0) {
+			profile = 1;
+		}
 	}
 	}
 }
 }
 
 
@@ -256,6 +261,9 @@ int main(int argc, char **argv)
 
 
 	display_matrix(A, size, size, "A");
 	display_matrix(A, size, size, "A");
 
 
+	if (profile)
+		starpu_profiling_status_set(STARPU_PROFILING_ENABLE);
+
 	/* Factorize the matrix (in place) */
 	/* Factorize the matrix (in place) */
 	if (pivot)
 	if (pivot)
 	{
 	{
@@ -295,6 +303,12 @@ int main(int argc, char **argv)
 		STARPU_LU(lu_decomposition)(A, size, size, nblocks);
 		STARPU_LU(lu_decomposition)(A, size, size, nblocks);
 	}
 	}
 
 
+	if (profile)
+	{
+		starpu_profiling_status_set(STARPU_PROFILING_DISABLE);
+		starpu_bus_profiling_helper_display_summary();
+	}
+
 	if (check)
 	if (check)
 	{
 	{
 		if (pivot)
 		if (pivot)