Exemplo n.º 1
0
/* The mutex associated to the calling worker is already taken by StarPU */
static struct starpu_task *pop_task_dummy(void)
{
	/* NB: In this simplistic strategy, we assume that all workers are able
	 * to execute all tasks, otherwise, it would have been necessary to go
	 * through the entire list until we find a task that is executable from
	 * the calling worker. So we just take the head of the list and give it
	 * to the worker. */
	return starpu_task_list_pop_back(&sched_list);
}
/* The mutex associated to the calling worker is already taken by StarPU */
static struct starpu_task *pop_task_dummy(unsigned sched_ctx_id)
{
	/* NB: In this simplistic strategy, we assume that all workers are able
	 * to execute all tasks, otherwise, it would have been necessary to go
	 * through the entire list until we find a task that is executable from
	 * the calling worker. So we just take the head of the list and give it
	 * to the worker. */
	struct dummy_sched_data *data = (struct dummy_sched_data*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
	starpu_pthread_mutex_lock(&data->policy_mutex);
	struct starpu_task *task = starpu_task_list_pop_back(&data->sched_list);
	starpu_pthread_mutex_unlock(&data->policy_mutex);
	return task;
}