Browse Source

Add -no-flops option to starpu_fxt_tool to reduce trace size

Samuel Thibault 8 years ago
parent
commit
65b7113191

+ 4 - 0
doc/doxygen/chapters/380_offline_performance_tools.doxy

@@ -135,6 +135,10 @@ $ starpu_fxt_tool -i /tmp/prof_file_something1 -i /tmp/prof_file_something2
 By default, all tasks are displayed using a green color. To display tasks with
 By default, all tasks are displayed using a green color. To display tasks with
 varying colors, pass option <c>-c</c> to <c>starpu_fxt_tool</c>.
 varying colors, pass option <c>-c</c> to <c>starpu_fxt_tool</c>.
 
 
+By default, the trace contains all informations. To reduce the trace size,
+various <c>-no-foo</c> options can be passed to <c>starpu_fxt_tool</c>, see
+<c>starpu_fxt_tool --help</c> .
+
 To identify tasks precisely, the application can set the starpu_task::tag_id field of the
 To identify tasks precisely, the application can set the starpu_task::tag_id field of the
 task (or use \ref STARPU_TAG_ONLY when using starpu_task_insert()), and
 task (or use \ref STARPU_TAG_ONLY when using starpu_task_insert()), and
 the value of the tag will show up in the trace.
 the value of the tag will show up in the trace.

+ 1 - 0
include/starpu_fxt.h

@@ -42,6 +42,7 @@ struct starpu_fxt_options
 	unsigned per_task_colour;
 	unsigned per_task_colour;
 	unsigned no_counter;
 	unsigned no_counter;
 	unsigned no_bus;
 	unsigned no_bus;
+	unsigned no_flops;
 	unsigned ninputfiles;
 	unsigned ninputfiles;
 	unsigned no_smooth;
 	unsigned no_smooth;
 	char *filenames[STARPU_FXT_MAX_FILES];
 	char *filenames[STARPU_FXT_MAX_FILES];

+ 50 - 26
src/debug/traces/starpu_fxt.c

@@ -1085,15 +1085,17 @@ static void handle_worker_init_start(struct fxt_ev_64 *ev, struct starpu_fxt_opt
 		if (new_thread)
 		if (new_thread)
 			poti_CreateContainer(get_event_time_stamp(ev, options), new_thread_container_alias, "T", memnode_container, new_thread_container_name);
 			poti_CreateContainer(get_event_time_stamp(ev, options), new_thread_container_alias, "T", memnode_container, new_thread_container_name);
 		poti_CreateContainer(get_event_time_stamp(ev, options), new_worker_container_alias, "W", new_thread_container_alias, new_worker_container_name);
 		poti_CreateContainer(get_event_time_stamp(ev, options), new_worker_container_alias, "W", new_thread_container_alias, new_worker_container_name);
-		poti_SetVariable(0.0, new_worker_container_alias, "gf", 0.0);
+		if (!options->no_flops)
+			poti_SetVariable(0.0, new_worker_container_alias, "gf", 0.0);
 #else
 #else
 		if (new_thread)
 		if (new_thread)
 			fprintf(out_paje_file, "7	%.9f	%st%lu	T	%smn%d	%s%d\n",
 			fprintf(out_paje_file, "7	%.9f	%st%lu	T	%smn%d	%s%d\n",
 				get_event_time_stamp(ev, options), prefix, threadid, prefix, nodeid, prefix, bindid);
 				get_event_time_stamp(ev, options), prefix, threadid, prefix, nodeid, prefix, bindid);
 		fprintf(out_paje_file, "7	%.9f	%sw%d	W	%st%lu	%s%s%d\n",
 		fprintf(out_paje_file, "7	%.9f	%sw%d	W	%st%lu	%s%s%d\n",
 			get_event_time_stamp(ev, options), prefix, workerid, prefix, threadid, prefix, kindstr, devid);
 			get_event_time_stamp(ev, options), prefix, workerid, prefix, threadid, prefix, kindstr, devid);
-		fprintf(out_paje_file, "13	%.9f	%sw%d	gf	0.0\n",
-			0.0, prefix, workerid);
+		if (!options->no_flops)
+			fprintf(out_paje_file, "13	%.9f	%sw%d	gf	0.0\n",
+				0.0, prefix, workerid);
 #endif
 #endif
 	}
 	}
 
 
