starpu_task_bundle.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. #ifdef __cplusplus
  21. extern "C"
  22. {
  23. #endif
  24. struct starpu_task;
  25. /* starpu_task_bundle_t
  26. * ==================
  27. * Purpose
  28. * =======
  29. * Opaque structure describing a list of tasks that should be scheduled
  30. * on the same worker whenever it's possible.
  31. * It must be considered as a hint given to the scheduler as there is no guarantee that
  32. * they will be executed on the same worker.
  33. */
  34. typedef struct _starpu_task_bundle *starpu_task_bundle_t;
  35. /* starpu_task_bundle_create
  36. * =========================
  37. * Purpose
  38. * =======
  39. * Factory function creating a bundle, when the call return,
  40. * memory needed is allocated and the bundle is ready to use.
  41. *
  42. * Arguments
  43. * =========
  44. * bundle (output)
  45. * Bundle to create and initialize.
  46. */
  47. void starpu_task_bundle_create(starpu_task_bundle_t *bundle);
  48. /* starpu_task_bundle_insert
  49. * =========================
  50. * Purpose
  51. * =======
  52. * Insert a task in a bundle. Until the task is removed from the bundle
  53. * its expected length and data transfer time will be considered along
  54. * those of the other tasks of the bundle.
  55. * This function mustn't be called if the bundle is already closed and/or
  56. * the task is already submitted.
  57. *
  58. * Return value
  59. * ============
  60. * On success, it returns 0.
  61. * There are two cases of error :
  62. * - if the bundle is already closed it returns -EPERM
  63. * - if the task was already submitted it return -EINVAL.
  64. *
  65. * Arguments
  66. * =========
  67. * bundle (input)
  68. * Bundle where to insert the task.
  69. *
  70. * task (input)
  71. * Task to insert.
  72. */
  73. int starpu_task_bundle_insert(starpu_task_bundle_t bundle, struct starpu_task *task);
  74. /* starpu_task_bundle_remove
  75. * =========================
  76. * Purpose
  77. * =======
  78. * Remove the tasks passed as argument from the bundle.
  79. * Of course the task must have been previously inserted in the bundle.
  80. * This function mustn't be called if the bundle is already closed and/or
  81. * the task is already submitted. Doing so would result in undefined behaviour.
  82. *
  83. * Return value
  84. * ============
  85. * On success, it returns 0.
  86. * If the bundle is already closed it returns -ENOENT.
  87. *
  88. * Arguments
  89. * =========
  90. * bundle (input)
  91. * Bundle containing the task.
  92. *
  93. * task (input)
  94. * The task to remove.
  95. */
  96. int starpu_task_bundle_remove(starpu_task_bundle_t bundle, struct starpu_task *task);
  97. /* starpu_task_bundle_close
  98. * =========================
  99. * Purpose
  100. * =======
  101. * Calling this functions informs the runtime that the user
  102. * won't modify the bundle anymore, it means no more
  103. * inserting or removing a task.
  104. * Thus the runtime can destroy it when needed.
  105. *
  106. * Arguments
  107. * =========
  108. * bundle (input)
  109. * Bundle to close.
  110. */
  111. void starpu_task_bundle_close(starpu_task_bundle_t bundle);
  112. #ifdef __cplusplus
  113. }
  114. #endif
  115. #endif // __STARPU_TASK_BUNDLE_H__