浏览代码

avoid crashing when the scheduler context removes resources from part of a modularized scheduler tree

Samuel Thibault 7 年之前
父节点
当前提交
7927208480
共有 2 个文件被更改,包括 8 次插入2 次删除
  1. 4 1
      src/sched_policies/component_fifo.c
  2. 4 1
      src/sched_policies/component_prio.c

+ 4 - 1
src/sched_policies/component_fifo.c

@@ -45,7 +45,10 @@ static double fifo_estimated_end(struct starpu_sched_component * component)
 	struct _starpu_fifo_data * data = component->data;
 	struct _starpu_fifo_taskq * fifo = data->fifo;
 	int card = starpu_bitmap_cardinal(component->workers_in_ctx);
-	STARPU_ASSERT(card != 0);
+	if (card == 0)
+                /* Oops, no resources to compute our tasks. Let's just hope that
+                 * we will be given one at some point */
+		card = 1;
 	double estimated_end = starpu_sched_component_estimated_end_min(component);
 	estimated_end += fifo->exp_len / card;
 

+ 4 - 1
src/sched_policies/component_prio.c

@@ -64,7 +64,10 @@ static double prio_estimated_end(struct starpu_sched_component * component)
 	struct _starpu_prio_data * data = component->data;
 	struct _starpu_prio_deque * prio = &data->prio;
 	int card = starpu_bitmap_cardinal(component->workers_in_ctx);
-	STARPU_ASSERT(card != 0);
+	if (card == 0)
+                /* Oops, no resources to compute our tasks. Let's just hope that
+                 * we will be given one at some point */
+		card = 1;
 	double estimated_end = starpu_sched_component_estimated_end_min(component);
 	estimated_end += prio->exp_len / card;