Browse Source

perfmodel: new functionality to print directory name storing performance models

 - public function starpu_perfmodel_directory(FILE *)
 - option -d for tool starpu_perfmodel_display
Nathalie Furmento 11 years ago
parent
commit
219507e0e0

+ 3 - 0
ChangeLog

@@ -49,6 +49,9 @@ Small features:
     to enable or disable sequential consistency
   * New configure option --enable-fxt-lock which enables additional
     trace events focused on locks behaviour during the execution
+  * New function starpu_perfmodel_directory() to print directory
+    storing performance models. Available through the new option -d of
+    the tool starpu_perfmodel_display
 
 Changes:
   * Fix of the livelock issue discovered while executing applications

+ 4 - 0
doc/doxygen/chapters/api/performance_model.doxy

@@ -235,6 +235,10 @@ returns the architecture type of a given worker.
 \ingroup API_Performance_Model
 prints a list of all performance models on \p output
 
+\fn int starpu_perfmodel_directory(FILE *output)
+\ingroup API_Performance_Model
+prints the directory name storing performance models on \p output
+
 \fn void starpu_perfmodel_print(struct starpu_perfmodel *model, enum starpu_perfmodel_archtype arch, unsigned nimpl, char *parameter, uint32_t *footprint, FILE *output)
 \ingroup API_Performance_Model
 todo

+ 2 - 0
include/starpu_perfmodel.h

@@ -164,6 +164,8 @@ int starpu_perfmodel_list(FILE *output);
 void starpu_perfmodel_print(struct starpu_perfmodel *model, enum starpu_perfmodel_archtype arch, unsigned nimpl, char *parameter, uint32_t *footprint, FILE *output);
 int starpu_perfmodel_print_all(struct starpu_perfmodel *model, char *arch, char *parameter, uint32_t *footprint, FILE *output);
 
+void starpu_perfmodel_directory(FILE *output);
+
 void starpu_perfmodel_update_history(struct starpu_perfmodel *model, struct starpu_task *task, enum starpu_perfmodel_archtype arch, unsigned cpuid, unsigned nimpl, double measured);
 
 void starpu_bus_print_bandwidth(FILE *f);

+ 7 - 0
src/core/perfmodel/perfmodel_history.c

@@ -939,6 +939,13 @@ void _starpu_load_history_based_model(struct starpu_perfmodel *model, unsigned s
 	STARPU_PTHREAD_RWLOCK_UNLOCK(&registered_models_rwlock);
 }
 
+void starpu_perfmodel_directory(FILE *output)
+{
+	char perf_model_dir[256];
+	_starpu_get_perf_model_dir(perf_model_dir, 256);
+	fprintf(output, "directory: <%s>\n", perf_model_dir);
+}
+
 /* This function is intended to be used by external tools that should read
  * the performance model files */
 int starpu_perfmodel_list(FILE *output)

+ 16 - 3
tools/starpu_perfmodel_display.c

@@ -32,6 +32,8 @@
 
 /* display all available models */
 static int plist = 0;
+/* display directory */
+static int pdirectory = 0;
 /* what kernel ? */
 static char *psymbol = NULL;
 /* what parameter should be displayed ? (NULL = all) */
@@ -54,6 +56,7 @@ static void usage()
         fprintf(stderr, "   -p <parameter>      specify the parameter (e.g. a, b, c, mean, stddev)\n");
         fprintf(stderr, "   -a <arch>           specify the architecture (e.g. cpu, cpu:k, cuda)\n");
 	fprintf(stderr, "   -f <footprint>      display the history-based model for the specified footprint\n");
+	fprintf(stderr, "   -d                  display the directory storing performance models\n");
 	fprintf(stderr, "   -h, --help          display this help and exit\n");
 	fprintf(stderr, "   -v, --version       output version information and exit\n\n");
         fprintf(stderr, "Reports bugs to <"PACKAGE_BUGREPORT">.");
@@ -71,6 +74,7 @@ static void parse_args(int argc, char **argv)
 		{"help",      no_argument,       NULL, 'h'},
 		/* XXX Would be cleaner to set a flag */
 		{"list",      no_argument,       NULL, 'l'},
+		{"dir",       no_argument,       NULL, 'd'},
 		{"parameter", required_argument, NULL, 'p'},
 		{"symbol",    required_argument, NULL, 's'},
 		{"version",   no_argument,       NULL, 'v'},
@@ -78,7 +82,7 @@ static void parse_args(int argc, char **argv)
 	};
 
 	int option_index;
-	while ((c = getopt_long(argc, argv, "ls:p:a:f:h", long_options, &option_index)) != -1)
+	while ((c = getopt_long(argc, argv, "dls:p:a:f:h", long_options, &option_index)) != -1)
 	{
 		switch (c)
 		{
@@ -108,6 +112,11 @@ static void parse_args(int argc, char **argv)
 			sscanf(optarg, "%08x", &pspecific_footprint);
 			break;
 
+		case 'd':
+			/* directory */
+			pdirectory = 1;
+			break;
+
 		case 'h':
 			usage();
 			exit(EXIT_SUCCESS);
@@ -122,7 +131,7 @@ static void parse_args(int argc, char **argv)
 		}
 	}
 
-	if (!psymbol && !plist)
+	if (!psymbol && !plist && !pdirectory)
 	{
 		fprintf(stderr, "Incorrect usage, aborting\n");
                 usage();
@@ -143,7 +152,11 @@ int main(int argc, char **argv)
 	{
                 starpu_perfmodel_list(stdout);
         }
-        else
+        else if (pdirectory)
+	{
+		starpu_perfmodel_directory(stdout);
+	}
+	else
 	{
 		struct starpu_perfmodel model;
                 int ret = starpu_perfmodel_load_symbol(psymbol, &model);