fifo_queues.h 3.2 KB

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