starpu_task_list.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2012,2014,2016,2017 Université de Bordeaux
  4. * Copyright (C) 2011-2014,2017,2018,2019 CNRS
  5. * Copyright (C) 2011,2012 Inria
  6. *
  7. * StarPU is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation; either version 2.1 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * StarPU is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. *
  16. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. */
  18. #ifndef __STARPU_TASK_LIST_H__
  19. #define __STARPU_TASK_LIST_H__
  20. #include <starpu_task.h>
  21. #include <starpu_util.h>
  22. #ifdef __cplusplus
  23. extern "C"
  24. {
  25. #endif
  26. /**
  27. @defgroup API_Task_Lists Task Lists
  28. @{
  29. */
  30. /* NOTE: this needs to have at least the same size as lists in src/common/list.h */
  31. #ifdef BUILDING_STARPU
  32. #define STARPU_TASK_LIST_INLINE extern inline
  33. #else
  34. /**
  35. Store a double-chained list of tasks
  36. */
  37. struct starpu_task_list
  38. {
  39. struct starpu_task *head; /**< head of the list */
  40. struct starpu_task *tail; /**< tail of the list */
  41. };
  42. #define STARPU_TASK_LIST_INLINE extern
  43. #endif
  44. /**
  45. Initialize a list structure
  46. */
  47. STARPU_TASK_LIST_INLINE
  48. void starpu_task_list_init(struct starpu_task_list *list);
  49. /**
  50. Push \p task at the front of \p list
  51. */
  52. STARPU_TASK_LIST_INLINE
  53. void starpu_task_list_push_front(struct starpu_task_list *list, struct starpu_task *task);
  54. /**
  55. Push \p task at the back of \p list
  56. */
  57. STARPU_TASK_LIST_INLINE
  58. void starpu_task_list_push_back(struct starpu_task_list *list, struct starpu_task *task);
  59. /**
  60. Get the front of \p list (without removing it)
  61. */
  62. STARPU_TASK_LIST_INLINE
  63. struct starpu_task *starpu_task_list_front(const struct starpu_task_list *list);
  64. /**
  65. Get the back of \p list (without removing it)
  66. */
  67. STARPU_TASK_LIST_INLINE
  68. struct starpu_task *starpu_task_list_back(const struct starpu_task_list *list);
  69. /**
  70. Test if \p list is empty
  71. */
  72. STARPU_TASK_LIST_INLINE
  73. int starpu_task_list_empty(const struct starpu_task_list *list);
  74. /**
  75. Remove \p task from \p list
  76. */
  77. STARPU_TASK_LIST_INLINE
  78. void starpu_task_list_erase(struct starpu_task_list *list, struct starpu_task *task);
  79. /**
  80. Remove the element at the front of \p list
  81. */
  82. STARPU_TASK_LIST_INLINE
  83. struct starpu_task *starpu_task_list_pop_front(struct starpu_task_list *list);
  84. /**
  85. Remove the element at the back of \p list
  86. */
  87. STARPU_TASK_LIST_INLINE
  88. struct starpu_task *starpu_task_list_pop_back(struct starpu_task_list *list);
  89. /**
  90. Get the first task of \p list.
  91. */
  92. STARPU_TASK_LIST_INLINE
  93. struct starpu_task *starpu_task_list_begin(const struct starpu_task_list *list);
  94. /**
  95. Get the end of \p list.
  96. */
  97. STARPU_TASK_LIST_INLINE
  98. struct starpu_task *starpu_task_list_end(const struct starpu_task_list *list STARPU_ATTRIBUTE_UNUSED);
  99. /**
  100. Get the next task of \p list. This is not erase-safe.
  101. */
  102. STARPU_TASK_LIST_INLINE
  103. struct starpu_task *starpu_task_list_next(const struct starpu_task *task);
  104. /**
  105. Test whether the given task \p look is contained in the \p list.
  106. */
  107. STARPU_TASK_LIST_INLINE
  108. int starpu_task_list_ismember(const struct starpu_task_list *list, const struct starpu_task *look);
  109. STARPU_TASK_LIST_INLINE
  110. void starpu_task_list_move(struct starpu_task_list *ldst, struct starpu_task_list *lsrc);
  111. /** @} */
  112. #ifdef __cplusplus
  113. }
  114. #endif
  115. #endif /* __STARPU_TASK_LIST_H__ */