@@ -1363,16 +1365,20 @@ static void handle_start_codelet_body(struct fxt_ev_64 *ev, struct starpu_fxt_op
 		comp = ongoing_computation[worker] = _starpu_computation_new();
 		comp = ongoing_computation[worker] = _starpu_computation_new();
 		comp->peer = NULL;
 		comp->peer = NULL;
 		comp->comp_start = start_codelet_time;
 		comp->comp_start = start_codelet_time;
-		_starpu_computation_list_push_back(&computation_list, comp);
+		if (!options->no_flops)
+			_starpu_computation_list_push_back(&computation_list, comp);
 	}
 	}
 	else if (options->no_smooth ||
 	else if (options->no_smooth ||
 			(start_codelet_time - last_codelet_end[worker]) >=
 			(start_codelet_time - last_codelet_end[worker]) >=
 			IDLE_FACTOR * (last_codelet_end[worker] - last_start_codelet_time))
 			IDLE_FACTOR * (last_codelet_end[worker] - last_start_codelet_time))
 	{
 	{
 		/* Long idle period, move previously-allocated comp to now */
 		/* Long idle period, move previously-allocated comp to now */
-		_starpu_computation_list_erase(&computation_list, comp);
 		comp->comp_start = start_codelet_time;
 		comp->comp_start = start_codelet_time;
-		_starpu_computation_list_push_back(&computation_list, comp);
+		if (!options->no_flops)
+		{
+			_starpu_computation_list_erase(&computation_list, comp);
+			_starpu_computation_list_push_back(&computation_list, comp);
+		}
 	}
 	}
 }
 }
 
 
