Browse Source

component_fifo/prio: Fix taking into account ntask threshold event when exp is set to 0

Samuel Thibault 5 years ago
parent
commit
05329b238f
2 changed files with 17 additions and 4 deletions
  1. 7 1
      src/sched_policies/component_fifo.c
  2. 10 3
      src/sched_policies/component_prio.c

+ 7 - 1
src/sched_policies/component_fifo.c

@@ -93,7 +93,13 @@ static int fifo_push_local_task(struct starpu_sched_component * component, struc
 	const double now = starpu_timing_now();
 	STARPU_COMPONENT_MUTEX_LOCK(mutex);
 
-	if(data->exp)
+	if (data->ntasks_threshold != 0 && fifo->ntasks >= data->ntasks_threshold)
+	{
+		STARPU_ASSERT(!is_pushback);
+		ret = 1;
+		STARPU_COMPONENT_MUTEX_UNLOCK(mutex);
+	}
+	else if(data->exp)
 	{
 		double exp_len;
 		if(!isnan(task->predicted))

+ 10 - 3
src/sched_policies/component_prio.c

@@ -113,14 +113,21 @@ static int prio_push_local_task(struct starpu_sched_component * component, struc
 	STARPU_COMPONENT_MUTEX_LOCK(mutex);
 
 	double exp_len = NAN;
-	if(data->exp)
+
+	if (data->ntasks_threshold != 0 && prio->ntasks >= data->ntasks_threshold)
+	{
+		STARPU_ASSERT(!is_pushback);
+		ret = 1;
+		STARPU_COMPONENT_MUTEX_UNLOCK(mutex);
+	}
+	else if(data->exp)
 	{
 		if(!isnan(task->predicted))
 			exp_len = prio->exp_len + task->predicted;
 		else
 			exp_len = prio->exp_len;
 
-		if ((data->ntasks_threshold != 0 && prio->ntasks >= data->ntasks_threshold) || (data->exp_len_threshold != 0.0 && exp_len >= data->exp_len_threshold))
+		if (data->exp_len_threshold != 0.0 && exp_len >= data->exp_len_threshold)
 		{
 			static int warned;
 			if(data->exp_len_threshold != 0.0 && task->predicted > data->exp_len_threshold && !warned)
@@ -128,12 +135,12 @@ static int prio_push_local_task(struct starpu_sched_component * component, struc
 				_STARPU_DISP("Warning : a predicted task length (%lf) exceeds the expected length threshold (%lf) of a prio component queue, you should reconsider the value of this threshold. This message will not be printed again for further thresholds exceeding.\n",task->predicted,data->exp_len_threshold);
 				warned = 1;
 			}
+			STARPU_ASSERT(!is_pushback);
 			ret = 1;
 			STARPU_COMPONENT_MUTEX_UNLOCK(mutex);
 		}
 		else
 		{
-
 			if(!isnan(task->predicted_transfer))
 			{
 				double end = prio_estimated_end(component);