starpu_task_bundle.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010, 2011 Université de Bordeaux 1
  4. * Copyright (C) 2011 Télécom-SudParis
  5. * Copyright (C) 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_BUNDLE_H__
  19. #define __STARPU_TASK_BUNDLE_H__
  20. #include <starpu_perfmodel.h>
  21. #ifdef __cplusplus
  22. extern "C"
  23. {
  24. #endif
  25. struct starpu_task;
  26. /* starpu_task_bundle_t
  27. * ==================
  28. * Purpose
  29. * =======
  30. * Opaque structure describing a list of tasks that should be scheduled
  31. * on the same worker whenever it's possible.
  32. * It must be considered as a hint given to the scheduler as there is no guarantee that
  33. * they will be executed on the same worker.
  34. */
  35. typedef struct _starpu_task_bundle *starpu_task_bundle_t;
  36. /* starpu_task_bundle_create
  37. * =========================
  38. * Purpose
  39. * =======
  40. * Factory function creating a bundle, when the call return,
  41. * memory needed is allocated and the bundle is ready to use.
  42. *
  43. * Arguments
  44. * =========
  45. * bundle (output)
  46. * Bundle to create and initialize.
  47. */
  48. void starpu_task_bundle_create(starpu_task_bundle_t *bundle);
  49. /* starpu_task_bundle_destroy
  50. * ==========================
  51. * Purpose
  52. * =======
  53. * Destroy and deinitialize a bundle,
  54. * memory previoulsy allocated is freed.
  55. *
  56. * Arguments
  57. * =========
  58. * bundle (input)
  59. * Bundle to destroy.
  60. */
  61. void starpu_task_bundle_destroy(starpu_task_bundle_t bundle);
  62. /* starpu_task_bundle_insert
  63. * =========================
  64. * Purpose
  65. * =======
  66. * Insert a task in a bundle. Until the task is removed from the bundle
  67. * its expected length and data transfer time will be considered along
  68. * those of the other tasks of the bundle.
  69. * This function mustn't be called if the bundle is already closed and/or
  70. * the task is already submitted.
  71. *
  72. * Return value
  73. * ============
  74. * On success, it returns 0.
  75. * There are two cases of error :
  76. * - if the bundle is already closed it returns -EPERM
  77. * - if the task was already submitted it return -EINVAL.
  78. *
  79. * Arguments
  80. * =========
  81. * bundle (input)
  82. * Bundle where to insert the task.
  83. *
  84. * task (input)
  85. * Task to insert.
  86. */
  87. int starpu_task_bundle_insert(starpu_task_bundle_t bundle, struct starpu_task *task);
  88. /* starpu_task_bundle_remove
  89. * =========================
  90. * Purpose
  91. * =======
  92. * Remove the tasks passed as argument from the bundle.
  93. * Of course the task must have been previously inserted in the bundle.
  94. * This function mustn't be called if the bundle is already closed and/or
  95. * the task is already submitted. Doing so would result in undefined behaviour.
  96. *
  97. * Return value
  98. * ============
  99. * On success, it returns 0.
  100. * If the bundle is already closed it returns -ENOENT.
  101. *
  102. * Arguments
  103. * =========
  104. * bundle (input)
  105. * Bundle containing the task.
  106. *
  107. * task (input)
  108. * The task to remove.
  109. */
  110. int starpu_task_bundle_remove(starpu_task_bundle_t bundle, struct starpu_task *task);
  111. /* starpu_task_bundle_close
  112. * =========================
  113. * Purpose
  114. * =======
  115. * Calling this functions informs the runtime that the user
  116. * won't modify the bundle anymore, it means no more
  117. * inserting or removing a task.
  118. * Thus the runtime can destroy it when needed.
  119. *
  120. * Arguments
  121. * =========
  122. * bundle (input)
  123. * Bundle to close.
  124. */
  125. void starpu_task_bundle_close(starpu_task_bundle_t bundle);
  126. /* Return the expected duration of the entire task bundle in µs. */
  127. double starpu_task_bundle_expected_length(starpu_task_bundle_t bundle, enum starpu_perf_archtype arch, unsigned nimpl);
  128. /* Return the time (in µs) expected to transfer all data used within the bundle */
  129. double starpu_task_bundle_expected_data_transfer_time(starpu_task_bundle_t bundle, unsigned memory_node);
  130. /* Return the expected power consumption of the entire task bundle in J. */
  131. double starpu_task_bundle_expected_power(starpu_task_bundle_t bundle, enum starpu_perf_archtype arch, unsigned nimpl);
  132. #ifdef __cplusplus
  133. }
  134. #endif
  135. #endif // __STARPU_TASK_BUNDLE_H__