fifo_queues.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. double pipeline_len; /* the expected the length of the pipelined tasks */
  38. int pipelined_tasks; /* the expected no of pipelined tasks */
  39. };
  40. struct _starpu_fifo_taskq*_starpu_create_fifo(void) STARPU_ATTRIBUTE_MALLOC;
  41. void _starpu_destroy_fifo(struct _starpu_fifo_taskq *fifo);
  42. int _starpu_fifo_empty(struct _starpu_fifo_taskq *fifo);
  43. double _starpu_fifo_get_exp_len_prev_task_list(struct _starpu_fifo_taskq *fifo_queue, struct starpu_task *task,
  44. int workerid, int nimpl, int *fifo_ntasks);
  45. int _starpu_fifo_push_sorted_task(struct _starpu_fifo_taskq *fifo_queue, struct starpu_task *task);
  46. int _starpu_fifo_push_task(struct _starpu_fifo_taskq *fifo, struct starpu_task *task);
  47. int _starpu_fifo_push_back_task(struct _starpu_fifo_taskq *fifo_queue, struct starpu_task *task);
  48. int _starpu_fifo_pop_this_task(struct _starpu_fifo_taskq *fifo_queue, int workerid, struct starpu_task *task);
  49. struct starpu_task *_starpu_fifo_pop_task(struct _starpu_fifo_taskq *fifo, int workerid);
  50. struct starpu_task *_starpu_fifo_pop_local_task(struct _starpu_fifo_taskq *fifo);
  51. struct starpu_task *_starpu_fifo_pop_every_task(struct _starpu_fifo_taskq *fifo, int workerid);
  52. #endif // __FIFO_QUEUES_H__