starpu_task_bundle.h 2.7 KB

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