|
@@ -1,7 +1,7 @@
|
|
|
/* StarPU --- Runtime system for heterogeneous multicore architectures.
|
|
|
*
|
|
|
* Copyright (C) 2011-2014 Université de Bordeaux 1
|
|
|
- * Copyright (C) 2011, 2012, 2013 Centre National de la Recherche Scientifique
|
|
|
+ * Copyright (C) 2011, 2012, 2013, 2014 Centre National de la Recherche Scientifique
|
|
|
* Copyright (C) 2011 Télécom-SudParis
|
|
|
*
|
|
|
* StarPU is free software; you can redistribute it and/or modify
|
|
@@ -16,16 +16,6 @@
|
|
|
* See the GNU Lesser General Public License in COPYING.LGPL for more details.
|
|
|
*/
|
|
|
|
|
|
-#if 1
|
|
|
-#include <stdio.h>
|
|
|
-#include <stdlib.h>
|
|
|
-int main(int argc, char **argv)
|
|
|
-{
|
|
|
- fprintf(stderr, "disabled tool\n");
|
|
|
- return 0;
|
|
|
-}
|
|
|
-#else
|
|
|
-
|
|
|
#include <config.h>
|
|
|
#include <assert.h>
|
|
|
#include <unistd.h>
|
|
@@ -47,33 +37,33 @@ int main(int argc, char **argv)
|
|
|
|
|
|
#define PROGNAME "starpu_perfmodel_plot"
|
|
|
|
|
|
-/* display all available models */
|
|
|
-static int list = 0;
|
|
|
-/* what kernel ? */
|
|
|
-static char *symbol = NULL;
|
|
|
-/* which architecture ? (NULL = all)*/
|
|
|
-static char *archname = NULL;
|
|
|
-/* Unless a FxT file is specified, we just display the model */
|
|
|
-static int no_fxt_file = 1;
|
|
|
-static int gflops = 0;
|
|
|
-
|
|
|
-#ifdef STARPU_USE_FXT
|
|
|
-static struct starpu_fxt_codelet_event *dumped_codelets;
|
|
|
-static struct starpu_fxt_options options;
|
|
|
-#endif
|
|
|
+struct _perfmodel_plot_options
|
|
|
+{
|
|
|
+ /* display all available models */
|
|
|
+ int list;
|
|
|
+ /* what kernel ? */
|
|
|
+ char *symbol;
|
|
|
+ /* which combination */
|
|
|
+ int comb_is_set;
|
|
|
+ int comb;
|
|
|
+ /* display all available combinations of a specific model */
|
|
|
+ int list_combs;
|
|
|
+ int gflops;
|
|
|
+ /* Unless a FxT file is specified, we just display the model */
|
|
|
+ int with_fxt_file;
|
|
|
+
|
|
|
+ char avg_file_name[256];
|
|
|
|
|
|
#ifdef STARPU_USE_FXT
|
|
|
-static int **archtype_is_found[STARPU_NARCH];
|
|
|
-
|
|
|
-static char data_file_name[256];
|
|
|
+ struct starpu_fxt_codelet_event *dumped_codelets;
|
|
|
+ struct starpu_fxt_options fxt_options;
|
|
|
+ char data_file_name[256];
|
|
|
#endif
|
|
|
-static char avg_file_name[256];
|
|
|
-static char gnuplot_file_name[256];
|
|
|
+};
|
|
|
|
|
|
static void usage()
|
|
|
{
|
|
|
- fprintf(stderr, "Draw a graph corresponding to the execution time of a \
|
|
|
-given perfmodel\n");
|
|
|
+ fprintf(stderr, "Draw a graph corresponding to the execution time of a given perfmodel\n");
|
|
|
fprintf(stderr, "Usage: %s [ options ]\n", PROGNAME);
|
|
|
fprintf(stderr, "\n");
|
|
|
fprintf(stderr, "One must specify a symbol with the -s option or use -l\n");
|
|
@@ -82,25 +72,28 @@ given perfmodel\n");
|
|
|
fprintf(stderr, " -s <symbol> specify the 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, " -a <arch> specify the architecture (e.g. cpu, cpu:x, cuda, cuda_d, opencl, opencl_d)\n");
|
|
|
+ fprintf(stderr, " -lc display all combinations of a given model\n");
|
|
|
+ fprintf(stderr, " -c <combination> specify the combination (use the option -lc to list all combinations of a given model)\n");
|
|
|
fprintf(stderr, " -h, --help display this help and exit\n");
|
|
|
fprintf(stderr, " -v, --version output version information and exit\n\n");
|
|
|
fprintf(stderr, "Report bugs to <%s>.", PACKAGE_BUGREPORT);
|
|
|
fprintf(stderr, "\n");
|
|
|
}
|
|
|
|
|
|
-static void parse_args(int argc, char **argv)
|
|
|
+static void parse_args(int argc, char **argv, struct _perfmodel_plot_options *options)
|
|
|
{
|
|
|
+ memset(options, 0, sizeof(struct _perfmodel_plot_options));
|
|
|
+
|
|
|
#ifdef STARPU_USE_FXT
|
|
|
/* Default options */
|
|
|
- starpu_fxt_options_init(&options);
|
|
|
+ starpu_fxt_options_init(&options->fxt_options);
|
|
|
|
|
|
- options.out_paje_path = NULL;
|
|
|
- options.activity_path = NULL;
|
|
|
- options.distrib_time_path = NULL;
|
|
|
- options.dag_path = NULL;
|
|
|
+ options->fxt_options.out_paje_path = NULL;
|
|
|
+ options->fxt_options.activity_path = NULL;
|
|
|
+ options->fxt_options.distrib_time_path = NULL;
|
|
|
+ options->fxt_options.dag_path = NULL;
|
|
|
|
|
|
- options.dumped_codelets = &dumped_codelets;
|
|
|
+ options->fxt_options.dumped_codelets = &options->dumped_codelets;
|
|
|
#endif
|
|
|
|
|
|
/* We want to support arguments such as "-i trace_*" */
|
|
@@ -111,7 +104,7 @@ static void parse_args(int argc, char **argv)
|
|
|
{
|
|
|
if (strcmp(argv[i], "-s") == 0)
|
|
|
{
|
|
|
- symbol = argv[++i];
|
|
|
+ options->symbol = argv[++i];
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -119,8 +112,8 @@ static void parse_args(int argc, char **argv)
|
|
|
{
|
|
|
reading_input_filenames = 1;
|
|
|
#ifdef STARPU_USE_FXT
|
|
|
- options.filenames[options.ninputfiles++] = argv[++i];
|
|
|
- no_fxt_file = 0;
|
|
|
+ options->fxt_options.filenames[options->fxt_options.ninputfiles++] = argv[++i];
|
|
|
+ options->with_fxt_file = 1;
|
|
|
#else
|
|
|
fprintf(stderr, "Warning: FxT support was not enabled in StarPU: FxT traces will thus be ignored!\n");
|
|
|
#endif
|
|
@@ -129,19 +122,26 @@ static void parse_args(int argc, char **argv)
|
|
|
|
|
|
if (strcmp(argv[i], "-l") == 0)
|
|
|
{
|
|
|
- list = 1;
|
|
|
+ options->list = 1;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (strcmp(argv[i], "-lc") == 0)
|
|
|
+ {
|
|
|
+ options->list_combs = 1;
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
if (strcmp(argv[i], "-f") == 0)
|
|
|
{
|
|
|
- gflops = 1;
|
|
|
+ options->gflops = 1;
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- if (strcmp(argv[i], "-a") == 0)
|
|
|
+ if (strcmp(argv[i], "-c") == 0)
|
|
|
{
|
|
|
- archname = argv[++i];
|
|
|
+ options->comb_is_set = 1;
|
|
|
+ options->comb = atoi(argv[++i]);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -165,19 +165,18 @@ static void parse_args(int argc, char **argv)
|
|
|
if (reading_input_filenames)
|
|
|
{
|
|
|
#ifdef STARPU_USE_FXT
|
|
|
- options.filenames[options.ninputfiles++] = argv[i];
|
|
|
+ options->fxt_options.filenames[options->fxt_options.ninputfiles++] = argv[i];
|
|
|
#endif
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (!symbol && !list)
|
|
|
+ if ((!options->symbol && !options->list) || (options->list_combs && !options->symbol))
|
|
|
{
|
|
|
fprintf(stderr, "Incorrect usage, aborting\n");
|
|
|
usage();
|
|
|
exit(-1);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
static void print_comma(FILE *gnuplot_file, int *first)
|
|
@@ -192,27 +191,22 @@ static void print_comma(FILE *gnuplot_file, int *first)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static void display_perf_model(FILE *gnuplot_file, struct starpu_perfmodel *model, struct starpu_perfmodel_arch* arch, int *first, unsigned nimpl)
|
|
|
+static void display_perf_model(FILE *gnuplot_file, struct starpu_perfmodel *model, struct starpu_perfmodel_arch* arch, struct starpu_perfmodel_per_arch *arch_model, int comb, int impl, int *first, struct _perfmodel_plot_options *options)
|
|
|
{
|
|
|
char arch_name[256];
|
|
|
- starpu_perfmodel_get_arch_name(arch, arch_name, 256, nimpl);
|
|
|
-
|
|
|
- struct starpu_perfmodel_per_arch *arch_model =
|
|
|
- &model->per_arch[arch->type][arch->devid][arch->ncore][nimpl];
|
|
|
|
|
|
- if (arch_model->regression.valid || arch_model->regression.nl_valid)
|
|
|
- fprintf(stderr,"Arch: %s\n", arch_name);
|
|
|
+ starpu_perfmodel_get_arch_name(arch, arch_name, 256, impl);
|
|
|
|
|
|
#ifdef STARPU_USE_FXT
|
|
|
- if (!gflops && !no_fxt_file && archtype_is_found[arch->type][arch->devid][arch->ncore] && nimpl == 0)
|
|
|
+ if (!options->gflops && options->with_fxt_file && impl == 0)
|
|
|
{
|
|
|
- print_comma(gnuplot_file, first);
|
|
|
- fprintf(gnuplot_file, "\"< grep -w \\^%d_%d_%d %s\" using 2:3 title \"Profiling %s\"", arch->type, arch->devid, arch->ncore, data_file_name, arch_name);
|
|
|
+// print_comma(gnuplot_file, first);
|
|
|
+// fprintf(gnuplot_file, "\"< grep -w \\^%d_%d_%d %s\" using 2:3 title \"Profiling %s\"", arch->type, arch->devid, arch->ncore, data_file_name, arch_name);
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
/* Only display the regression model if we could actually build a model */
|
|
|
- if (!gflops && arch_model->regression.valid && !arch_model->regression.nl_valid)
|
|
|
+ if (!options->gflops && arch_model->regression.valid && !arch_model->regression.nl_valid)
|
|
|
{
|
|
|
print_comma(gnuplot_file, first);
|
|
|
|
|
@@ -224,7 +218,7 @@ static void display_perf_model(FILE *gnuplot_file, struct starpu_perfmodel *mode
|
|
|
arch_model->regression.alpha, arch_model->regression.beta, arch_name);
|
|
|
}
|
|
|
|
|
|
- if (!gflops && arch_model->regression.nl_valid)
|
|
|
+ if (!options->gflops && arch_model->regression.nl_valid)
|
|
|
{
|
|
|
print_comma(gnuplot_file, first);
|
|
|
|
|
@@ -238,90 +232,36 @@ static void display_perf_model(FILE *gnuplot_file, struct starpu_perfmodel *mode
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static void display_history_based_perf_models(FILE *gnuplot_file, struct starpu_perfmodel *model, enum starpu_worker_archtype* type, int* devid, int* ncore, int *first)
|
|
|
+static void display_history_based_perf_models(FILE *gnuplot_file, struct starpu_perfmodel *model, int *first, struct _perfmodel_plot_options *options)
|
|
|
{
|
|
|
- char *command;
|
|
|
FILE *datafile;
|
|
|
struct starpu_perfmodel_history_list *ptr;
|
|
|
char arch_name[32];
|
|
|
int col;
|
|
|
- size_t len;
|
|
|
unsigned long last, minimum = 0;
|
|
|
|
|
|
- len = 10 + strlen(avg_file_name) + 1;
|
|
|
- command = (char *) malloc(len);
|
|
|
- datafile = fopen(avg_file_name, "w");
|
|
|
- free(command);
|
|
|
-
|
|
|
+ datafile = fopen(options->avg_file_name, "w");
|
|
|
col = 2;
|
|
|
- unsigned implid;
|
|
|
|
|
|
- unsigned archmin, archmax, devmin, devmax, coremin, coremax;
|
|
|
- if(type != NULL)
|
|
|
+ int comb;
|
|
|
+ for(comb = 0; comb < model->ncombs; comb++)
|
|
|
{
|
|
|
- archmin = *type;
|
|
|
- archmax = *type +1;
|
|
|
- if(devid != NULL)
|
|
|
+ if (options->comb_is_set == 0 || options->comb == model->combs[comb])
|
|
|
{
|
|
|
- devmin = *devid;
|
|
|
- devmax = *devid +1;
|
|
|
- if(ncore != NULL)
|
|
|
- {
|
|
|
- coremin = *ncore;
|
|
|
- coremax = *ncore +1;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- coremin = 0;
|
|
|
- coremax = 0;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- devmin = 0;
|
|
|
- devmax = 0;
|
|
|
- coremin = 0;
|
|
|
- coremax = 0;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- archmin = 0;
|
|
|
- archmax = STARPU_NARCH;
|
|
|
- devmin = 0;
|
|
|
- devmax = 0;
|
|
|
- coremin = 0;
|
|
|
- coremax = 0;
|
|
|
+ struct starpu_perfmodel_arch *arch;
|
|
|
+ int impl;
|
|
|
|
|
|
- }
|
|
|
- struct starpu_perfmodel_arch arch;
|
|
|
- unsigned archtype, dev, core;
|
|
|
- for (archtype = archmin; archtype < archmax; archtype++)
|
|
|
- {
|
|
|
- arch.type = archtype;
|
|
|
- if(model->per_arch[archtype]!=NULL)
|
|
|
- {
|
|
|
- for(dev = devmin; model->per_arch[archtype][dev] != NULL && (devmax == 0 || dev < devmax);dev++)
|
|
|
+ arch = _starpu_arch_comb_get(model->combs[comb]);
|
|
|
+ for(impl = 0; impl < model->nimpls[comb]; impl++)
|
|
|
{
|
|
|
- arch.devid = dev;
|
|
|
+ struct starpu_perfmodel_per_arch *arch_model = &model->per_arch[model->combs[comb]][impl];
|
|
|
+ starpu_perfmodel_get_arch_name(arch, arch_name, 32, impl);
|
|
|
|
|
|
- for(core = coremin; model->per_arch[archtype][dev][core] != NULL && (coremax == 0 || core < coremax); core++)
|
|
|
+ if (arch_model->list)
|
|
|
{
|
|
|
- arch.ncore = core;
|
|
|
- for (implid = 0; implid < STARPU_MAXIMPLEMENTATIONS; implid++)
|
|
|
- {
|
|
|
- struct starpu_perfmodel_per_arch *arch_model = &model->per_arch[archtype][dev][core][implid];
|
|
|
- starpu_perfmodel_get_arch_name(&arch, arch_name, 32, implid);
|
|
|
-
|
|
|
- //ptrs[arch-arch1][implid] = ptr[arch-arch1][implid] = arch_model->list;
|
|
|
-
|
|
|
- if (arch_model->list)
|
|
|
- {
|
|
|
- print_comma(gnuplot_file, first);
|
|
|
- fprintf(gnuplot_file, "\"%s\" using 1:%d:%d with errorlines title \"Average %s\"", avg_file_name, col, col+1, arch_name);
|
|
|
- col += 2;
|
|
|
- }
|
|
|
- }
|
|
|
+ print_comma(gnuplot_file, first);
|
|
|
+ fprintf(gnuplot_file, "\"%s\" using 1:%d:%d with errorlines title \"Average %s\"", options->avg_file_name, col, col+1, arch_name);
|
|
|
+ col += 2;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -334,25 +274,19 @@ static void display_history_based_perf_models(FILE *gnuplot_file, struct starpu_
|
|
|
|
|
|
minimum = ULONG_MAX;
|
|
|
/* Get the next minimum */
|
|
|
- for (archtype = archmin; archtype < archmax; archtype++)
|
|
|
+ for(comb = 0; comb < model->ncombs; comb++)
|
|
|
{
|
|
|
- if(model->per_arch[archtype]!=NULL)
|
|
|
+ if (options->comb_is_set == 0 || options->comb == model->combs[comb])
|
|
|
{
|
|
|
- for(dev = devmin; model->per_arch[archtype][dev] != NULL && (devmax == 0 || dev < devmax);dev++)
|
|
|
+ int impl;
|
|
|
+ for(impl = 0; impl < model->nimpls[comb]; impl++)
|
|
|
{
|
|
|
- for(core = coremin; model->per_arch[archtype][dev][core] != NULL && (coremax == 0 || core < coremax); core++)
|
|
|
-
|
|
|
+ struct starpu_perfmodel_per_arch *arch_model = &model->per_arch[model->combs[comb]][impl];
|
|
|
+ for (ptr = arch_model->list; ptr; ptr = ptr->next)
|
|
|
{
|
|
|
- for (implid = 0; implid < STARPU_MAXIMPLEMENTATIONS; implid++)
|
|
|
- {
|
|
|
- struct starpu_perfmodel_per_arch *arch_model = &model->per_arch[archtype][dev][core][implid];
|
|
|
- for (ptr = arch_model->list; ptr; ptr = ptr->next)
|
|
|
- {
|
|
|
- unsigned long size = ptr->entry->size;
|
|
|
- if (size > last && size < minimum)
|
|
|
- minimum = size;
|
|
|
- }
|
|
|
- }
|
|
|
+ unsigned long size = ptr->entry->size;
|
|
|
+ if (size > last && size < minimum)
|
|
|
+ minimum = size;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -362,160 +296,92 @@ static void display_history_based_perf_models(FILE *gnuplot_file, struct starpu_
|
|
|
|
|
|
fprintf(stderr, "%lu ", minimum);
|
|
|
fprintf(datafile, "%-15lu ", minimum);
|
|
|
- for (archtype = archmin; archtype < archmax; archtype++)
|
|
|
- if(model->per_arch[archtype]!=NULL)
|
|
|
- for(dev = devmin; model->per_arch[archtype][dev] != NULL && (devmax == 0 || dev < devmax);dev++)
|
|
|
- for(core = coremin; model->per_arch[archtype][dev][core] != NULL && (coremax == 0 || core < coremax); core++)
|
|
|
- for (implid = 0; implid < STARPU_MAXIMPLEMENTATIONS; implid++)
|
|
|
+ for(comb = 0; comb < model->ncombs; comb++)
|
|
|
+ {
|
|
|
+ if (options->comb_is_set == 0 || options->comb == model->combs[comb])
|
|
|
+ {
|
|
|
+ int impl;
|
|
|
+
|
|
|
+ for(impl = 0; impl < model->nimpls[comb]; impl++)
|
|
|
+ {
|
|
|
+ struct starpu_perfmodel_per_arch *arch_model = &model->per_arch[model->combs[comb]][impl];
|
|
|
+ for (ptr = arch_model->list; ptr; ptr = ptr->next)
|
|
|
+ {
|
|
|
+ struct starpu_perfmodel_history_entry *entry = ptr->entry;
|
|
|
+ if (entry->size == minimum)
|
|
|
{
|
|
|
- struct starpu_perfmodel_per_arch *arch_model = &model->per_arch[archtype][dev][core][implid];
|
|
|
- for (ptr = arch_model->list; ptr; ptr = ptr->next)
|
|
|
- {
|
|
|
- struct starpu_perfmodel_history_entry *entry = ptr->entry;
|
|
|
- if (entry->size == minimum)
|
|
|
- {
|
|
|
- if (gflops)
|
|
|
- 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);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (!ptr && arch_model->list)
|
|
|
- /* No value for this arch. */
|
|
|
- fprintf(datafile, "\t\"\"\t\"\"");
|
|
|
+ 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)
|
|
|
+ );
|
|
|
+ else
|
|
|
+ fprintf(datafile, "\t%-15le\t%-15le", 0.001*entry->mean, 0.001*entry->deviation);
|
|
|
+ break;
|
|
|
}
|
|
|
- fprintf(datafile, "\n");
|
|
|
+ }
|
|
|
+ if (!ptr && arch_model->list)
|
|
|
+ /* No value for this arch. */
|
|
|
+ fprintf(datafile, "\t\"\"\t\"\"");
|
|
|
+ }
|
|
|
+ fprintf(datafile, "\n");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
fprintf(stderr, "\n");
|
|
|
- fclose(datafile);
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-static void display_selected_arch_perf_models(FILE *gnuplot_file, struct starpu_perfmodel *model, struct starpu_perfmodel_arch* arch, int *first)
|
|
|
-{
|
|
|
- unsigned implid;
|
|
|
- for (implid = 0; implid < STARPU_MAXIMPLEMENTATIONS; implid++)
|
|
|
- display_perf_model(gnuplot_file, model, arch, first, implid);
|
|
|
-}
|
|
|
-
|
|
|
-static void display_selected_device_perf_models(FILE *gnuplot_file, struct starpu_perfmodel *model, enum starpu_worker_archtype archtype, int devid, int *first)
|
|
|
-{
|
|
|
- unsigned ncore;
|
|
|
- struct starpu_perfmodel_arch arch;
|
|
|
- arch.type = archtype;
|
|
|
- arch.devid = devid;
|
|
|
- for(ncore=0; model->per_arch[archtype][devid][ncore] != NULL; ncore++)
|
|
|
- {
|
|
|
- arch.ncore = ncore;
|
|
|
- display_selected_arch_perf_models(gnuplot_file,model,&arch,first);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-static void display_selected_archtype_perf_models(FILE *gnuplot_file, struct starpu_perfmodel *model, enum starpu_worker_archtype archtype, int *first)
|
|
|
-{
|
|
|
- unsigned devid;
|
|
|
- for(devid=0; model->per_arch[archtype][devid] != NULL; devid++)
|
|
|
- display_selected_device_perf_models(gnuplot_file,model,archtype,devid,first);
|
|
|
-}
|
|
|
-
|
|
|
-static void display_all_perf_models(FILE *gnuplot_file, struct starpu_perfmodel *model, int *first)
|
|
|
-{
|
|
|
- unsigned archtype;
|
|
|
- for(archtype = 0; archtype < STARPU_NARCH; archtype++)
|
|
|
- display_selected_archtype_perf_models(gnuplot_file,model,archtype,first);
|
|
|
-}
|
|
|
-
|
|
|
-#ifdef STARPU_USE_FXT
|
|
|
-static int ** init_archtype_is_found_per_arch(int maxdevid, unsigned* maxncore_table)
|
|
|
-{
|
|
|
- int devid, ncore;
|
|
|
- int ** archtype_is_found_per_arch = malloc(sizeof(*archtype_is_found_per_arch)*(maxdevid+1));
|
|
|
- archtype_is_found_per_arch[maxdevid] = NULL;
|
|
|
- for(devid=0; devid<maxdevid; devid++)
|
|
|
- {
|
|
|
- int maxncore;
|
|
|
- if(maxncore_table != NULL)
|
|
|
- maxncore = maxncore_table[devid];
|
|
|
- else
|
|
|
- maxncore = 1;
|
|
|
-
|
|
|
- archtype_is_found_per_arch[devid] = malloc(sizeof(*archtype_is_found_per_arch[devid])*(maxncore+1));
|
|
|
- archtype_is_found_per_arch[devid][maxncore] = 0;
|
|
|
- for(ncore=0; ncore<maxncore; ncore++)
|
|
|
- archtype_is_found_per_arch[devid][ncore] = 0;
|
|
|
- }
|
|
|
- return archtype_is_found_per_arch;
|
|
|
|
|
|
+ fclose(datafile);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-static void init_archtype_is_found(struct starpu_perfmodel *model)
|
|
|
+static void display_all_perf_models(FILE *gnuplot_file, struct starpu_perfmodel *model, int *first, struct _perfmodel_plot_options *options)
|
|
|
{
|
|
|
- unsigned archtype, devid, ndevice, ncore, *maxncore;
|
|
|
-
|
|
|
- for(archtype = 0; archtype < STARPU_NARCH; archtype++)
|
|
|
+ int comb;
|
|
|
+ for(comb = 0; comb < model->ncombs; comb++)
|
|
|
{
|
|
|
-
|
|
|
- for(devid=0; model->per_arch[archtype][devid] != NULL; devid++)
|
|
|
- ;
|
|
|
- ndevice = devid;
|
|
|
- if(ndevice != 0)
|
|
|
+ if (options->comb_is_set == 0 || options->comb == model->combs[comb])
|
|
|
{
|
|
|
- maxncore = malloc(sizeof(*maxncore)*ndevice);
|
|
|
- for(devid=0; devid < ndevice; devid++)
|
|
|
+ struct starpu_perfmodel_arch *arch;
|
|
|
+ int impl;
|
|
|
+
|
|
|
+ arch = _starpu_arch_comb_get(model->combs[comb]);
|
|
|
+ for(impl = 0; impl < model->nimpls[model->combs[comb]]; impl++)
|
|
|
{
|
|
|
- for(ncore=0; model->per_arch[archtype][devid][ncore] != NULL; ncore++)
|
|
|
- ;
|
|
|
- maxncore[devid] = ncore;
|
|
|
+ struct starpu_perfmodel_per_arch *archmodel = &model->per_arch[model->combs[comb]][impl];
|
|
|
+ display_perf_model(gnuplot_file, model, arch, archmodel, comb, impl, first, options);
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- maxncore = NULL;
|
|
|
- }
|
|
|
-
|
|
|
- archtype_is_found[archtype] = init_archtype_is_found_per_arch(ndevice,maxncore);
|
|
|
- if(maxncore != NULL)
|
|
|
- free(maxncore);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-static void dump_data_file(FILE *data_file, struct starpu_perfmodel *model)
|
|
|
+#ifdef STARPU_USE_FXT
|
|
|
+static void dump_data_file(FILE *data_file, struct starpu_perfmodel *model, struct _perfmodel_plot_options *options)
|
|
|
{
|
|
|
- init_archtype_is_found(model);
|
|
|
-
|
|
|
int i;
|
|
|
- for (i = 0; i < options.dumped_codelets_count; i++)
|
|
|
+ for (i = 0; i < options->fxt_options.dumped_codelets_count; i++)
|
|
|
{
|
|
|
/* Dump only if the symbol matches user's request */
|
|
|
- if (strncmp(dumped_codelets[i].symbol, symbol, (FXT_MAX_PARAMS - 4)*sizeof(unsigned long)-1) == 0)
|
|
|
+ if (strncmp(options->dumped_codelets[i].symbol, options->symbol, (FXT_MAX_PARAMS - 4)*sizeof(unsigned long)-1) == 0)
|
|
|
{
|
|
|
- struct starpu_perfmodel_arch* arch = &dumped_codelets[i].arch;
|
|
|
- archtype_is_found[arch->type][arch->devid][arch->ncore] = 1;
|
|
|
+ struct starpu_perfmodel_arch* arch = &options->dumped_codelets[i].arch;
|
|
|
|
|
|
- size_t size = dumped_codelets[i].size;
|
|
|
- float time = dumped_codelets[i].time;
|
|
|
+ size_t size = options->dumped_codelets[i].size;
|
|
|
+ float time = options->dumped_codelets[i].time;
|
|
|
|
|
|
- fprintf(data_file, "%d_%d_%d %f %f\n", arch->type, arch->devid, arch->ncore, (float)size, time);
|
|
|
+// fprintf(data_file, "%d_%d_%d %f %f\n", arch->type, arch->devid, arch->ncore, (float)size, time);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
-static void display_selected_models(FILE *gnuplot_file, struct starpu_perfmodel *model)
|
|
|
+static void display_selected_models(FILE *gnuplot_file, struct starpu_perfmodel *model, struct _perfmodel_plot_options *options)
|
|
|
{
|
|
|
fprintf(gnuplot_file, "#!/usr/bin/gnuplot -persist\n");
|
|
|
fprintf(gnuplot_file, "\n");
|
|
|
fprintf(gnuplot_file, "set term postscript eps enhanced color\n");
|
|
|
- fprintf(gnuplot_file, "set output \"starpu_%s.eps\"\n", symbol);
|
|
|
- fprintf(gnuplot_file, "set title \"Model for codelet %s\"\n", symbol);
|
|
|
+ fprintf(gnuplot_file, "set output \"starpu_%s.eps\"\n", options->symbol);
|
|
|
+ fprintf(gnuplot_file, "set title \"Model for codelet %s\"\n", options->symbol);
|
|
|
fprintf(gnuplot_file, "set xlabel \"Total data size\"\n");
|
|
|
- if (gflops)
|
|
|
+ if (options->gflops)
|
|
|
fprintf(gnuplot_file, "set ylabel \"GFlops\"\n");
|
|
|
else
|
|
|
fprintf(gnuplot_file, "set ylabel \"Time (ms)\"\n");
|
|
@@ -527,134 +393,32 @@ static void display_selected_models(FILE *gnuplot_file, struct starpu_perfmodel
|
|
|
|
|
|
/* If no input data is given to gnuplot, we at least need to specify an
|
|
|
* arbitrary range. */
|
|
|
- if (no_fxt_file)
|
|
|
+ if (options->with_fxt_file == 0)
|
|
|
fprintf(gnuplot_file, "set xrange [1:10**9]\n\n");
|
|
|
|
|
|
int first = 1;
|
|
|
fprintf(gnuplot_file, "plot\t");
|
|
|
|
|
|
- struct starpu_perfmodel_arch arch;
|
|
|
- struct _starpu_machine_config *conf = _starpu_get_machine_config();
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if (archname == NULL)
|
|
|
- {
|
|
|
- /* display all architectures */
|
|
|
- display_all_perf_models(gnuplot_file, model, &first);
|
|
|
- display_history_based_perf_models(gnuplot_file, model, NULL, NULL, NULL, &first);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (strcmp(archname, "cpu") == 0)
|
|
|
- {
|
|
|
-
|
|
|
- arch.type = STARPU_CPU_WORKER;
|
|
|
- arch.devid = 1;
|
|
|
- arch.ncore = 0;
|
|
|
-
|
|
|
- display_selected_arch_perf_models(gnuplot_file, model, &arch, &first);
|
|
|
- display_history_based_perf_models(gnuplot_file, model, &arch.type, &arch.devid, &arch.ncore, &first);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- unsigned k;
|
|
|
- if (sscanf(archname, "cpu:%u", &k) == 1)
|
|
|
- {
|
|
|
- /* For combined CPU workers */
|
|
|
- if ((k < 1) || (k > conf->topology.ncpus))
|
|
|
- {
|
|
|
- fprintf(stderr, "Invalid CPU size\n");
|
|
|
- exit(-1);
|
|
|
- }
|
|
|
-
|
|
|
- arch.type = STARPU_CPU_WORKER;
|
|
|
- arch.devid = 1;
|
|
|
- arch.ncore = k - 1;
|
|
|
-
|
|
|
- display_selected_arch_perf_models(gnuplot_file, model, &arch, &first);
|
|
|
- display_history_based_perf_models(gnuplot_file, model, &arch.type, &arch.devid, &arch.ncore, &first);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (strcmp(archname, "cuda") == 0)
|
|
|
- {
|
|
|
- unsigned archtype = STARPU_CUDA_WORKER;
|
|
|
- display_selected_archtype_perf_models(gnuplot_file, model, archtype, &first);
|
|
|
- display_history_based_perf_models(gnuplot_file, model, &archtype, NULL, NULL, &first);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- /* There must be a cleaner way ! */
|
|
|
- unsigned gpuid;
|
|
|
- int nmatched;
|
|
|
- nmatched = sscanf(archname, "cuda_%u", &gpuid);
|
|
|
- if (nmatched == 1)
|
|
|
- {
|
|
|
- if (gpuid < conf->topology.ncudagpus)
|
|
|
- {
|
|
|
- arch.type = STARPU_CUDA_WORKER;
|
|
|
- arch.devid = gpuid;
|
|
|
- arch.ncore = 0;
|
|
|
-
|
|
|
- display_selected_arch_perf_models(gnuplot_file, model, &arch, &first);
|
|
|
- display_history_based_perf_models(gnuplot_file, model, &arch.type, &arch.devid, &arch.ncore, &first);
|
|
|
- return;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- fprintf(stderr, "Invalid CUDA device %d (last valid one is %d)\n", gpuid, STARPU_MAXCUDADEVS-1);
|
|
|
- exit(-1);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (strcmp(archname, "opencl") == 0)
|
|
|
- {
|
|
|
- unsigned archtype = STARPU_OPENCL_WORKER;
|
|
|
- display_selected_archtype_perf_models(gnuplot_file, model, archtype, &first);
|
|
|
- display_history_based_perf_models(gnuplot_file, model, &archtype, NULL, NULL, &first);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- /* There must be a cleaner way ! */
|
|
|
- nmatched = sscanf(archname, "opencl_%u", &gpuid);
|
|
|
- if (nmatched == 1)
|
|
|
- {
|
|
|
- if (gpuid < conf->topology.nopenclgpus)
|
|
|
- {
|
|
|
- arch.type = STARPU_OPENCL_WORKER;
|
|
|
- arch.devid = gpuid;
|
|
|
- arch.ncore = 0;
|
|
|
-
|
|
|
- display_selected_arch_perf_models(gnuplot_file, model, &arch, &first);
|
|
|
- display_history_based_perf_models(gnuplot_file, model, &arch.type, &arch.devid, &arch.ncore, &first);
|
|
|
- return;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- fprintf(stderr, "Invalid OpenCL device %d (last valid one is %d)\n", gpuid, STARPU_MAXOPENCLDEVS-1);
|
|
|
- exit(-1);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- fprintf(stderr, "Unknown architecture requested, aborting.\n");
|
|
|
- exit(-1);
|
|
|
- }
|
|
|
+ /* display all or selected combinations */
|
|
|
+ display_all_perf_models(gnuplot_file, model, &first, options);
|
|
|
+ display_history_based_perf_models(gnuplot_file, model, &first, options);
|
|
|
}
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
{
|
|
|
- int ret;
|
|
|
+ int ret = 0;
|
|
|
struct starpu_perfmodel model = {};
|
|
|
+ char gnuplot_file_name[256];
|
|
|
+ struct _perfmodel_plot_options options;
|
|
|
|
|
|
#ifdef __MINGW32__
|
|
|
WSADATA wsadata;
|
|
|
WSAStartup(MAKEWORD(1,0), &wsadata);
|
|
|
#endif
|
|
|
|
|
|
- parse_args(argc, argv);
|
|
|
+ parse_args(argc, argv, &options);
|
|
|
|
|
|
- if (list)
|
|
|
+ if (options.list)
|
|
|
{
|
|
|
ret = starpu_perfmodel_list(stdout);
|
|
|
if (ret)
|
|
@@ -666,35 +430,47 @@ int main(int argc, char **argv)
|
|
|
}
|
|
|
|
|
|
/* Load the performance model associated to the symbol */
|
|
|
- ret = starpu_perfmodel_load_symbol(symbol, &model);
|
|
|
+ ret = starpu_perfmodel_load_symbol(options.symbol, &model);
|
|
|
if (ret == 1)
|
|
|
{
|
|
|
- fprintf(stderr, "The performance model for the symbol <%s> could not be loaded\n", symbol);
|
|
|
+ fprintf(stderr, "The performance model for the symbol <%s> could not be loaded\n", options.symbol);
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
+ if (options.list_combs)
|
|
|
+ {
|
|
|
+ ret = starpu_perfmodel_list_combs(stdout, &model);
|
|
|
+ if (ret)
|
|
|
+ {
|
|
|
+ fprintf(stderr, "Error when listing combinations for model <%s>\n", options.symbol);
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/* If some FxT input was specified, we put the points on the graph */
|
|
|
#ifdef STARPU_USE_FXT
|
|
|
- if (!no_fxt_file)
|
|
|
+ if (options.with_fxt_file)
|
|
|
{
|
|
|
- starpu_fxt_generate_trace(&options);
|
|
|
+ starpu_fxt_generate_trace(&options.fxt_options);
|
|
|
|
|
|
- snprintf(data_file_name, 256, "starpu_%s.data", symbol);
|
|
|
+ snprintf(options.data_file_name, 256, "starpu_%s.data", options.symbol);
|
|
|
|
|
|
- FILE *data_file = fopen(data_file_name, "w+");
|
|
|
+ FILE *data_file = fopen(options.data_file_name, "w+");
|
|
|
STARPU_ASSERT(data_file);
|
|
|
- dump_data_file(data_file, &model);
|
|
|
+ dump_data_file(data_file, &model, &options);
|
|
|
fclose(data_file);
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
- snprintf(gnuplot_file_name, 256, "starpu_%s.gp", symbol);
|
|
|
-
|
|
|
- snprintf(avg_file_name, 256, "starpu_%s_avg.data", symbol);
|
|
|
+ snprintf(gnuplot_file_name, 256, "starpu_%s.gp", options.symbol);
|
|
|
+ snprintf(options.avg_file_name, 256, "starpu_%s_avg.data", options.symbol);
|
|
|
|
|
|
FILE *gnuplot_file = fopen(gnuplot_file_name, "w+");
|
|
|
STARPU_ASSERT(gnuplot_file);
|
|
|
- display_selected_models(gnuplot_file, &model);
|
|
|
+ display_selected_models(gnuplot_file, &model, &options);
|
|
|
+ fprintf(gnuplot_file,"\n");
|
|
|
fclose(gnuplot_file);
|
|
|
|
|
|
/* Retrieve the current mode of the gnuplot executable */
|
|
@@ -718,4 +494,3 @@ int main(int argc, char **argv)
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
-#endif
|