load_data_interface.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2016 Inria
  4. * Copyright (C) 2017 CNRS
  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. #include <starpu.h>
  18. #ifndef __LOAD_DATA_INTERFACE_H
  19. #define __LOAD_DATA_INTERFACE_H
  20. /* interface for load_data */
  21. struct load_data_interface
  22. {
  23. /* Starting time of the execution */
  24. double start;
  25. /* Elapsed time until the start time and the time when event "launch a load
  26. * balancing phase" is triggered */
  27. double elapsed_time;
  28. /* Current submission phase, i.e how many balanced steps have already
  29. * happened so far. */
  30. int phase;
  31. /* Number of currently submitted tasks */
  32. int nsubmitted_tasks;
  33. /* Number of currently finished tasks */
  34. int nfinished_tasks;
  35. /* Task threshold to sleep the submission thread */
  36. int sleep_task_threshold;
  37. /* Task threshold to wake-up the submission thread */
  38. int wakeup_task_threshold;
  39. /* Ratio of submitted tasks to wait for completion before waking up the
  40. * submission thread */
  41. double wakeup_ratio;
  42. };
  43. void load_data_data_register(starpu_data_handle_t *handle, unsigned home_node, int sleep_task_threshold, double wakeup_ratio);
  44. int load_data_get_sleep_threshold(starpu_data_handle_t handle);
  45. int load_data_get_wakeup_threshold(starpu_data_handle_t handle);
  46. int load_data_get_current_phase(starpu_data_handle_t handle);
  47. int load_data_get_nsubmitted_tasks(starpu_data_handle_t handle);
  48. int load_data_get_nfinished_tasks(starpu_data_handle_t handle);
  49. int load_data_inc_nsubmitted_tasks(starpu_data_handle_t handle);
  50. int load_data_inc_nfinished_tasks(starpu_data_handle_t handle);
  51. int load_data_next_phase(starpu_data_handle_t handle);
  52. int load_data_update_elapsed_time(starpu_data_handle_t handle);
  53. double load_data_get_elapsed_time(starpu_data_handle_t handle);
  54. int load_data_update_wakeup_cond(starpu_data_handle_t handle);
  55. int load_data_wakeup_cond(starpu_data_handle_t handle);
  56. #define LOAD_DATA_GET_NSUBMITTED_TASKS(interface) (((struct load_data_interface *)(interface))->nsubmitted_tasks)
  57. #define LOAD_DATA_GET_SLEEP_THRESHOLD(interface) (((struct load_data_interface *)(interface))->sleep_task_threshold)
  58. #define LOAD_DATA_GET_WAKEUP_THRESHOLD(interface) (((struct load_data_interface *)(interface))->wakeup_task_threshold)
  59. #endif /* __LOAD_DATA_INTERFACE_H */