starpu_task_bundle.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. * Copyright (C) 2011 Télécom-SudParis
  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. #ifndef __STARPU_TASK_BUNDLE_H__
  18. #define __STARPU_TASK_BUNDLE_H__
  19. #ifdef __cplusplus
  20. extern "C"
  21. {
  22. #endif
  23. /**
  24. @defgroup API_Task_Bundles Task Bundles
  25. @{
  26. */
  27. struct starpu_task;
  28. struct starpu_perfmodel_arch;
  29. /**
  30. Opaque structure describing a list of tasks that should be
  31. scheduled on the same worker whenever it’s possible. It must be
  32. considered as a hint given to the scheduler as there is no
  33. guarantee that they will be executed on the same worker.
  34. */
  35. typedef struct _starpu_task_bundle *starpu_task_bundle_t;
  36. /**
  37. Factory function creating and initializing \p bundle, when the call
  38. returns, memory needed is allocated and \p bundle is ready to use.
  39. */
  40. void starpu_task_bundle_create(starpu_task_bundle_t *bundle);
  41. /**
  42. Insert \p task in \p bundle. Until \p task is removed from \p
  43. bundle its expected length and data transfer time will be
  44. considered along those of the other tasks of bundle. This function
  45. must not be called if \p bundle is already closed and/or \p task is
  46. already submitted. On success, it returns 0. There are two cases of
  47. error : if \p bundle is already closed it returns <c>-EPERM</c>, if
  48. \p task was already submitted it returns <c>-EINVAL</c>.
  49. */
  50. int starpu_task_bundle_insert(starpu_task_bundle_t bundle, struct starpu_task *task);
  51. /**
  52. Remove \p task from \p bundle. Of course \p task must have been
  53. previously inserted in \p bundle. This function must not be called
  54. if \p bundle is already closed and/or \p task is already submitted.
  55. Doing so would result in undefined behaviour. On success, it
  56. returns 0. If \p bundle is already closed it returns
  57. <c>-ENOENT</c>.
  58. */
  59. int starpu_task_bundle_remove(starpu_task_bundle_t bundle, struct starpu_task *task);
  60. /**
  61. Inform the runtime that the user will not modify \p bundle anymore,
  62. it means no more inserting or removing task. Thus the runtime can
  63. destroy it when possible.
  64. */
  65. void starpu_task_bundle_close(starpu_task_bundle_t bundle);
  66. /**
  67. Return the expected duration of \p bundle in micro-seconds.
  68. */
  69. double starpu_task_bundle_expected_length(starpu_task_bundle_t bundle, struct starpu_perfmodel_arch *arch, unsigned nimpl);
  70. /**
  71. Return the time (in micro-seconds) expected to transfer all data used within \p bundle.
  72. */
  73. double starpu_task_bundle_expected_data_transfer_time(starpu_task_bundle_t bundle, unsigned memory_node);
  74. /**
  75. Return the expected energy consumption of \p bundle in J.
  76. */
  77. double starpu_task_bundle_expected_energy(starpu_task_bundle_t bundle, struct starpu_perfmodel_arch *arch, unsigned nimpl);
  78. /** @} */
  79. #ifdef __cplusplus
  80. }
  81. #endif
  82. #endif /* __STARPU_TASK_BUNDLE_H__ */