@@ -1519,37 +1525,46 @@ static void handle_end_codelet_body(struct fxt_ev_64 *ev, struct starpu_fxt_opti
 	double gflops_start = peer->comp_start;
 	double gflops_start = peer->comp_start;
 	double codelet_length;
 	double codelet_length;
 	double gflops;
 	double gflops;
+	struct _starpu_computation *comp;
 
 
 	codelet_length = end_codelet_time - gflops_start;
 	codelet_length = end_codelet_time - gflops_start;
 	gflops = (((double)task->kflops) / 1000000) / (codelet_length / 1000);
 	gflops = (((double)task->kflops) / 1000000) / (codelet_length / 1000);
 
 
+	if (options->no_flops)
+	{
+		_starpu_computation_delete(peer);
+	}
+	else
+	{
 #ifdef STARPU_HAVE_POTI
 #ifdef STARPU_HAVE_POTI
-	char container[STARPU_POTI_STR_LEN];
-	worker_container_alias(container, STARPU_POTI_STR_LEN, prefix, worker);
-	if (gflops_start != last_end_codelet_time)
-		poti_SetVariable(last_end_codelet_time, container, "gf", 0.);
-	poti_SetVariable(gflops_start, container, "gf", gflops);
+		char container[STARPU_POTI_STR_LEN];
+		worker_container_alias(container, STARPU_POTI_STR_LEN, prefix, worker);
+		if (gflops_start != last_end_codelet_time)
+			poti_SetVariable(last_end_codelet_time, container, "gf", 0.);
+		poti_SetVariable(gflops_start, container, "gf", gflops);
 #else
 #else
-	if (gflops_start != last_end_codelet_time)
+		if (gflops_start != last_end_codelet_time)
+			fprintf(out_paje_file, "13	%.9f	%sw%d	gf	%f\n",
+					last_end_codelet_time, prefix, worker, 0.);
 		fprintf(out_paje_file, "13	%.9f	%sw%d	gf	%f\n",
 		fprintf(out_paje_file, "13	%.9f	%sw%d	gf	%f\n",
-				last_end_codelet_time, prefix, worker, 0.);
-	fprintf(out_paje_file, "13	%.9f	%sw%d	gf	%f\n",
-			gflops_start, prefix, worker, gflops);
+				gflops_start, prefix, worker, gflops);
 #endif
 #endif
 
 
-	struct _starpu_computation *comp = _starpu_computation_new();
-	comp->comp_start = end_codelet_time;
-	comp->gflops = -gflops;
-	peer->gflops = +gflops;
-	comp->peer = peer;
-	peer->peer = comp;
-	_starpu_computation_list_push_back(&computation_list, comp);
+		comp = _starpu_computation_new();
+		comp->comp_start = end_codelet_time;
+		comp->gflops = -gflops;
+		peer->gflops = +gflops;
+		comp->peer = peer;
+		peer->peer = comp;
+		_starpu_computation_list_push_back(&computation_list, comp);
+	}
 
 
 	/* Prepare comp for next codelet */
 	/* Prepare comp for next codelet */
 	comp = _starpu_computation_new();
 	comp = _starpu_computation_new();
 	comp->comp_start = end_codelet_time;
 	comp->comp_start = end_codelet_time;
 	comp->peer = NULL;
 	comp->peer = NULL;
-	_starpu_computation_list_push_back(&computation_list, comp);
+	if (!options->no_flops)
+		_starpu_computation_list_push_back(&computation_list, comp);
 	ongoing_computation[worker] = comp;
 	ongoing_computation[worker] = comp;
 
 
 	if (distrib_time)
 	if (distrib_time)
@@ -2837,6 +2852,9 @@ void _starpu_fxt_parse_new_file(char *filename_in, struct starpu_fxt_options *op
 			poti_CreateContainer(0.0, new_scheduler_container_alias, "Sc", new_program_container_alias, new_scheduler_container_name);
 			poti_CreateContainer(0.0, new_scheduler_container_alias, "Sc", new_program_container_alias, new_scheduler_container_name);
 			poti_SetVariable(0.0, new_scheduler_container_alias, "nsubmitted", 0.0);
 			poti_SetVariable(0.0, new_scheduler_container_alias, "nsubmitted", 0.0);
 			poti_SetVariable(0.0, new_scheduler_container_alias, "nready", 0.0);
 			poti_SetVariable(0.0, new_scheduler_container_alias, "nready", 0.0);
+		}
+		if (!option->no_flops)
+		{
 			poti_SetVariable(0.0, new_scheduler_container_alias, "gft", 0.0);
 			poti_SetVariable(0.0, new_scheduler_container_alias, "gft", 0.0);
 		}
 		}
 #else
 #else
@@ -2847,6 +2865,9 @@ void _starpu_fxt_parse_new_file(char *filename_in, struct starpu_fxt_options *op
 			fprintf(out_paje_file, "7	%.9f	%ssched	Sc	%sp	%sscheduler\n", 0.0, prefix, prefix, prefix);
 			fprintf(out_paje_file, "7	%.9f	%ssched	Sc	%sp	%sscheduler\n", 0.0, prefix, prefix, prefix);
 			fprintf(out_paje_file, "13	0.0	%ssched	nsubmitted	0.0\n", prefix);
 			fprintf(out_paje_file, "13	0.0	%ssched	nsubmitted	0.0\n", prefix);
 			fprintf(out_paje_file, "13	0.0	%ssched	nready	0.0\n", prefix);
 			fprintf(out_paje_file, "13	0.0	%ssched	nready	0.0\n", prefix);
+		}
+		if (!options->no_flops)
+		{
 			fprintf(out_paje_file, "13	0.0	%ssched	gft	0.0\n", prefix);
 			fprintf(out_paje_file, "13	0.0	%ssched	gft	0.0\n", prefix);
 		}
 		}
 #endif
 #endif
@@ -3404,10 +3425,11 @@ void _starpu_fxt_parse_new_file(char *filename_in, struct starpu_fxt_options *op
 				break;
 				break;
 		}
 		}
 		_starpu_fxt_process_bandwidth(options);
 		_starpu_fxt_process_bandwidth(options);
