瀏覽代碼

Do not show internal tasks in fxt dag by default. Allow to hide acquisitions too.

Samuel Thibault 7 年之前
父節點
當前提交
0a7ddec6fa

+ 2 - 0
ChangeLog

@@ -98,6 +98,8 @@ Small features:
    starpu_task_insert_data_process_arg,
    starpu_task_insert_data_process_array_arg,
    starpu_task_insert_data_process_mode_array_arg
+   * Do not show internal tasks in fxt dag by default. Allow to hide
+   acquisitions too.
 
 StarPU 1.2.3 (svn revision 22444)
 ==============================================

+ 7 - 0
doc/doxygen/chapters/api/codelet_and_tasks.doxy

@@ -752,6 +752,13 @@ the configuration of a task allocated with starpu_task_create().
     right value. This will hence avoid submitting tasks which have not
     been properly initialised.
 
+\var unsigned starpu_task::type
+    This field allows to specify the type of task, for filtering
+    out tasks in profiling outputs, whether it is really internal
+    to StarPU (::STARPU_TASK_TYPE_INTERNAL), a data acquisition
+    synchronization task (STARPU_TASK_TYPE_DATA_ACQUIRE), or a normal task
+    (::STARPU_TASK_TYPE_NORMAL)
+
 \var unsigned starpu_task::sched_ctx
     Scheduling context.
 

+ 3 - 1
include/starpu_fxt.h

@@ -3,7 +3,7 @@
  * Copyright (C) 2012-2013,2016                           Inria
  * Copyright (C) 2013                                     Joris Pablo
  * Copyright (C) 2010-2015,2017                           CNRS
- * Copyright (C) 2010-2011,2013-2017                      Université de Bordeaux
+ * Copyright (C) 2010-2011,2013-2018                      Université de Bordeaux
  *
  * 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
@@ -48,6 +48,8 @@ struct starpu_fxt_options
 	unsigned no_flops;
 	unsigned ninputfiles;
 	unsigned no_smooth;
+	unsigned no_acquire;
+	unsigned internal;
 	char *filenames[STARPU_FXT_MAX_FILES];
 	char *out_paje_path;
 	char *distrib_time_path;

+ 6 - 0
include/starpu_task.h

@@ -200,6 +200,7 @@ struct starpu_task
 	enum starpu_task_status status;
 
 	int magic;
+	unsigned type;
 
 	unsigned sched_ctx;
 	int hypervisor_tag;
@@ -225,6 +226,10 @@ struct starpu_task
 	void *sched_data;
 };
 
