Objet : Developers list for StarPU
Archives de la liste
- From: Benoît Lizé <benoit.lize@gmail.com>
- To: starpu-devel@lists.gforge.inria.fr
- Subject: [Starpu-devel] Is StarPU busy-waiting for tasks ?
- Date: Wed, 30 Oct 2013 12:26:57 +0100
- List-archive: <http://lists.gforge.inria.fr/pipermail/starpu-devel>
- List-id: "Developers list. For discussion of new features, code changes, etc." <starpu-devel.lists.gforge.inria.fr>
Hello,
I have a solver using StarPU integrated into a larger simulation code that doesn't use it. Currently, the StarPU code is interleaved with the rest of the code, without any overlap.
So StarPU spends a significant amount of time with no task to execute (because no task has been submitted after the last starpu_task_wait_for_all() and the rest of the code is doing something). The best solution would be to taskify the rest of the code, but this is not realistic in the short term.
Looking at top, it looks like StarPU is using a significant amount of CPU when doing nothing. This could be a false indication from top, but looking at this loop in _starpu_cpu_worker():
while (_starpu_machine_is_running())
_starpu_cpu_driver_run_once(&d);
It looks like the worker will spin, if _starpu_machine_is_running() doesn't block.
And since the code of _starpu_machine_is_running() is simply:
unsigned _starpu_machine_is_running(void)
{
unsigned ret;
/* running is just protected by a mbemory barrier */
STARPU_RMB();
ANNOTATE_HAPPENS_AFTER(&config.running);
ret = config.running;
ANNOTATE_HAPPENS_BEFORE(&config.running);
return ret;
}
It indeed looks like StarPU is spinning.
Would it be possible to add something like:
starpu_pause();
that would make _starpu_machine_is_running() block until a symmetric call such as
starpu_resume()
is called ?
I'm no expert in threading, but wouldn't a condition variable fulfill this role ?
void starpu_pause() {
starpu_task_wait_for_all();
// set the condition variable to "wait"
}
void starpu_resume() {
// signal the end of the waiting period.
}
I'm not asking for a patch, just trying to start a discussion. If this is deemed useful, I could produce a patch.
Thanks,
--
Benoit Lize
- [Starpu-devel] Is StarPU busy-waiting for tasks ?, Benoît Lizé, 30/10/2013
Archives gérées par MHonArc 2.6.19+.