Explorar el Código

New starpu_fxt_tool option -label-deps to label dependencies on the output graph

Nathalie Furmento hace 7 años
padre
commit
ae5cc87de0

+ 2 - 0
ChangeLog

@@ -76,6 +76,8 @@ Small features:
   * Add dependency backward information in debugging mode for gdb's
     starpu-print-task
   * Add sched_data field in starpu_task structure.
+  * New starpu_fxt_tool option -label-deps to label dependencies on
+    the output graph
 
 Changes:
   * Vastly improve simgrid simulation time.

+ 2 - 1
include/starpu_fxt.h

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2012-2013,2016                           Inria
  * Copyright (C) 2013                                     Joris Pablo
- * Copyright (C) 2010-2015,2017                           CNRS
+ * Copyright (C) 2010-2015,2017,2018                      CNRS
  * Copyright (C) 2010-2011,2013-2018                      Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -50,6 +50,7 @@ struct starpu_fxt_options
 	unsigned no_smooth;
 	unsigned no_acquire;
 	unsigned internal;
+	unsigned label_deps;
 	char *filenames[STARPU_FXT_MAX_FILES];
 	char *out_paje_path;
 	char *distrib_time_path;

+ 3 - 3
src/common/fxt.h

@@ -3,7 +3,7 @@
  * Copyright (C) 2012-2017                                Inria
  * Copyright (C) 2008-2018                                Université de Bordeaux
  * Copyright (C) 2013                                     Joris Pablo
