Browse Source

show tasks currently running on workers

Samuel Thibault 13 years ago
parent
commit
a141a987ec

+ 2 - 1
src/core/workers.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
+ * Copyright (C) 2009-2012  Université de Bordeaux 1
  * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -72,6 +72,7 @@ struct _starpu_worker
 	pthread_cond_t *sched_cond; /* condition variable used when the worker waits for tasks. */
 	pthread_mutex_t *sched_mutex; /* mutex protecting sched_cond */
 	struct starpu_task_list local_tasks; /* this queue contains tasks that have been explicitely submitted to that queue */
+	struct starpu_task *current_task; /* task currently executed by this worker */
 	struct _starpu_worker_set *set; /* in case this worker belongs to a set */
 	struct _starpu_job_list *terminated_jobs; /* list of pending jobs which were executed */
 	unsigned worker_is_running;

+ 3 - 1
src/drivers/cpu/driver_cpu.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  Mehdi Juhoor <mjuhoor@gmail.com>
  * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
  * Copyright (C) 2011  Télécom-SudParis
@@ -179,10 +179,12 @@ void *_starpu_cpu_worker(void *arg)
 		}
 
 		_starpu_set_current_task(j->task);
+		cpu_arg->current_task = j->task;
 
                 res = execute_job_on_cpu(j, cpu_arg, is_parallel_task, rank, perf_arch);
 
 		_starpu_set_current_task(NULL);
+		cpu_arg->current_task = NULL;
 
 		if (res)
 		{

+ 2 - 0
src/drivers/cuda/driver_cuda.c

@@ -328,10 +328,12 @@ void *_starpu_cuda_worker(void *arg)
 		}
 
 		_starpu_set_current_task(task);
+		args->current_task = j->task;
 
 		res = execute_job_on_cuda(j, args);
 
 		_starpu_set_current_task(NULL);
+		args->current_task = NULL;
 
 		if (res)
 		{

+ 3 - 1
src/drivers/opencl/driver_opencl.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  Mehdi Juhoor <mjuhoor@gmail.com>
  * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
  * Copyright (C) 2011  Télécom-SudParis
@@ -509,10 +509,12 @@ void *_starpu_opencl_worker(void *arg)
 		}
 
 		_starpu_set_current_task(j->task);
+		args->current_task = j->task;
 
 		res = _starpu_opencl_execute_job(j, args);
 
 		_starpu_set_current_task(NULL);
+		args->current_task = NULL;
 
                 if (res)
 		{

+ 20 - 1
tools/gdbinit

@@ -1,7 +1,7 @@
 
 # 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
 #
 # StarPU is free software; you can redistribute it and/or modify
@@ -121,9 +121,27 @@ document starpu-workers
 Prints a list of the StarPU workers
 end
 
+define starpu-tags
+  printf "tags htbl %p\n", tag_htbl
+  printf "TODO\n"
+end
+
 define starpu-tasks
   printf "%d submitted tasks\n", nsubmitted
   printf "%d ready tasks\n", nready
+  printf "Tasks being run:\n"
+  set $n = 0
+  while $n < config.topology.nworkers
+    set $task = config.workers[$n].current_task
+    if ($task)
+      printf "worker %d: %p\n", $n, $task
+    end
+    set $n = $n + 1
+  end
+  if (tag_htbl)
+    printf "TODO: tags\n"
+  end
+  print "TODO: complete\n"
 end
 
 define starpu
@@ -311,4 +329,5 @@ starpu-print-requests   prints all StarPU data requests
 starpu-print-prequests  prints all pending StarPU data requests
 starpu-print-frequests  prints all StarPU prefetch data requests
 starpu-tasks            prints a list of the tasks flowing in StarPU
+starpu-tags             prints a list of the tags known to StarPU
 end