|
|
@@ -46,7 +46,12 @@ static int heft_progress_one(struct starpu_sched_component *component)
|
|
|
struct starpu_task * (tasks[NTASKS]);
|
|
|
unsigned ntasks;
|
|
|
|
|
|
+ const int relaxed_state = _starpu_worker_get_observation_safe_state();
|
|
|
+ if (!relaxed_state)
|
|
|
+ _starpu_worker_enter_section_safe_for_observation();
|
|
|
STARPU_PTHREAD_MUTEX_LOCK(mutex);
|
|
|
+ if (!relaxed_state)
|
|
|
+ _starpu_worker_leave_section_safe_for_observation();
|
|
|
/* Try to look at NTASKS from the queue */
|
|
|
for (ntasks = 0; ntasks < NTASKS; ntasks++)
|
|
|
{
|
|
|
@@ -116,7 +121,11 @@ static int heft_progress_one(struct starpu_sched_component *component)
|
|
|
int best_icomponent = -1;
|
|
|
|
|
|
/* Push back the other tasks */
|
|
|
+ if (!relaxed_state)
|
|
|
+ _starpu_worker_enter_section_safe_for_observation();
|
|
|
STARPU_PTHREAD_MUTEX_LOCK(mutex);
|
|
|
+ if (!relaxed_state)
|
|
|
+ _starpu_worker_leave_section_safe_for_observation();
|
|
|
for (n = ntasks - 1; n < ntasks; n--)
|
|
|
if ((int) n != best_task)
|
|
|
_starpu_prio_deque_push_back_task(prio, tasks[n]);
|
|
|
@@ -161,7 +170,11 @@ static int heft_progress_one(struct starpu_sched_component *component)
|
|
|
if (ret)
|
|
|
{
|
|
|
/* Could not push to child actually, push that one back too */
|
|
|
+ if (!relaxed_state)
|
|
|
+ _starpu_worker_enter_section_safe_for_observation();
|
|
|
STARPU_PTHREAD_MUTEX_LOCK(mutex);
|
|
|
+ if (!relaxed_state)
|
|
|
+ _starpu_worker_leave_section_safe_for_observation();
|
|
|
_starpu_prio_deque_push_back_task(prio, tasks[best_task]);
|
|
|
STARPU_PTHREAD_MUTEX_UNLOCK(mutex);
|
|
|
return 1;
|
|
|
@@ -186,7 +199,12 @@ static int heft_push_task(struct starpu_sched_component * component, struct star
|
|
|
struct _starpu_prio_deque * prio = &data->prio;
|
|
|
starpu_pthread_mutex_t * mutex = &data->mutex;
|
|
|
|
|
|
+ const int relaxed_state = _starpu_worker_get_observation_safe_state();
|
|
|
+ if (!relaxed_state)
|
|
|
+ _starpu_worker_enter_section_safe_for_observation();
|
|
|
STARPU_PTHREAD_MUTEX_LOCK(mutex);
|
|
|
+ if (!relaxed_state)
|
|
|
+ _starpu_worker_leave_section_safe_for_observation();
|
|
|
_starpu_prio_deque_push_task(prio,task);
|
|
|
STARPU_PTHREAD_MUTEX_UNLOCK(mutex);
|
|
|
|