fifo_queues.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2013 Université de Bordeaux
  4. *
  5. * StarPU is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * StarPU is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. /* FIFO queues, ready for use by schedulers */
  17. #ifndef __FIFO_QUEUES_H__
  18. #define __FIFO_QUEUES_H__
  19. #include <starpu.h>
  20. struct _starpu_fifo_taskq
  21. {
  22. /* the actual list */
  23. struct starpu_task_list taskq;
  24. /* the number of tasks currently in the queue */
  25. unsigned ntasks;
  26. /* the number of tasks that were processed */
  27. unsigned nprocessed;
  28. /* only meaningful if the queue is only used by a single worker */
  29. double exp_start; /* Expected start date of next item to do in the
  30. * queue (i.e. not started yet). This is thus updated
  31. * when we start it. */
  32. double exp_end; /* Expected end date of last task in the queue */
  33. double exp_len; /* Expected duration of the set of tasks in the queue */
  34. };
  35. struct _starpu_fifo_taskq*_starpu_create_fifo(void);
  36. void _starpu_destroy_fifo(struct _starpu_fifo_taskq *fifo);
  37. int _starpu_fifo_empty(struct _starpu_fifo_taskq *fifo);
  38. int _starpu_fifo_push_sorted_task(struct _starpu_fifo_taskq *fifo_queue, struct starpu_task *task);
  39. int _starpu_fifo_push_task(struct _starpu_fifo_taskq *fifo, struct starpu_task *task);
  40. int _starpu_fifo_push_back_task(struct _starpu_fifo_taskq *fifo_queue, struct starpu_task *task);
  41. struct starpu_task *_starpu_fifo_pop_task(struct _starpu_fifo_taskq *fifo, int workerid);
  42. struct starpu_task *_starpu_fifo_pop_local_task(struct _starpu_fifo_taskq *fifo);
  43. struct starpu_task *_starpu_fifo_pop_every_task(struct _starpu_fifo_taskq *fifo, int workerid);
  44. #endif // __FIFO_QUEUES_H__