|
@@ -2,7 +2,7 @@
|
|
|
*
|
|
|
* Copyright (C) 2013,2017 Inria
|
|
|
* Copyright (C) 2014-2017 CNRS
|
|
|
- * Copyright (C) 2014-2018 Université de Bordeaux
|
|
|
+ * Copyright (C) 2014-2019 Université de Bordeaux
|
|
|
* Copyright (C) 2013 Simon Archipoff
|
|
|
*
|
|
|
* StarPU is free software; you can redistribute it and/or modify
|
|
@@ -90,6 +90,7 @@ static int fifo_push_local_task(struct starpu_sched_component * component, struc
|
|
|
struct _starpu_fifo_taskq * fifo = data->fifo;
|
|
|
starpu_pthread_mutex_t * mutex = &data->mutex;
|
|
|
int ret = 0;
|
|
|
+ const double now = starpu_timing_now();
|
|
|
STARPU_COMPONENT_MUTEX_LOCK(mutex);
|
|
|
double exp_len;
|
|
|
if(!isnan(task->predicted))
|
|
@@ -120,6 +121,17 @@ static int fifo_push_local_task(struct starpu_sched_component * component, struc
|
|
|
starpu_sched_component_prefetch_on_node(component, task);
|
|
|
}
|
|
|
|
|
|
+ if(!isnan(task->predicted_transfer))
|
|
|
+ {
|
|
|
+ double end = fifo_estimated_end(component);
|
|
|
+ double tfer_end = now + task->predicted_transfer;
|
|
|
+ if(tfer_end < end)
|
|
|
+ task->predicted_transfer = 0.0;
|
|
|
+ else
|
|
|
+ task->predicted_transfer = tfer_end - end;
|
|
|
+ exp_len += task->predicted_transfer;
|
|
|
+ }
|
|
|
+
|
|
|
if(!isnan(task->predicted))
|
|
|
{
|
|
|
fifo->exp_len = exp_len;
|
|
@@ -155,9 +167,34 @@ static struct starpu_task * fifo_pull_task(struct starpu_sched_component * compo
|
|
|
{
|
|
|
if(!isnan(task->predicted))
|
|
|
{
|
|
|
+ const double exp_len = fifo->exp_len - task->predicted;
|
|
|
fifo->exp_start = now + task->predicted;
|
|
|
- fifo->exp_len -= task->predicted;
|
|
|
+ if (exp_len >= 0.0)
|
|
|
+ {
|
|
|
+ fifo->exp_len = exp_len;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ /* exp_len can become negative due to rounding errors */
|
|
|
+ fifo->exp_len = 0.0;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ STARPU_ASSERT_MSG(fifo->exp_len>=0, "fifo->exp_len=%lf\n",fifo->exp_len);
|
|
|
+ if(!isnan(task->predicted_transfer))
|
|
|
+ {
|
|
|
+ if (fifo->exp_len > task->predicted_transfer)
|
|
|
+ {
|
|
|
+ fifo->exp_start += task->predicted_transfer;
|
|
|
+ fifo->exp_len -= task->predicted_transfer;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ fifo->exp_start += fifo->exp_len;
|
|
|
+ fifo->exp_len = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
fifo->exp_end = fifo->exp_start + fifo->exp_len;
|
|
|
if(fifo->ntasks == 0)
|
|
|
fifo->exp_len = 0.0;
|