starpu_task_list.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  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. #ifndef __STARPU_TASK_LIST_H__
  17. #define __STARPU_TASK_LIST_H__
  18. #include <starpu_task.h>
  19. #include <starpu_util.h>
  20. #ifdef __cplusplus
  21. extern "C"
  22. {
  23. #endif
  24. /**
  25. @defgroup API_Task_Lists Task Lists
  26. @{
  27. */
  28. /* NOTE: this needs to have at least the same size as lists in src/common/list.h */
  29. #ifdef BUILDING_STARPU
  30. #define STARPU_TASK_LIST_INLINE extern inline
  31. #else
  32. /**
  33. Store a double-chained list of tasks
  34. */
  35. struct starpu_task_list
  36. {
  37. struct starpu_task *head; /**< head of the list */
  38. struct starpu_task *tail; /**< tail of the list */
  39. };
  40. #define STARPU_TASK_LIST_INLINE extern
  41. #endif
  42. /**
  43. Initialize a list structure
  44. */
  45. STARPU_TASK_LIST_INLINE
  46. void starpu_task_list_init(struct starpu_task_list *list);
  47. /**
  48. Push \p task at the front of \p list
  49. */
  50. STARPU_TASK_LIST_INLINE
  51. void starpu_task_list_push_front(struct starpu_task_list *list, struct starpu_task *task);
  52. /**
  53. Push \p task at the back of \p list
  54. */
  55. STARPU_TASK_LIST_INLINE
  56. void starpu_task_list_push_back(struct starpu_task_list *list, struct starpu_task *task);
  57. /**
  58. Get the front of \p list (without removing it)
  59. */
  60. STARPU_TASK_LIST_INLINE
  61. struct starpu_task *starpu_task_list_front(const struct starpu_task_list *list);
  62. /**
  63. Get the back of \p list (without removing it)
  64. */
  65. STARPU_TASK_LIST_INLINE
  66. struct starpu_task *starpu_task_list_back(const struct starpu_task_list *list);
  67. /**
  68. Test if \p list is empty
  69. */
  70. STARPU_TASK_LIST_INLINE
  71. int starpu_task_list_empty(const struct starpu_task_list *list);
  72. /**
  73. Remove \p task from \p list
  74. */
  75. STARPU_TASK_LIST_INLINE
  76. void starpu_task_list_erase(struct starpu_task_list *list, struct starpu_task *task);
  77. /**
  78. Remove the element at the front of \p list
  79. */
  80. STARPU_TASK_LIST_INLINE
  81. struct starpu_task *starpu_task_list_pop_front(struct starpu_task_list *list);
  82. /**
  83. Remove the element at the back of \p list
  84. */
  85. STARPU_TASK_LIST_INLINE
  86. struct starpu_task *starpu_task_list_pop_back(struct starpu_task_list *list);
  87. /**
  88. Get the first task of \p list.
  89. */
  90. STARPU_TASK_LIST_INLINE
  91. struct starpu_task *starpu_task_list_begin(const struct starpu_task_list *list);
  92. /**
  93. Get the end of \p list.
  94. */
  95. STARPU_TASK_LIST_INLINE
  96. struct starpu_task *starpu_task_list_end(const struct starpu_task_list *list STARPU_ATTRIBUTE_UNUSED);
  97. /**
  98. Get the next task of \p list. This is not erase-safe.
  99. */
  100. STARPU_TASK_LIST_INLINE
  101. struct starpu_task *starpu_task_list_next(const struct starpu_task *task);
  102. /**
  103. Test whether the given task \p look is contained in the \p list.
  104. */
  105. STARPU_TASK_LIST_INLINE
  106. int starpu_task_list_ismember(const struct starpu_task_list *list, const struct starpu_task *look);
  107. STARPU_TASK_LIST_INLINE
  108. void starpu_task_list_move(struct starpu_task_list *ldst, struct starpu_task_list *lsrc);
  109. /** @} */
  110. #ifdef __cplusplus
  111. }
  112. #endif
  113. #endif /* __STARPU_TASK_LIST_H__ */