Explorar o código

Heft/dmda*: fix the protection of critical sections in compute_all_performance_predictions().

Heft: the critical section was too large.
dmda*: the critical section was not protected at all.
Cyril Roelandt %!s(int64=13) %!d(string=hai) anos
pai
achega
a1c305a88b

+ 2 - 0
src/sched_policies/deque_modeling_policy_data_aware.c

@@ -384,8 +384,10 @@ static void compute_all_performance_predictions(struct starpu_task *task,
 			}
 
 			/* Sometimes workers didn't take the tasks as early as we expected */
+			_STARPU_PTHREAD_MUTEX_LOCK(&sched_mutex[worker]);
 			fifo->exp_start = STARPU_MAX(fifo->exp_start, starpu_timing_now());
 			exp_end[worker][nimpl] = fifo->exp_start + fifo->exp_len;
+			_STARPU_PTHREAD_MUTEX_UNLOCK(&sched_mutex[worker]);
 			if (exp_end[worker][nimpl] > max_exp_end)
 				max_exp_end = exp_end[worker][nimpl];
 

+ 1 - 1
src/sched_policies/heft.c

@@ -283,9 +283,9 @@ static void compute_all_performance_predictions(struct starpu_task *task,
 			_STARPU_PTHREAD_MUTEX_LOCK(&sched_mutex[worker]);
 			fifo->exp_start = STARPU_MAX(fifo->exp_start, starpu_timing_now());
 			exp_end[worker][nimpl] = fifo->exp_start + fifo->exp_len;
+			_STARPU_PTHREAD_MUTEX_UNLOCK(&sched_mutex[worker]);
 			if (exp_end[worker][nimpl] > max_exp_end)
 				max_exp_end = exp_end[worker][nimpl];
-			_STARPU_PTHREAD_MUTEX_UNLOCK(&sched_mutex[worker]);
 
 			enum starpu_perf_archtype perf_arch = starpu_worker_get_perf_archtype(worker);
 			unsigned memory_node = starpu_worker_get_memory_node(worker);