starpu_task_bundle.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010,2011,2014 Université de Bordeaux
  4. * Copyright (C) 2011,2012 Inria
  5. * Copyright (C) 2011-2013,2015,2017,2019 CNRS
  6. * Copyright (C) 2011 Télécom-SudParis
  7. *
  8. * StarPU is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU Lesser General Public License as published by
  10. * the Free Software Foundation; either version 2.1 of the License, or (at
  11. * your option) any later version.
  12. *
  13. * StarPU is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16. *
  17. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  18. */
  19. #ifndef __STARPU_TASK_BUNDLE_H__
  20. #define __STARPU_TASK_BUNDLE_H__
  21. #ifdef __cplusplus
  22. extern "C"
  23. {
  24. #endif
  25. /**
  26. @defgroup API_Task_Bundles Task Bundles
  27. @{
  28. */
  29. struct starpu_task;
  30. struct starpu_perfmodel_arch;
  31. /**
  32. Opaque structure describing a list of tasks that should be
  33. scheduled on the same worker whenever it’s possible. It must be
  34. considered as a hint given to the scheduler as there is no
  35. guarantee that they will be executed on the same worker.
  36. */
  37. typedef struct _starpu_task_bundle *starpu_task_bundle_t;
  38. /**
  39. Factory function creating and initializing \p bundle, when the call
  40. returns, memory needed is allocated and \p bundle is ready to use.
  41. */
  42. void starpu_task_bundle_create(starpu_task_bundle_t *bundle);
  43. /**
  44. Insert \p task in \p bundle. Until \p task is removed from \p
  45. bundle its expected length and data transfer time will be
  46. considered along those of the other tasks of bundle. This function
  47. must not be called if \p bundle is already closed and/or \p task is
  48. already submitted. On success, it returns 0. There are two cases of
  49. error : if \p bundle is already closed it returns <c>-EPERM</c>, if
  50. \p task was already submitted it returns <c>-EINVAL</c>.
  51. */
  52. int starpu_task_bundle_insert(starpu_task_bundle_t bundle, struct starpu_task *task);
  53. /**
  54. Remove \p task from \p bundle. Of course \p task must have been
  55. previously inserted in \p bundle. This function must not be called
  56. if \p bundle is already closed and/or \p task is already submitted.
  57. Doing so would result in undefined behaviour. On success, it
  58. returns 0. If \p bundle is already closed it returns
  59. <c>-ENOENT</c>.
  60. */
  61. int starpu_task_bundle_remove(starpu_task_bundle_t bundle, struct starpu_task *task);
  62. /**
  63. Inform the runtime that the user will not modify \p bundle anymore,
  64. it means no more inserting or removing task. Thus the runtime can
  65. destroy it when possible.
  66. */
  67. void starpu_task_bundle_close(starpu_task_bundle_t bundle);
  68. /**
  69. Return the expected duration of \p bundle in micro-seconds.
  70. */
  71. double starpu_task_bundle_expected_length(starpu_task_bundle_t bundle, struct starpu_perfmodel_arch *arch, unsigned nimpl);
  72. /**
  73. Return the time (in micro-seconds) expected to transfer all data used within \p bundle.
  74. */
  75. double starpu_task_bundle_expected_data_transfer_time(starpu_task_bundle_t bundle, unsigned memory_node);
  76. /**
  77. Return the expected energy consumption of \p bundle in J.
  78. */
  79. double starpu_task_bundle_expected_energy(starpu_task_bundle_t bundle, struct starpu_perfmodel_arch *arch, unsigned nimpl);
  80. /** @} */
  81. #ifdef __cplusplus
  82. }
  83. #endif
  84. #endif /* __STARPU_TASK_BUNDLE_H__ */