fifo_queues.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2013, 2016 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 currently in the queue corresponding to each priority */
  27. unsigned *ntasks_per_priority;
  28. /* the number of tasks that were processed */
  29. unsigned nprocessed;
  30. /* only meaningful if the queue is only used by a single worker */
  31. double exp_start; /* Expected start date of next item to do in the
  32. * queue (i.e. not started yet). This is thus updated
  33. * when we start it. */
  34. double exp_end; /* Expected end date of last task in the queue */
  35. double exp_len; /* Expected duration of the set of tasks in the queue */
  36. double *exp_len_per_priority; /* Expected duration of the set of tasks in the queue corresponding to each priority */
  37. };
  38. struct _starpu_fifo_taskq*_starpu_create_fifo(void) STARPU_ATTRIBUTE_MALLOC;
  39. void _starpu_destroy_fifo(struct _starpu_fifo_taskq *fifo);
  40. int _starpu_fifo_empty(struct _starpu_fifo_taskq *fifo);
  41. double _starpu_fifo_get_exp_len_prev_task_list(struct _starpu_fifo_taskq *fifo_queue, struct starpu_task *task,
  42. int workerid, int nimpl, int *fifo_ntasks);
  43. int _starpu_fifo_push_sorted_task(struct _starpu_fifo_taskq *fifo_queue, struct starpu_task *task);
  44. int _starpu_fifo_push_task(struct _starpu_fifo_taskq *fifo, struct starpu_task *task);
  45. int _starpu_fifo_push_back_task(struct _starpu_fifo_taskq *fifo_queue, struct starpu_task *task);
  46. int _starpu_fifo_pop_this_task(struct _starpu_fifo_taskq *fifo_queue, int workerid, struct starpu_task *task);
  47. struct starpu_task *_starpu_fifo_pop_task(struct _starpu_fifo_taskq *fifo, int workerid);
  48. struct starpu_task *_starpu_fifo_pop_local_task(struct _starpu_fifo_taskq *fifo);
  49. struct starpu_task *_starpu_fifo_pop_every_task(struct _starpu_fifo_taskq *fifo, int workerid);
  50. #endif // __FIFO_QUEUES_H__