- * Copyright (C) 2010-2017                                CNRS
+ * Copyright (C) 2010-2018                                CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -679,10 +679,10 @@ do {									\
 	FUT_DO_PROBE2(_STARPU_FUT_TAG_DEPS, tag_child, tag_father)
 
 #define _STARPU_TRACE_TASK_DEPS(job_prev, job_succ)	\
-	FUT_DO_PROBE3(_STARPU_FUT_TASK_DEPS, (job_prev)->job_id, (job_succ)->job_id, (job_succ)->task->type)
+	_STARPU_FUT_DO_PROBE4STR(_STARPU_FUT_TASK_DEPS, (job_prev)->job_id, (job_succ)->job_id, (job_succ)->task->type, 1, "task")
 
 #define _STARPU_TRACE_GHOST_TASK_DEPS(ghost_prev_id, job_succ)		\
-	FUT_DO_PROBE3(_STARPU_FUT_TASK_DEPS, (ghost_prev_id), (job_succ)->job_id, (job_succ)->task->type)
+	_STARPU_FUT_DO_PROBE4STR(_STARPU_FUT_TASK_DEPS, (ghost_prev_id), (job_succ)->job_id, (job_succ)->task->type, 1, "ghost")
 
 #define _STARPU_TRACE_TASK_NAME(job)						\
 do {										\

+ 14 - 4
src/debug/traces/starpu_fxt.c

@@ -2557,7 +2557,10 @@ static void handle_tag(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
 	tag = ev->param[0];
 	job = ev->param[1];
 
-	_starpu_fxt_dag_add_tag(options->file_prefix, tag, job);
+	if (options->label_deps)
+		_starpu_fxt_dag_add_tag(options->file_prefix, tag, job, "tag");
+	else
+		_starpu_fxt_dag_add_tag(options->file_prefix, tag, job, NULL);
 }
 
 static void handle_tag_deps(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
@@ -2568,7 +2571,10 @@ static void handle_tag_deps(struct fxt_ev_64 *ev, struct starpu_fxt_options *opt
 	child = ev->param[0];
 	father = ev->param[1];
 
-	_starpu_fxt_dag_add_tag_deps(options->file_prefix, child, father);
+	if (options->label_deps)
+		_starpu_fxt_dag_add_tag_deps(options->file_prefix, child, father, "tag");
+	else
+		_starpu_fxt_dag_add_tag_deps(options->file_prefix, child, father, NULL);
 }
 
 static void handle_task_deps(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
@@ -2576,6 +2582,7 @@ static void handle_task_deps(struct fxt_ev_64 *ev, struct starpu_fxt_options *op
 	unsigned long dep_prev = ev->param[0];
 	unsigned long dep_succ = ev->param[1];
 	unsigned dep_succ_type = ev->param[2];
+	char *name = get_fxt_string(ev,4);
 
 	struct task_info *task = get_task(dep_succ, options->file_rank);
 	struct task_info *prev_task = get_task(dep_prev, options->file_rank);
@@ -2602,10 +2609,12 @@ static void handle_task_deps(struct fxt_ev_64 *ev, struct starpu_fxt_options *op
 	task->dependencies[task->ndeps++] = dep_prev;
 
 	/* There is a dependency between both job id : dep_prev -> dep_succ */
-	if (show_task(task, options)) {
+	if (show_task(task, options))
+	{
+		if (!options->label_deps) name = NULL;
 		/* We should show the name of the predecessor, then. */
 		prev_task->show = 1;
-		_starpu_fxt_dag_add_task_deps(options->file_prefix, dep_prev, dep_succ);
+		_starpu_fxt_dag_add_task_deps(options->file_prefix, dep_prev, dep_succ, name);
 	}
 }
 
@@ -3870,6 +3879,7 @@ void starpu_fxt_options_init(struct starpu_fxt_options *options)
 	options->no_smooth = 0;
 	options->no_acquire = 0;
 	options->internal = 0;
+	options->label_deps = 0;
 	options->ninputfiles = 0;
 	options->out_paje_path = "paje.trace";
 	options->dag_path = "dag.dot";

+ 4 - 4
src/debug/traces/starpu_fxt.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2011-2012                                Inria
- * Copyright (C) 2012,2017                                CNRS
+ * Copyright (C) 2012,2017,2018                           CNRS
  * Copyright (C) 2009-2012,2014-2017                      Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -44,10 +44,10 @@ extern char _starpu_last_codelet_symbol[STARPU_NMAXWORKERS][(FXT_MAX_PARAMS-5)*s
 
 void _starpu_fxt_dag_init(char *dag_filename);
 void _starpu_fxt_dag_terminate(void);
-void _starpu_fxt_dag_add_tag(const char *prefix, uint64_t tag, unsigned long job_id);
-void _starpu_fxt_dag_add_tag_deps(const char *prefix, uint64_t child, uint64_t father);
+void _starpu_fxt_dag_add_tag(const char *prefix, uint64_t tag, unsigned long job_id, const char *label);
+void _starpu_fxt_dag_add_tag_deps(const char *prefix, uint64_t child, uint64_t father, const char *label);
 void _starpu_fxt_dag_set_tag_done(const char *prefix, uint64_t tag, const char *color);
-void _starpu_fxt_dag_add_task_deps(const char *prefix, unsigned long dep_prev, unsigned long dep_succ);
+void _starpu_fxt_dag_add_task_deps(const char *prefix, unsigned long dep_prev, unsigned long dep_succ, const char *label);
 void _starpu_fxt_dag_set_task_name(const char *prefix, unsigned long job_id, const char *label, const char *color);
 void _starpu_fxt_dag_add_send(int src, unsigned long dep_prev, unsigned long tag, unsigned long id);
 void _starpu_fxt_dag_add_receive(int dst, unsigned long dep_prev, unsigned long tag, unsigned long id);

+ 22 - 9
src/debug/traces/starpu_fxt_dag.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2011-2012                                Inria
- * Copyright (C) 2012,2015,2017                           CNRS
+ * Copyright (C) 2012,2015,2017,2018                      CNRS
  * Copyright (C) 2010-2015,2017                           Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -66,24 +66,37 @@ void _starpu_fxt_dag_terminate(void)
 	fclose(out_file);
 }
 
-void _starpu_fxt_dag_add_tag(const char *prefix, uint64_t tag, unsigned long job_id)
+void _starpu_fxt_dag_add_tag(const char *prefix, uint64_t tag, unsigned long job_id, const char *label)
 {
 	if (out_file)
-		fprintf(out_file, "\t \"tag_%s%llx\"->\"task_%s%lu\"->\"tag_%s%llx\" [style=dashed]\n",
-			prefix, (unsigned long long)tag, prefix, (unsigned long)job_id, prefix, (unsigned long long) tag);
+	{
+		if (label)
+			fprintf(out_file, "\t \"tag_%s%llx\"->\"task_%s%lu\"->\"tag_%s%llx\" [style=dashed] [label=\"%s\"]\n", prefix, (unsigned long long)tag, prefix, (unsigned long)job_id, prefix, (unsigned long long) tag, label);
+		else
+			fprintf(out_file, "\t \"tag_%s%llx\"->\"task_%s%lu\"->\"tag_%s%llx\" [style=dashed]\n", prefix, (unsigned long long)tag, prefix, (unsigned long)job_id, prefix, (unsigned long long) tag);
+	}
 }
 
-void _starpu_fxt_dag_add_tag_deps(const char *prefix, uint64_t child, uint64_t father)
+void _starpu_fxt_dag_add_tag_deps(const char *prefix, uint64_t child, uint64_t father, const char *label)
 {
 	if (out_file)
-		fprintf(out_file, "\t \"tag_%s%llx\"->\"tag_%s%llx\"\n",
-			prefix, (unsigned long long)father, prefix, (unsigned long long)child);
+	{
+		if (label)
+			fprintf(out_file, "\t \"tag_%s%llx\"->\"tag_%s%llx\" [label=\"%s\"]\n", prefix, (unsigned long long)father, prefix, (unsigned long long)child, label);
+		else
+			fprintf(out_file, "\t \"tag_%s%llx\"->\"tag_%s%llx\"\n", prefix, (unsigned long long)father, prefix, (unsigned long long)child);
+	}
 }
 
-void _starpu_fxt_dag_add_task_deps(const char *prefix, unsigned long dep_prev, unsigned long dep_succ)
+void _starpu_fxt_dag_add_task_deps(const char *prefix, unsigned long dep_prev, unsigned long dep_succ, const char *label)
 {
 	if (out_file)
-		fprintf(out_file, "\t \"task_%s%lu\"->\"task_%s%lu\"\n", prefix, dep_prev, prefix, dep_succ);
+	{
+		if (label)
+			fprintf(out_file, "\t \"task_%s%lu\"->\"task_%s%lu\" [label=\"%s\"]\n", prefix, dep_prev, prefix, dep_succ, label);
+		else
+			fprintf(out_file, "\t \"task_%s%lu\"->\"task_%s%lu\"\n", prefix, dep_prev, prefix, dep_succ);
+	}
 }
 
 void _starpu_fxt_dag_set_tag_done(const char *prefix, uint64_t tag, const char *color)

+ 10 - 2
tools/starpu_fxt_tool.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2008-2014,2016-2018                      Université de Bordeaux
- * Copyright (C) 2010-2015,2017                           CNRS
+ * Copyright (C) 2010-2015,2017,2018                      CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -16,7 +16,7 @@
  */
 
 /*
- * This program should be used to parse the log generated by FxT 
+ * This program should be used to parse the log generated by FxT
  */
 
 #include <starpu.h>
@@ -41,6 +41,7 @@ static void usage()
 	fprintf(stderr, "   -no-flops           do not show flops\n");
 	fprintf(stderr, "   -no-smooth          avoid smoothing values for gflops etc.\n");
 	fprintf(stderr, "   -no-acquire         do not show application data acquisitions tasks in DAG\n");
+	fprintf(stderr, "   -label-deps         add label on dependencies.\n");
 	fprintf(stderr, "   -internal           show StarPU-internal tasks in DAG\n");
 	fprintf(stderr, "   -h, --help          display this help and exit\n");
 	fprintf(stderr, "   -v, --version       output version information and exit\n\n");
@@ -131,6 +132,13 @@ static int parse_args(int argc, char **argv)
 			continue;
 		}
 
+		if (strcmp(argv[i], "-label-deps") == 0)
+		{
+			options.label_deps = 1;
+			reading_input_filenames = 0;
+			continue;
+		}
+
 		if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
 		{
 			usage();