-		_starpu_fxt_process_computations(options);
+		if (!options->no_flops)
+			_starpu_fxt_process_computations(options);
 	}
 	}
 
 
-	if (out_paje_file)
+	if (out_paje_file && !options->no_flops)
 	{
 	{
 		unsigned i;
 		unsigned i;
 		for (i = 0; i < STARPU_NMAXWORKERS; i++)
 		for (i = 0; i < STARPU_NMAXWORKERS; i++)
@@ -3468,6 +3490,7 @@ void starpu_fxt_options_init(struct starpu_fxt_options *options)
 	options->per_task_colour = 0;
 	options->per_task_colour = 0;
 	options->no_counter = 0;
 	options->no_counter = 0;
 	options->no_bus = 0;
 	options->no_bus = 0;
+	options->no_flops = 0;
 	options->no_smooth = 0;
 	options->no_smooth = 0;
 	options->ninputfiles = 0;
 	options->ninputfiles = 0;
 	options->out_paje_path = "paje.trace";
 	options->out_paje_path = "paje.trace";
@@ -3641,7 +3664,8 @@ void _starpu_fxt_paje_file_init(struct starpu_fxt_options *options)
 	/* create lists for symbols (kernel states) and communications */
 	/* create lists for symbols (kernel states) and communications */
 	_starpu_symbol_name_list_init(&symbol_list);
 	_starpu_symbol_name_list_init(&symbol_list);
 	_starpu_communication_list_init(&communication_list);
 	_starpu_communication_list_init(&communication_list);
-	_starpu_computation_list_init(&computation_list);
+	if (!options->no_flops)
+		_starpu_computation_list_init(&computation_list);
 }
 }
 
 
 static
 static

+ 11 - 3
tools/starpu_fxt_tool.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  *
- * Copyright (C) 2011-2014, 2016  Universite de Bordeaux
+ * Copyright (C) 2011-2014, 2016-2017  Universite de Bordeaux
  * Copyright (C) 2012-2015  CNRS
  * Copyright (C) 2012-2015  CNRS
  *
  *
  * StarPU is free software; you can redistribute it and/or modify
  * StarPU is free software; you can redistribute it and/or modify
@@ -34,8 +34,9 @@ static void usage()
 	fprintf(stderr, "                       times for MPI execution case\n");
 	fprintf(stderr, "                       times for MPI execution case\n");
         fprintf(stderr, "   -o <output file>    specify the output file\n");
         fprintf(stderr, "   -o <output file>    specify the output file\n");
         fprintf(stderr, "   -c                  use a different colour for every type of task\n");
         fprintf(stderr, "   -c                  use a different colour for every type of task\n");
-        fprintf(stderr, "   -no-counter         set the FxT no counter option\n");
-        fprintf(stderr, "   -no-bus             set the FxT no bus option\n");
+	fprintf(stderr, "   -no-counter         do not show scheduler counters\n");
+	fprintf(stderr, "   -no-bus             do not show PCI bus transfers\n");
+	fprintf(stderr, "   -no-flops           do not show flops\n");
 	fprintf(stderr, "   -no-smooth          avoid smoothing values for gflops etc.\n");
 	fprintf(stderr, "   -no-smooth          avoid smoothing values for gflops etc.\n");
 	fprintf(stderr, "   -h, --help          display this help and exit\n");
 	fprintf(stderr, "   -h, --help          display this help and exit\n");
 	fprintf(stderr, "   -v, --version       output version information and exit\n\n");
 	fprintf(stderr, "   -v, --version       output version information and exit\n\n");
@@ -91,6 +92,13 @@ static int parse_args(int argc, char **argv)
 			continue;
 			continue;
 		}
 		}
 
 
+		if (strcmp(argv[i], "-no-flops") == 0)
+		{
+			options.no_flops = 1;
+			reading_input_filenames = 0;
+			continue;
+		}
+
 		if (strcmp(argv[i], "-no-smooth") == 0)
 		if (strcmp(argv[i], "-no-smooth") == 0)
 		{
 		{
 			options.no_smooth = 1;
 			options.no_smooth = 1;