Selaa lähdekoodia

move replay.c to starpu_replay.c tool

Erwan Leria 8 vuotta sitten
vanhempi
commit
273a20518b
4 muutettua tiedostoa jossa 18 lisäystä ja 12 poistoa
  1. 1 2
      examples/Makefile.am
  2. 1 0
      examples/mult/xgemm.c
  3. 2 1
      tools/Makefile.am
  4. 14 9
      examples/replay/replay.c

+ 1 - 2
examples/Makefile.am

@@ -203,8 +203,7 @@ STARPU_EXAMPLES =
 
 STARPU_EXAMPLES +=				\
 	sched_ctx/prio				\
-	worker_collections/worker_list_example	\
-	replay/replay
+	worker_collections/worker_list_example
 
 if !STARPU_SIMGRID
 STARPU_EXAMPLES +=				\

+ 1 - 0
examples/mult/xgemm.c

@@ -361,6 +361,7 @@ int main(int argc, char **argv)
 			task->handles[2] = starpu_data_get_sub_data(C_handle, 2, x, y);
 
 			task->flops = 2ULL * (xdim/nslicesx) * (ydim/nslicesy) * zdim;
+			task->tag_id = iter * nslicesx * nslicesy + y * nslicesx + x;
 
 			ret = starpu_task_submit(task);
 			if (ret == -ENODEV)

+ 2 - 1
tools/Makefile.am

@@ -217,7 +217,8 @@ if STARPU_USE_FXT
 bin_PROGRAMS += 			\
 	starpu_fxt_tool			\
 	starpu_fxt_stats		\
-	starpu_fxt_data_trace
+	starpu_fxt_data_trace		\
+	starpu_replay
 
 STARPU_TOOLS += 			\
 	starpu_fxt_tool			\

+ 14 - 9
examples/replay/replay.c

@@ -24,8 +24,9 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <math.h>
-#include <../../src/common/uthash.h>
-#include <../../include/starpu_scheduler.h>
+
+#include <uthash.h>
+#include <starpu_scheduler.h>
 
 #define NMAX_DEPENDENCIES 16
 
@@ -44,6 +45,7 @@ static char *name = NULL;
 static char *model = NULL;
 static jobid_t jobid;
 static jobid_t *dependson;
+static unsigned int submitorder;
 static starpu_tag_t tag;
 static int workerid;
 static uint32_t footprint;
@@ -105,7 +107,7 @@ static struct perfmodel {
 /* Record a dependent task by its jobid and the jobids of its dependencies */
 
 typedef struct s_dep {
-	jobid_t jobid;
+	jobid_t job_id;
 	jobid_t deps_jobid[NMAX_DEPENDENCIES]; /* That array has to contain the jobids of the dependencies, notice that the number of dependcies is limited to 16, modify NMAX_DEPENDENCIES at your convenience */
 	size_t ndependson;
 } s_dep;
@@ -153,9 +155,9 @@ void dumb_kernel(void) {}
 
 /* [CODELET] Initialization of an unique codelet for all the tasks*/
 
-static int can_execute(unsigned workerid, struct starpu_task *task, unsigned nimpl)
+static int can_execute(unsigned worker_id, struct starpu_task *task, unsigned nimpl)
 {
-	struct starpu_perfmodel_arch * arch = starpu_worker_get_perf_archtype(workerid, STARPU_NMAX_SCHED_CTXS);
+	struct starpu_perfmodel_arch * arch = starpu_worker_get_perf_archtype(worker_id, STARPU_NMAX_SCHED_CTXS);
 	double expected_time = ((struct task_arg *) (task->cl_arg))->perf[(starpu_perfmodel_arch_comb_get(arch->ndevices, arch->devices))];
 	if (!(expected_time == 0 || isnan(expected_time)))
 	{
@@ -207,10 +209,10 @@ void array_init(unsigned long * arr, int size)
 
 
 /* Initializing s_dep structure */
-s_dep * s_dep_init(s_dep * sd, jobid_t jobid)
+s_dep * s_dep_init(s_dep * sd, jobid_t job_id)
 {
 	sd = malloc(sizeof(*sd));
-	sd->jobid = jobid;
+	sd->job_id = jobid;
 	array_init((unsigned long *) sd->deps_jobid, 16);
 	sd->ndependson = 0;
 
@@ -349,7 +351,7 @@ int submit_tasks(void)
 		struct task * currentTask;
 				
 		/* Looking for the task associate to the jobid of the jth element of jobidDeps */
-		HASH_FIND(hh, tasks, &jobidDeps[j]->jobid, sizeof(jobid), currentTask);
+		HASH_FIND(hh, tasks, &jobidDeps[j]->job_id, sizeof(jobid), currentTask);
 
 		if (jobidDeps[j]->ndependson > 0)
 		{
@@ -383,7 +385,7 @@ int submit_tasks(void)
 
 		//printf("name : %s \n", currentTask->task.name);
 				
-		printf("submitting task %s (%lu, %llu)\n", currentTask->task.name?currentTask->task.name:"anonymous", jobidDeps[j]->jobid, (unsigned long long) currentTask->task.tag_id /* tag*/);
+		printf("submitting task %s (%lu, %llu)\n", currentTask->task.name?currentTask->task.name:"anonymous", jobidDeps[j]->job_id, (unsigned long long) currentTask->task.tag_id /* tag*/);
 
 		if (ret_val != 0)
 			return -1;
@@ -620,6 +622,9 @@ int main(int argc, char **argv)
 		
 		else if (TEST("JobId"))
 			jobid = atol(s+7);
+
+		else if(TEST("SubmitOrder"))
+			submitorder = atoi(s+13);
 		
 		else if (TEST("DependsOn"))
 		{