fifo_queues.h 2.9 KB

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