Prechádzať zdrojové kódy

Various fixes for parallel tasks:
- Wait for the barrier to end before measurement the overall execution time.
- All workers should call STARPU_TRACE_END_CODELET_BODY to have a correct trace.
- All workers are working, so we set cpu_args->status for all workers.

Cédric Augonnet 14 rokov pred
rodič
commit
4e1758ee14
1 zmenil súbory, kde vykonal 11 pridanie a 12 odobranie
  1. 11 12
      src/drivers/cpu/driver_cpu.c

+ 11 - 12
src/drivers/cpu/driver_cpu.c

@@ -70,11 +70,12 @@ static int execute_job_on_cpu(starpu_job_t j, struct starpu_worker_s *cpu_args,
 			starpu_clock_gettime(&codelet_start);
 			_starpu_worker_register_executing_start_date(workerid, &codelet_start);
 		}
-	
-		cpu_args->status = STATUS_EXECUTING;
-		task->status = STARPU_TASK_RUNNING;	
+
 	}
 	
+	cpu_args->status = STATUS_EXECUTING;
+	task->status = STARPU_TASK_RUNNING;	
+	
 	/* In case this is a Fork-join parallel task, the worker does not
 	 * execute the kernel at all. */
 	if ((rank == 0) || (cl->type != STARPU_FORKJOIN))
@@ -83,22 +84,20 @@ static int execute_job_on_cpu(starpu_job_t j, struct starpu_worker_s *cpu_args,
 		func(task->interface, task->cl_arg);
 	}
 	
+	if (is_parallel_task)
+		PTHREAD_BARRIER_WAIT(&j->after_work_barrier);
+
+	STARPU_TRACE_END_CODELET_BODY(j);
+
+	cpu_args->status = STATUS_UNKNOWN;
+
 	if (rank == 0)
 	{
 		cl->per_worker_stats[workerid]++;
 		
 		if ((profiling && profiling_info) || calibrate_model)
 			starpu_clock_gettime(&codelet_end);
-	
-		STARPU_TRACE_END_CODELET_BODY(j);
-		cpu_args->status = STATUS_UNKNOWN;
-	}
 
-	if (is_parallel_task)
-		PTHREAD_BARRIER_WAIT(&j->after_work_barrier);
-
-	if (rank == 0)
-	{
 		_starpu_push_task_output(task, 0);
 
 		_starpu_driver_update_job_feedback(j, cpu_args, profiling_info,