starpu_task_bundle.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. /* Initialize a task bundle */
  37. void starpu_task_bundle_init(starpu_task_bundle_t *bundle);
  38. /* Deinitialize a bundle. In case the destroy flag is set, the bundle structure
  39. * is freed too. */
  40. void starpu_task_bundle_deinit(starpu_task_bundle_t bundle);
  41. /* Insert a task into a bundle. */
  42. int starpu_task_bundle_insert(starpu_task_bundle_t bundle, struct starpu_task *task);
  43. /* Remove a task from a bundle. This method must be called with bundle->mutex
  44. * hold. This function returns 0 if the task was found, -ENOENT if the element
  45. * was not found, 1 if the element is found and if the list was deinitialized
  46. * because it became empty. */
  47. int starpu_task_bundle_remove(starpu_task_bundle_t bundle, struct starpu_task *task);
  48. /* Close a bundle. No task can be added to a closed bundle. A closed bundle
  49. * automatically gets deinitialized when it becomes empty. */
  50. void starpu_task_bundle_close(starpu_task_bundle_t bundle);
  51. /* Return the expected duration of the entire task bundle in µs. */
  52. double starpu_task_bundle_expected_length(starpu_task_bundle_t bundle, enum starpu_perf_archtype arch, unsigned nimpl);
  53. /* Return the time (in µs) expected to transfer all data used within the bundle */
  54. double starpu_task_bundle_expected_data_transfer_time(starpu_task_bundle_t bundle, unsigned memory_node);
  55. /* Return the expected power consumption of the entire task bundle in J. */
  56. double starpu_task_bundle_expected_power(starpu_task_bundle_t bundle, enum starpu_perf_archtype arch, unsigned nimpl);
  57. #ifdef __cplusplus
  58. }
  59. #endif
  60. #endif // __STARPU_TASK_BUNDLE_H__