+#define STARPU_TASK_TYPE_NORMAL		0
+#define STARPU_TASK_TYPE_INTERNAL	(1<<0)
+#define STARPU_TASK_TYPE_DATA_ACQUIRE	(1<<1)
+
 /* Note: remember to update starpu_task_init as well */
 #define STARPU_TASK_INITIALIZER 			\
 {							\
@@ -251,6 +256,7 @@ struct starpu_task
 	.predicted_start = NAN,				\
 	.starpu_private = NULL,				\
 	.magic = 42,                  			\
+	.type = 0,					\
 	.sched_ctx = STARPU_NMAX_SCHED_CTXS,		\
 	.hypervisor_tag = 0,				\
 	.flops = 0.0,					\

+ 5 - 5
src/common/fxt.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2012-2017                                Inria
- * Copyright (C) 2008-2017                                Université de Bordeaux
+ * Copyright (C) 2008-2018                                Université de Bordeaux
  * Copyright (C) 2013                                     Joris Pablo
  * Copyright (C) 2010-2017                                CNRS
  *
@@ -677,10 +677,10 @@ do {									\
 	FUT_DO_PROBE2(_STARPU_FUT_TAG_DEPS, tag_child, tag_father)
 
 #define _STARPU_TRACE_TASK_DEPS(job_prev, job_succ)	\
-	FUT_DO_PROBE2(_STARPU_FUT_TASK_DEPS, (job_prev)->job_id, (job_succ)->job_id)
+	FUT_DO_PROBE3(_STARPU_FUT_TASK_DEPS, (job_prev)->job_id, (job_succ)->job_id, (job_succ)->task->type)
 
-#define _STARPU_TRACE_GHOST_TASK_DEPS(ghost_prev_id, job_succ_id)		\
-	FUT_DO_PROBE2(_STARPU_FUT_TASK_DEPS, (ghost_prev_id), (job_succ_id))
+#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)
 
 #define _STARPU_TRACE_TASK_NAME(job)						\
 do {										\
@@ -771,7 +771,7 @@ do {										\
 	FUT_DO_PROBE1(_STARPU_FUT_WORKER_SLEEP_END, _starpu_gettid());
 
 #define _STARPU_TRACE_TASK_SUBMIT(job, iter, subiter)	\
-	FUT_DO_PROBE6(_STARPU_FUT_TASK_SUBMIT, (job)->job_id, iter, subiter, (job)->task->no_submitorder?0:_starpu_fxt_get_submit_order(), (job)->task->priority, _starpu_gettid());
+	FUT_DO_PROBE7(_STARPU_FUT_TASK_SUBMIT, (job)->job_id, iter, subiter, (job)->task->no_submitorder?0:_starpu_fxt_get_submit_order(), (job)->task->priority, (job)->task->type, _starpu_gettid());
 
 #define _STARPU_TRACE_TASK_SUBMIT_START()	\
 	FUT_DO_PROBE1(_STARPU_FUT_TASK_SUBMIT_START, _starpu_gettid());

+ 5 - 3
src/core/dependencies/implicit_data_deps.c

@@ -88,7 +88,7 @@ static void _starpu_add_accessor(starpu_data_handle_t handle, struct starpu_task
 		) && handle->last_submitted_ghost_sync_id_is_valid)
 	{
 		_STARPU_TRACE_GHOST_TASK_DEPS(handle->last_submitted_ghost_sync_id,
-			_starpu_get_job_associated_to_task(pre_sync_task)->job_id);
+			_starpu_get_job_associated_to_task(pre_sync_task));
 		_starpu_add_ghost_dependency(handle, handle->last_submitted_ghost_sync_id, pre_sync_task);
 		_STARPU_DEP_DEBUG("dep ID%lu -> %p\n", handle->last_submitted_ghost_sync_id, pre_sync_task);
 	}
@@ -168,7 +168,7 @@ static void _starpu_add_sync_task(starpu_data_handle_t handle, struct starpu_tas
 		{
 			unsigned long id = ghost_accessors_id->id;
 			_STARPU_TRACE_GHOST_TASK_DEPS(id,
-				_starpu_get_job_associated_to_task(pre_sync_task)->job_id);
+				_starpu_get_job_associated_to_task(pre_sync_task));
 			_starpu_add_ghost_dependency(handle, id, pre_sync_task);
 			_STARPU_DEP_DEBUG("dep ID%lu -> %p\n", id, pre_sync_task);
 
@@ -240,7 +240,7 @@ struct starpu_task *_starpu_detect_implicit_data_deps_with_handle(struct starpu_
 #endif
 		)
 		{
-			_STARPU_TRACE_GHOST_TASK_DEPS(pre_sync_job->job_id, post_sync_job->job_id);
+			_STARPU_TRACE_GHOST_TASK_DEPS(pre_sync_job->job_id, post_sync_job);
 			_starpu_bound_task_dep(post_sync_job, pre_sync_job);
 		}
 
@@ -302,6 +302,7 @@ struct starpu_task *_starpu_detect_implicit_data_deps_with_handle(struct starpu_
 					else
 						sync_task->name = "sync_task";
 					sync_task->cl = NULL;
+					sync_task->type = post_sync_task->type;
 
 					/* Make this task wait for the previous ones */
 					_starpu_add_sync_task(handle, sync_task, sync_task, post_sync_task);
@@ -596,6 +597,7 @@ int _starpu_data_wait_until_available(starpu_data_handle_t handle, enum starpu_d
 		sync_task->name = sync_name;
 		sync_task->detach = 0;
 		sync_task->destroy = 1;
+		sync_task->type = STARPU_TASK_TYPE_INTERNAL;
 
 		/* It is not really a RW access, but we want to make sure that
 		 * all previous accesses are done */

+ 4 - 0
src/datawizard/malloc.c

@@ -200,6 +200,7 @@ int _starpu_malloc_flags_on_node(unsigned dst_node, void **A, size_t dim, int fl
 			task->callback_func = NULL;
 			task->cl = &malloc_pinned_cl;
 			task->cl_arg = &s;
+			task->type = STARPU_TASK_TYPE_INTERNAL;
 
 			task->synchronous = 1;
 
@@ -231,6 +232,7 @@ int _starpu_malloc_flags_on_node(unsigned dst_node, void **A, size_t dim, int fl
 //			task->cl = &malloc_pinned_cl;
 //			task->cl_arg = &s;
 //			task->synchronous = 1;
+//			task->type = STARPU_TASK_TYPE_INTERNAL;
 //
 //			_starpu_exclude_task_from_dag(task);
 //
@@ -456,6 +458,7 @@ int _starpu_free_flags_on_node(unsigned dst_node, void *A, size_t dim, int flags
 				task->cl = &free_pinned_cl;
 				task->cl_arg = A;
 				task->synchronous = 1;
+				task->type = STARPU_TASK_TYPE_INTERNAL;
 
 				_starpu_exclude_task_from_dag(task);
 
@@ -481,6 +484,7 @@ int _starpu_free_flags_on_node(unsigned dst_node, void *A, size_t dim, int flags
 //		task->cl = &free_pinned_cl;
 //		task->cl_arg = A;
 //		task->synchronous = 1;
+//		task->type = STARPU_TASK_TYPE_INTERNAL;
 //
 //		_starpu_exclude_task_from_dag(task);
 //

+ 5 - 1
src/datawizard/user_interactions.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2011-2013,2017                           Inria
- * Copyright (C) 2009-2017                                Université de Bordeaux
+ * Copyright (C) 2009-2018                                Université de Bordeaux
  * Copyright (C) 2010-2013,2015-2017                      CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -220,12 +220,14 @@ int starpu_data_acquire_on_node_cb_sequential_consistency_sync_jobids(starpu_dat
 		wrapper->pre_sync_task->detach = 1;
 		wrapper->pre_sync_task->callback_func = starpu_data_acquire_cb_pre_sync_callback;
 		wrapper->pre_sync_task->callback_arg = wrapper;
+		wrapper->pre_sync_task->type = STARPU_TASK_TYPE_DATA_ACQUIRE;
 		if (pre_sync_jobid)
 			*pre_sync_jobid = _starpu_get_job_associated_to_task(wrapper->pre_sync_task)->job_id;
 
 		wrapper->post_sync_task = starpu_task_create();
 		wrapper->post_sync_task->name = "_starpu_data_acquire_cb_post";
 		wrapper->post_sync_task->detach = 1;
+		wrapper->post_sync_task->type = STARPU_TASK_TYPE_DATA_ACQUIRE;
 		if (post_sync_jobid)
 			*post_sync_jobid = _starpu_get_job_associated_to_task(wrapper->post_sync_task)->job_id;
 
@@ -348,10 +350,12 @@ int starpu_data_acquire_on_node(starpu_data_handle_t handle, int node, enum star
 		wrapper.pre_sync_task = starpu_task_create();
 		wrapper.pre_sync_task->name = "_starpu_data_acquire_pre";
 		wrapper.pre_sync_task->detach = 0;
+		wrapper.pre_sync_task->type = STARPU_TASK_TYPE_DATA_ACQUIRE;
 
 		wrapper.post_sync_task = starpu_task_create();
 		wrapper.post_sync_task->name = "_starpu_data_acquire_post";
 		wrapper.post_sync_task->detach = 1;
+		wrapper.post_sync_task->type = STARPU_TASK_TYPE_DATA_ACQUIRE;
 
 		new_task = _starpu_detect_implicit_data_deps_with_handle(wrapper.pre_sync_task, wrapper.post_sync_task, &_starpu_get_job_associated_to_task(wrapper.post_sync_task)->implicit_dep_slot, handle, mode);
 		STARPU_PTHREAD_MUTEX_UNLOCK(&handle->sequential_consistency_mutex);

+ 31 - 3
src/debug/traces/starpu_fxt.c

@@ -4,7 +4,7 @@
  * Copyright (C) 2013                                     Joris Pablo
  * Copyright (C) 2012-2018                                CNRS
  * Copyright (C) 2017                                     Universidade Federal do Rio Grande do Sul (UFRGS)
- * Copyright (C) 2009-2017                                Université de Bordeaux
+ * Copyright (C) 2009-2018                                Université de Bordeaux
  *
  * 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
@@ -98,6 +98,8 @@ struct task_info
 	char *model_name;
 	char *name;
 	int exclude_from_dag;
+	int show;
+	unsigned type;
 	unsigned long job_id;
 	unsigned long submit_order;
 	long priority;
@@ -132,6 +134,8 @@ static struct task_info *get_task(unsigned long job_id, int mpi_rank)
 		task->model_name = NULL;
 		task->name = NULL;
 		task->exclude_from_dag = 0;
+		task->show = 0;
+		task->type = 0;
 		task->job_id = job_id;
 		task->submit_order = 0;
 		task->priority = 0;
@@ -159,6 +163,18 @@ static struct task_info *get_task(unsigned long job_id, int mpi_rank)
 	return task;
 }
 
+/* Return whether to show this task in the DAG or not */
+static int show_task(struct task_info *task, struct starpu_fxt_options *options)
+{
+	if (task->show)
+		return 1;
+	if (task->type & STARPU_TASK_TYPE_INTERNAL && !options->internal)
+		return 0;
+	if (task->type & STARPU_TASK_TYPE_DATA_ACQUIRE && options->no_acquire)
+		return 0;
+	return 1;
+}
+
 static void task_dump(struct task_info *task, struct starpu_fxt_options *options)
 {
 	char *prefix = options->file_prefix;
@@ -2551,10 +2567,14 @@ 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];
 
 	struct task_info *task = get_task(dep_succ, options->file_rank);
+	struct task_info *prev_task = get_task(dep_prev, options->file_rank);
 	unsigned alloc = 0;
 
+	task->type = dep_succ_type;
+
 	if (task->ndeps == 0)
 		/* Start with 8=2^3, should be plenty in most cases */
 		alloc = 8;
@@ -2574,7 +2594,11 @@ 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 */
-	_starpu_fxt_dag_add_task_deps(options->file_prefix, dep_prev, dep_succ);
+	if (show_task(task, options)) {
+		/* 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);
+	}
 }
 
 static void handle_task_submit(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
@@ -2584,6 +2608,7 @@ static void handle_task_submit(struct fxt_ev_64 *ev, struct starpu_fxt_options *
 	unsigned long subiteration = ev->param[2];
 	unsigned long submit_order = ev->param[3];
 	long priority = (long) ev->param[4];
+	unsigned type = ev->param[5];
 
 	struct task_info *task = get_task(job_id, options->file_rank);
 	task->submit_time = get_event_time_stamp(ev, options);
@@ -2591,6 +2616,7 @@ static void handle_task_submit(struct fxt_ev_64 *ev, struct starpu_fxt_options *
 	task->priority = priority;
 	task->iterations[0] = iteration;
 	task->iterations[1] = subiteration;
+	task->type = type;
 }
 
 static void handle_task_name(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
@@ -2625,7 +2651,7 @@ static void handle_task_name(struct fxt_ev_64 *ev, struct starpu_fxt_options *op
 	struct task_info *task = get_task(job_id, options->file_rank);
 	task->exclude_from_dag = exclude_from_dag;
 
-	if (!exclude_from_dag)
+	if (!exclude_from_dag && show_task(task, options))
 		_starpu_fxt_dag_set_task_name(options->file_prefix, job_id, name, colour);
 }
 
@@ -3817,6 +3843,8 @@ void starpu_fxt_options_init(struct starpu_fxt_options *options)
 	options->no_bus = 0;
 	options->no_flops = 0;
 	options->no_smooth = 0;
+	options->no_acquire = 0;
+	options->internal = 0;
 	options->ninputfiles = 0;
 	options->out_paje_path = "paje.trace";
 	options->dag_path = "dag.dot";

+ 17 - 1
tools/starpu_fxt_tool.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2008-2014,2016-2017                      Université de Bordeaux
+ * Copyright (C) 2008-2014,2016-2018                      Université de Bordeaux
  * Copyright (C) 2010-2015,2017                           CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -40,6 +40,8 @@ static void usage()
 	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-acquire         do not show application data acquisitions tasks in DAG\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");
         fprintf(stderr, "Report bugs to <%s>.", PACKAGE_BUGREPORT);
@@ -115,6 +117,20 @@ static int parse_args(int argc, char **argv)
 			continue;
 		}
 
+		if (strcmp(argv[i], "-no-acquire") == 0)
+		{
+			options.no_acquire = 1;
+			reading_input_filenames = 0;
+			continue;
+		}
+
+		if (strcmp(argv[i], "-internal") == 0)
+		{
+			options.internal = 1;
+			reading_input_filenames = 0;
+			continue;
+		}
+
 		if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
 		{
 			usage();