Browse Source

eager component needs to tell all its children that they can pull

Samuel Thibault 6 years ago
parent
commit
2f2cbafa55

+ 5 - 1
doc/doxygen/chapters/api/modularized_scheduler.doxy

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2013,2014                                Inria
  * Copyright (C) 2013-2018                                CNRS
- * Copyright (C) 2009-2011,2014,2015,2017,2018            Université de Bordeaux
+ * Copyright (C) 2009-2011,2014,2015,2017,2018-2019       Université de Bordeaux
  * Copyright (C) 2013                                     Simon Archipoff
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -259,6 +259,10 @@ default function for the can_push component method, just calls can_push of paren
 \ingroup API_Modularized_Scheduler
 default function for the can_pull component method, just calls can_pull of children until one of them returns non-zero
 
+\fn int starpu_sched_component_can_pull_all(struct starpu_sched_component * component)
+\ingroup API_Modularized_Scheduler
+function for the can_pull component method, calls can_pull of all children
+
 \fn double starpu_sched_component_estimated_load(struct starpu_sched_component * component);
 \ingroup API_Modularized_Scheduler
 default function for the estimated_load component method, just sums up the loads

+ 2 - 1
include/starpu_sched_component.h

@@ -3,7 +3,7 @@
  * Copyright (C) 2017                                     Arthur Chevalier
  * Copyright (C) 2013,2014,2017                           Inria
  * Copyright (C) 2014,2015,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
@@ -127,6 +127,7 @@ void starpu_sched_component_worker_post_exec_hook(struct starpu_task *task, unsi
 
 int starpu_sched_component_can_push(struct starpu_sched_component * component, struct starpu_sched_component * to);
 int starpu_sched_component_can_pull(struct starpu_sched_component * component);
+int starpu_sched_component_can_pull_all(struct starpu_sched_component * component);
 double starpu_sched_component_estimated_load(struct starpu_sched_component * component);
 double starpu_sched_component_estimated_end_min(struct starpu_sched_component * component);
 double starpu_sched_component_estimated_end_min_add(struct starpu_sched_component * component, double exp_len);

+ 2 - 1
src/sched_policies/component_eager.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2013                                     Inria
  * Copyright (C) 2017                                     CNRS
- * Copyright (C) 2014-2018                                Université de Bordeaux
+ * Copyright (C) 2014-2019                                Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -136,6 +136,7 @@ struct starpu_sched_component * starpu_sched_component_eager_create(struct starp
 	component->data = data;
 	component->push_task = eager_push_task;
 	component->can_push = eager_can_push;
+	component->can_pull = starpu_sched_component_can_pull_all;
 	component->deinit_data = eager_deinit_data;
 
 	return component;

+ 16 - 1
src/sched_policies/component_sched.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2013,2014,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
@@ -600,6 +600,21 @@ int starpu_sched_component_can_pull(struct starpu_sched_component * component)
 }
 
 
+/* A can_pull call will try to wake up one worker associated to the childs of the
+ * component. It is currenly called by components which holds a queue (like fifo and prio
+ * components) to signify its childs that a task has been pushed on its local queue.
+ */
+int starpu_sched_component_can_pull_all(struct starpu_sched_component * component)
+{
+	STARPU_ASSERT(component);
+	STARPU_ASSERT(!starpu_sched_component_is_worker(component));
+	unsigned i;
+	for(i = 0; i < component->nchildren; i++)
+		component->children[i]->can_pull(component->children[i]);
+	return 0;
+}
+
+
 /* Alternative can_pull which says that this component does not want
    to pull but prefers that you push. It can be used by decision
    components, in which decisions are usually taken in their push()