|
@@ -44,6 +44,8 @@ struct _perfmodel_plot_options
|
|
|
int directory;
|
|
|
/* what kernel ? */
|
|
|
char *symbol;
|
|
|
+ /* what energy model ? */
|
|
|
+ char *energy_symbol;
|
|
|
/* which combination */
|
|
|
int comb_is_set;
|
|
|
int comb;
|
|
@@ -74,6 +76,8 @@ static void usage()
|
|
|
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, " -se <time_symbol> <energy_symbol> \n");
|
|
|
+ fprintf(stderr, " specify both a time symbol and an energy symbol\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");
|
|
@@ -115,6 +119,14 @@ static void parse_args(int argc, char **argv, struct _perfmodel_plot_options *op
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
+ if (strcmp(argv[i], "-se") == 0)
|
|
|
+ {
|
|
|
+ options->symbol = argv[++i];
|
|
|
+ options->energy_symbol = argv[++i];
|
|
|
+ correct_usage = 1;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
if (strcmp(argv[i], "-o") == 0)
|
|
|
{
|
|
|
free(*directory);
|
|
@@ -122,7 +134,6 @@ static void parse_args(int argc, char **argv, struct _perfmodel_plot_options *op
|
|
|
#ifdef STARPU_USE_FXT
|
|
|
options->fxt_options.dir = strdup(*directory);
|
|
|
#endif
|
|
|
- correct_usage = 1;
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -285,7 +296,7 @@ static void display_perf_model(FILE *gnuplot_file, struct starpu_perfmodel_arch*
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static void display_history_based_perf_models(FILE *gnuplot_file, struct starpu_perfmodel *model, int *first, struct _perfmodel_plot_options *options)
|
|
|
+static void display_history_based_perf_models(FILE *gnuplot_file, struct starpu_perfmodel *model, struct starpu_perfmodel *energy_model, int *first, struct _perfmodel_plot_options *options)
|
|
|
{
|
|
|
FILE *datafile;
|
|
|
struct starpu_perfmodel_history_list *ptr;
|
|
@@ -353,6 +364,7 @@ static void display_history_based_perf_models(FILE *gnuplot_file, struct starpu_
|
|
|
|
|
|
fprintf(stderr, "%lu ", minimum);
|
|
|
fprintf(datafile, "%-15lu ", minimum);
|
|
|
+ /* Find that minimum */
|
|
|
for(i = 0; i < model->state->ncombs; i++)
|
|
|
{
|
|
|
int comb = model->state->combs[i];
|
|
@@ -362,30 +374,68 @@ static void display_history_based_perf_models(FILE *gnuplot_file, struct starpu_
|
|
|
|
|
|
for(impl = 0; impl < model->state->nimpls[comb]; impl++)
|
|
|
{
|
|
|
+ int found = 0;
|
|
|
struct starpu_perfmodel_per_arch *arch_model = &model->state->per_arch[comb][impl];
|
|
|
for (ptr = arch_model->list; ptr; ptr = ptr->next)
|
|
|
{
|
|
|
struct starpu_perfmodel_history_entry *entry = ptr->entry;
|
|
|
if (entry->size == minimum)
|
|
|
{
|
|
|
- if (options->gflops)
|
|
|
- if (options->energy)
|
|
|
- fprintf(datafile, "\t%-15le\t%-15le", entry->flops / entry->mean,
|
|
|
- entry->flops * entry->deviation / (entry->mean * entry->mean)
|
|
|
- );
|
|
|
- else
|
|
|
- fprintf(datafile, "\t%-15le\t%-15le", entry->flops / (entry->mean * 1000),
|
|
|
- entry->flops * entry->deviation / (entry->mean * entry->mean * 1000)
|
|
|
- );
|
|
|
+ if (options->energy_symbol)
|
|
|
+ {
|
|
|
+ /* Look for the same in the energy model */
|
|
|
+
|
|
|
+ if (impl >= energy_model->state->nimpls[comb])
|
|
|
+ /* Doesn't have measurements for this impl */
|
|
|
+ break;
|
|
|
+
|
|
|
+ struct starpu_perfmodel_per_arch *arch_model2 = &energy_model->state->per_arch[comb][impl];
|
|
|
+ struct starpu_perfmodel_history_list *ptr2;
|
|
|
+ for (ptr2 = arch_model2->list; ptr2; ptr2 = ptr2->next)
|
|
|
+ {
|
|
|
+ struct starpu_perfmodel_history_entry *entry2 = ptr2->entry;
|
|
|
+ if (entry2->size == minimum)
|
|
|
+ {
|
|
|
+ /* Found the same size, can print */
|
|
|
+
|
|
|
+ double rel_delta = sqrt(
|
|
|
+ (entry2->deviation * entry2->deviation) / (entry2->mean * entry2->mean)
|
|
|
+ + (entry->deviation * entry->deviation) / (entry->mean * entry->mean));
|
|
|
+
|
|
|
+ if (options->gflops)
|
|
|
+ fprintf(datafile, "\t%-15le\t%-15le", entry->flops / (entry->mean * 1000) / entry2->mean,
|
|
|
+ entry->flops / (entry->mean * 1000) / entry2->mean * rel_delta);
|
|
|
+ else
|
|
|
+ fprintf(datafile, "\t%-15le\t%-15le", entry2->mean / (entry->mean / 1000000),
|
|
|
+ entry2->mean / (entry->mean / 1000000) * rel_delta);
|
|
|
+ found = 1;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
else
|
|
|
- if (options->energy)
|
|
|
- fprintf(datafile, "\t%-15le\t%-15le", entry->mean, entry->deviation);
|
|
|
+ {
|
|
|
+ if (options->gflops)
|
|
|
+ if (options->energy)
|
|
|
+ fprintf(datafile, "\t%-15le\t%-15le", entry->flops / entry->mean / 1000000000,
|
|
|
+ entry->flops * entry->deviation / (entry->mean * entry->mean) / 1000000000
|
|
|
+ );
|
|
|
+ else
|
|
|
+ fprintf(datafile, "\t%-15le\t%-15le", entry->flops / (entry->mean * 1000),
|
|
|
+ entry->flops * entry->deviation / (entry->mean * 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);
|
|
|
+ found = 1;
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- if (!ptr && arch_model->list)
|
|
|
+ if (!found && arch_model->list)
|
|
|
/* No value for this arch. */
|
|
|
fprintf(datafile, "\t\"\"\t\"\"");
|
|
|
}
|
|
@@ -443,7 +493,7 @@ static void dump_data_file(FILE *data_file, struct _perfmodel_plot_options *opti
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
-static void display_selected_models(FILE *gnuplot_file, struct starpu_perfmodel *model, struct _perfmodel_plot_options *options)
|
|
|
+static void display_selected_models(FILE *gnuplot_file, struct starpu_perfmodel *model, struct starpu_perfmodel *energy_model, struct _perfmodel_plot_options *options)
|
|
|
{
|
|
|
char *symbol = replace_char(options->symbol, '_', '-');
|
|
|
|
|
@@ -454,12 +504,16 @@ 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)
|
|
|
- if (options->energy)
|
|
|
+ if (options->energy_symbol)
|
|
|
+ fprintf(gnuplot_file, "set ylabel \"GFlop/W\"\n");
|
|
|
+ else if (options->energy)
|
|
|
fprintf(gnuplot_file, "set ylabel \"GFlop/J\"\n");
|
|
|
else
|
|
|
fprintf(gnuplot_file, "set ylabel \"GFlop/s\"\n");
|
|
|
else
|
|
|
- if (options->energy)
|
|
|
+ if (options->energy_symbol)
|
|
|
+ fprintf(gnuplot_file, "set ylabel \"Power (W)\"\n");
|
|
|
+ else if (options->energy)
|
|
|
fprintf(gnuplot_file, "set ylabel \"Energy (J)\"\n");
|
|
|
else
|
|
|
fprintf(gnuplot_file, "set ylabel \"Time (ms)\"\n");
|
|
@@ -479,7 +533,9 @@ static void display_selected_models(FILE *gnuplot_file, struct starpu_perfmodel
|
|
|
|
|
|
/* display all or selected combinations */
|
|
|
display_all_perf_models(gnuplot_file, model, &first, options);
|
|
|
- display_history_based_perf_models(gnuplot_file, model, &first, options);
|
|
|
+ if (options->energy_symbol)
|
|
|
+ display_all_perf_models(gnuplot_file, energy_model, &first, options);
|
|
|
+ display_history_based_perf_models(gnuplot_file, model, energy_model, &first, options);
|
|
|
|
|
|
free(symbol);
|
|
|
}
|
|
@@ -488,6 +544,7 @@ int main(int argc, char **argv)
|
|
|
{
|
|
|
int ret = 0;
|
|
|
struct starpu_perfmodel model = { .type = STARPU_PERFMODEL_INVALID };
|
|
|
+ struct starpu_perfmodel energy_model = { .type = STARPU_PERFMODEL_INVALID };
|
|
|
char gnuplot_file_name[256];
|
|
|
struct _perfmodel_plot_options options;
|
|
|
char *directory = strdup("./");
|
|
@@ -516,6 +573,8 @@ int main(int argc, char **argv)
|
|
|
{
|
|
|
/* Load the performance model associated to the symbol */
|
|
|
ret = starpu_perfmodel_load_symbol(options.symbol, &model);
|
|
|
+ if (options.energy_symbol)
|
|
|
+ ret = starpu_perfmodel_load_symbol(options.energy_symbol, &energy_model);
|
|
|
if (ret)
|
|
|
{
|
|
|
_STARPU_DISP("The performance model for the symbol <%s> could not be loaded\n", options.symbol);
|
|
@@ -550,7 +609,7 @@ int main(int argc, char **argv)
|
|
|
|
|
|
FILE *gnuplot_file = fopen(gnuplot_file_name, "w+");
|
|
|
STARPU_ASSERT_MSG(gnuplot_file, "Cannot create file <%s>\n", gnuplot_file_name);
|
|
|
- display_selected_models(gnuplot_file, &model, &options);
|
|
|
+ display_selected_models(gnuplot_file, &model, &energy_model, &options);
|
|
|
fprintf(gnuplot_file,"\n");
|
|
|
fclose(gnuplot_file);
|
|
|
|