Просмотр исходного кода

Add single-stepping support for Temanejo

Samuel Thibault лет назад: 12
Родитель
Сommit
4cad53e8cd

+ 3 - 1
doc/chapters/perf-feedback.texi

@@ -27,7 +27,9 @@ install @code{Ayudame} to e.g. @code{/usr/local/include}, apply the
 sure that it found it, rebuild StarPU.  Run the Temanejo GUI, give it the path
 to your application, any options you want to pass it, the path to libayudame.so.
 
-The number of CPUs currently can not be set.
+Make sure to specify at least the same number of CPUs in the dialog box as your
+machine has, otherwise an error will happen during execution. Future versions
+of Temanejo should be able to tell StarPU the number of CPUs to use.
 
 Only dependencies detected implicitly are currently shown.
 

+ 1 - 1
src/core/dependencies/implicit_data_deps.c

@@ -32,7 +32,7 @@ static void _starpu_add_ayudame_ghost_dependency(starpu_data_handle_t handle STA
 {
 #ifdef HAVE_AYUDAME_H
 	if (AYU_event) {
-		int64_t AYU_data[3] = { previous, (int64_t) handle, (int64_t) handle };
+		uintptr_t AYU_data[3] = { previous, (uintptr_t) handle, (uintptr_t) handle };
 		AYU_event(AYU_ADDDEPENDENCY, _starpu_get_job_associated_to_task(next)->job_id, AYU_data);
 	}
 #endif

+ 12 - 0
src/core/jobs.c

@@ -212,6 +212,10 @@ void _starpu_handle_job_termination(struct _starpu_job *j)
 	j->terminated = 2;
 	_STARPU_PTHREAD_COND_BROADCAST(&j->sync_cond);
 
+#ifdef HAVE_AYUDAME_H
+	if (AYU_event) AYU_event(AYU_REMOVETASK, j->job_id, NULL);
+#endif
+
 	_STARPU_PTHREAD_MUTEX_UNLOCK(&j->sync_mutex);
 
 	if (detach)
@@ -228,6 +232,14 @@ void _starpu_handle_job_termination(struct _starpu_job *j)
 	{
 		STARPU_ASSERT_MSG(detach && !destroy && !task->synchronous, "Regenerated task must be detached, and not have detroy=1 or synchronous=1");
 
+#ifdef HAVE_AYUDAME_H
+		if (AYU_event) {
+#warning TODO: function id
+			int64_t AYU_data[2] = {0, task->priority > STARPU_MIN_PRIO};
+			AYU_event(AYU_ADDTASK, j->job_id, AYU_data);
+		}
+#endif
+
 		/* We reuse the same job structure */
 		int ret = _starpu_submit_job(j);
 		STARPU_ASSERT(!ret);

+ 7 - 0
src/core/sched_policy.c

@@ -23,6 +23,7 @@
 #include <core/sched_policy.h>
 #include <profiling/profiling.h>
 #include <common/barrier.h>
+#include <core/debug.h>
 
 static struct starpu_sched_policy policy;
 
@@ -261,6 +262,12 @@ int _starpu_push_task(struct _starpu_job *j)
 
 	_starpu_increment_nready_tasks();
 	task->status = STARPU_TASK_READY;
+#ifdef HAVE_AYUDAME_H
+	if (AYU_event) {
+		int id = 0;
+		AYU_event(AYU_ADDTASKTOQUEUE, j->job_id, &id);
+	}
+#endif
 	_starpu_profiling_set_task_push_start_time(task);
 
 	/* in case there is no codelet associated to the task (that's a control

+ 4 - 1
src/core/task.c

@@ -377,7 +377,6 @@ int starpu_task_submit(struct starpu_task *task)
 	if (AYU_event) {
 #warning TODO: function id
 		int64_t AYU_data[2] = {0, task->priority > STARPU_MIN_PRIO};
-
 		AYU_event(AYU_ADDTASK, j->job_id, AYU_data);
 	}
 #endif
@@ -624,6 +623,10 @@ int starpu_task_wait_for_all(void)
 
 	_STARPU_PTHREAD_MUTEX_UNLOCK(&submitted_mutex);
 
+#ifdef HAVE_AYUDAME_H
+	if (AYU_event) AYU_event(AYU_BARRIER, 0, NULL);
+#endif
+
 	return 0;
 }
 

+ 11 - 0
src/core/workers.c

@@ -347,6 +347,13 @@ static void _starpu_launch_drivers(struct _starpu_machine_config *config)
 	getitimer(ITIMER_PROF, &prof_itimer);
 #endif
 
+#ifdef HAVE_AYUDAME_H
+	if (AYU_event) {
+		unsigned long n = nworkers;
+		AYU_event(AYU_INIT, 0, (void*) &n);
+	}
+#endif
+
 	for (worker = 0; worker < nworkers; worker++)
 	{
 		struct _starpu_worker *workerarg = &config->workers[worker];
@@ -966,6 +973,10 @@ void starpu_shutdown(void)
 	if (config.default_conf)
 	     free(config.conf);
 
+#ifdef HAVE_AYUDAME_H
+	if (AYU_event) AYU_event(AYU_FINISH, 0, NULL);
+#endif
+
 	_STARPU_DEBUG("Shutdown finished\n");
 }
 

+ 14 - 0
src/drivers/driver_common/driver_common.c

@@ -26,6 +26,7 @@
 #include <starpu_top.h>
 #include <core/sched_policy.h>
 #include <top/starpu_top_core.h>
+#include <core/debug.h>
 
 void _starpu_driver_start_job(struct _starpu_worker *args, struct _starpu_job *j, struct timespec *codelet_start, int rank, int profiling)
 {
@@ -64,6 +65,9 @@ void _starpu_driver_start_job(struct _starpu_worker *args, struct _starpu_job *j
 	if (starpu_top)
 		_starpu_top_task_started(task,workerid,codelet_start);
 
+#ifdef HAVE_AYUDAME_H
+	if (AYU_event) AYU_event(AYU_RUNTASK, j->job_id, NULL);
+#endif
 	_STARPU_TRACE_START_CODELET_BODY(j);
 }
 
@@ -77,6 +81,9 @@ void _starpu_driver_end_job(struct _starpu_worker *args, struct _starpu_job *j,
 	unsigned calibrate_model = 0;
 
 	_STARPU_TRACE_END_CODELET_BODY(j, j->nimpl, perf_arch);
+#ifdef HAVE_AYUDAME_H
+	if (AYU_event) AYU_event(AYU_POSTRUNTASK, j->job_id, NULL);
+#endif
 
 	if (cl && cl->model && cl->model->benchmarking)
 		calibrate_model = 1;
@@ -181,5 +188,12 @@ struct starpu_task *_starpu_get_worker_task(struct _starpu_worker *args, int wor
 		_starpu_worker_set_status(workerid, STATUS_UNKNOWN);
 	}
 
+#ifdef HAVE_AYUDAME_H
+	if (AYU_event) {
+		int id = workerid;
+		AYU_event(AYU_PRERUNTASK, _starpu_get_job_associated_to_task(task)->job_id, &id);
+	}
+#endif
+
 	return task;
 }

+ 7 - 0
src/sched_policies/deque_modeling_policy_data_aware.c

@@ -26,6 +26,7 @@
 #include <sched_policies/fifo_queues.h>
 #include <core/perfmodel/perfmodel.h>
 #include <starpu_parameters.h>
+#include <core/debug.h>
 
 #ifndef DBL_MIN
 #define DBL_MIN __DBL_MIN__
@@ -233,6 +234,12 @@ static int push_task_on_best_worker(struct starpu_task *task, int best_workerid,
 	if (starpu_get_prefetch_flag())
 		starpu_prefetch_task_input_on_node(task, memory_node);
 
+#ifdef HAVE_AYUDAME_H
+	if (AYU_event) {
+		int id = best_workerid;
+		AYU_event(AYU_ADDTASKTOQUEUE, _starpu_get_job_associated_to_task(task)->job_id, &id);
+	}
+#endif
 	if (prio)
 		return _starpu_fifo_push_sorted_task(queue_array[best_workerid],
 			&sched_mutex[best_workerid], &sched_cond[best_workerid], task);

+ 7 - 0
src/sched_policies/heft.c

@@ -29,6 +29,7 @@
 #include <core/jobs.h>
 #include <top/starpu_top_core.h>
 #include <sched_policies/fifo_queues.h>
+#include <core/debug.h>
 
 #ifndef DBL_MIN
 #define DBL_MIN __DBL_MIN__
@@ -229,6 +230,12 @@ static int push_task_on_best_worker(struct starpu_task *task, int best_workerid,
 		starpu_prefetch_task_input_on_node(task, memory_node);
 	}
 
+#ifdef HAVE_AYUDAME_H
+	if (AYU_event) {
+		int id = best_workerid;
+		AYU_event(AYU_ADDTASKTOQUEUE, _starpu_get_job_associated_to_task(task)->job_id, &id);
+	}
+#endif
 	return _starpu_fifo_push_task(queue_array[best_workerid],
 				      &sched_mutex[best_workerid],
 				      &sched_cond[best_workerid], task);

+ 8 - 1
src/sched_policies/random_policy.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2011  Université de Bordeaux 1
+ * Copyright (C) 2010-2012  Université de Bordeaux 1
  * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -20,6 +20,7 @@
 #include <starpu_rand.h>
 #include <core/workers.h>
 #include <sched_policies/fifo_queues.h>
+#include <core/debug.h>
 
 static unsigned nworkers;
 
@@ -60,6 +61,12 @@ static int _random_push_task(struct starpu_task *task, unsigned prio)
 		alpha += worker_alpha;
 	}
 
+#ifdef HAVE_AYUDAME_H
+	if (AYU_event) {
+		int id = selected;
+		AYU_event(AYU_ADDTASKTOQUEUE, _starpu_get_job_associated_to_task(task)->job_id, &id);
+	}
+#endif
 	/* we should now have the best worker in variable "selected" */
 	return starpu_push_local_task(selected, task, prio);
 }

+ 8 - 1
src/sched_policies/work_stealing_policy.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2011  Université de Bordeaux 1
+ * Copyright (C) 2010-2012  Université de Bordeaux 1
  * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
  * Copyright (C) 2012	Inria
  *
@@ -22,6 +22,7 @@
 
 #include <core/workers.h>
 #include <sched_policies/deque_queues.h>
+#include <core/debug.h>
 
 static unsigned nworkers;
 static unsigned last_pop_worker;
@@ -294,6 +295,12 @@ static int ws_push_task(struct starpu_task *task)
 	deque_queue = queue_array[workerid];
 
 	_STARPU_TRACE_JOB_PUSH(task, 0);
+#ifdef HAVE_AYUDAME_H
+	if (AYU_event) {
+		int id = workerid;
+		AYU_event(AYU_ADDTASKTOQUEUE, j->job_id, &id);
+	}
+#endif
 	_starpu_job_list_push_back(deque_queue->jobq, j);
 	deque_queue->njobs++;