瀏覽代碼

Add option to draw energy-based perfmodels

Samuel Thibault 4 年之前
父節點
當前提交
0e89b9db1c
共有 1 個文件被更改,包括 30 次插入7 次删除
  1. 30 7
      tools/starpu_perfmodel_plot.c

+ 30 - 7
tools/starpu_perfmodel_plot.c

@@ -50,6 +50,7 @@ struct _perfmodel_plot_options
 	/* display all available combinations of a specific model */
 	int list_combs;
 	int gflops;
+	int energy;
 	/* Unless a FxT file is specified, we just display the model */
 	int with_fxt_file;
 
@@ -72,6 +73,7 @@ static void usage()
 	fprintf(stderr, "   -d                  display the directory storing performance models\n");
         fprintf(stderr, "   -l                  display all available models\n");
         fprintf(stderr, "   -s <symbol>         specify the symbol\n");
+	fprintf(stderr, "   -e                  display perfmodel as energy instead of time\n");
 	fprintf(stderr, "   -f                  draw GFlops instead of time\n");
 	fprintf(stderr, "   -i <Fxt files>      input FxT files generated by StarPU\n");
 	fprintf(stderr, "   -lc                 display all combinations of a given model\n");
@@ -143,6 +145,12 @@ static void parse_args(int argc, char **argv, struct _perfmodel_plot_options *op
 			continue;
 		}
 
+		if (strcmp(argv[i], "-e") == 0)
+		{
+			options->energy = 1;
+			continue;
+		}
+
 		if (strcmp(argv[i], "-c") == 0)
 		{
 			options->comb_is_set = 1;
@@ -349,12 +357,21 @@ static void display_history_based_perf_models(FILE *gnuplot_file, struct starpu_
 						if (entry->size == minimum)
 						{
 							if (options->gflops)
-								fprintf(datafile, "\t%-15le\t%-15le", entry->flops / (entry->mean * 1000),
-									entry->flops / ((entry->mean + entry->deviation) * 1000) -
-									entry->flops / (entry->mean * 1000)
-									);
+								if (options->energy)
+									fprintf(datafile, "\t%-15le\t%-15le", entry->flops / entry->mean,
+										entry->flops / (entry->mean + entry->deviation) -
+										entry->flops / entry->mean
+										);
+								else
+									fprintf(datafile, "\t%-15le\t%-15le", entry->flops / (entry->mean * 1000),
+										entry->flops / ((entry->mean + entry->deviation) * 1000) -
+										entry->flops / (entry->mean * 1000)
+										);
 							else
-								fprintf(datafile, "\t%-15le\t%-15le", 0.001*entry->mean, 0.001*entry->deviation);
+								if (options->energy)
+									fprintf(datafile, "\t%-15le\t%-15le", entry->mean, entry->deviation);
+								else
+									fprintf(datafile, "\t%-15le\t%-15le", 0.001*entry->mean, 0.001*entry->deviation);
 							break;
 						}
 					}
@@ -427,9 +444,15 @@ static void display_selected_models(FILE *gnuplot_file, struct starpu_perfmodel
 	fprintf(gnuplot_file, "set title \"Model for codelet %s\"\n", symbol);
 	fprintf(gnuplot_file, "set xlabel \"Total data size\"\n");
 	if (options->gflops)
-		fprintf(gnuplot_file, "set ylabel \"GFlops\"\n");
+		if (options->energy)
+			fprintf(gnuplot_file, "set ylabel \"GFlop/J\"\n");
+		else
+			fprintf(gnuplot_file, "set ylabel \"GFlop/s\"\n");
 	else
-		fprintf(gnuplot_file, "set ylabel \"Time (ms)\"\n");
+		if (options->energy)
+			fprintf(gnuplot_file, "set ylabel \"Energy (J)\"\n");
+		else
+			fprintf(gnuplot_file, "set ylabel \"Time (ms)\"\n");
 	fprintf(gnuplot_file, "\n");
 	fprintf(gnuplot_file, "set key top left\n");
 	fprintf(gnuplot_file, "set logscale x\n");