starpu_fxt.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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) 2013 Joris Pablo
  5. * Copyright (C) 2013 Thibaut Lambert
  6. * Copyright (C) 2020 Federal University of Rio Grande do Sul (UFRGS)
  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_FXT_H__
  20. #define __STARPU_FXT_H__
  21. #include <starpu_config.h>
  22. #include <starpu_perfmodel.h>
  23. #ifdef __cplusplus
  24. extern "C"
  25. {
  26. #endif
  27. /**
  28. @defgroup API_FxT_Support FxT Support
  29. @{
  30. */
  31. struct starpu_fxt_codelet_event
  32. {
  33. char symbol[2048];
  34. int workerid;
  35. char perfmodel_archname[256];
  36. uint32_t hash;
  37. size_t size;
  38. float time;
  39. };
  40. struct starpu_fxt_options
  41. {
  42. unsigned per_task_colour;
  43. unsigned no_events;
  44. unsigned no_counter;
  45. unsigned no_bus;
  46. unsigned no_flops;
  47. unsigned ninputfiles;
  48. unsigned no_smooth;
  49. unsigned no_acquire;
  50. unsigned memory_states;
  51. unsigned internal;
  52. unsigned label_deps;
  53. char *filenames[STARPU_FXT_MAX_FILES];
  54. char *out_paje_path;
  55. char *distrib_time_path;
  56. char *activity_path;
  57. char *sched_tasks_path;
  58. char *dag_path;
  59. char *tasks_path;
  60. char *data_path;
  61. char *papi_path;
  62. char *comms_path;
  63. char *number_events_path;
  64. char *anim_path;
  65. char *states_path;
  66. char *dir;
  67. char worker_names[STARPU_NMAXWORKERS][256];
  68. int nworkers;
  69. struct starpu_perfmodel_arch worker_archtypes[STARPU_NMAXWORKERS];
  70. /**
  71. In case we are going to gather multiple traces (e.g in the case of
  72. MPI processes), we may need to prefix the name of the containers.
  73. */
  74. char *file_prefix;
  75. /**
  76. In case we are going to gather multiple traces (e.g in the case of
  77. MPI processes), this variable stores the time offset with the rank 0.
  78. */
  79. uint64_t file_offset;
  80. /**
  81. In case we are going to gather multiple traces (e.g in the case of
  82. MPI processes), this variable stores the MPI rank of the trace file.
  83. */
  84. int file_rank;
  85. /**
  86. In case we want to dump the list of codelets to an external tool
  87. */
  88. struct starpu_fxt_codelet_event **dumped_codelets;
  89. /**
  90. In case we want to dump the list of codelets to an external tool, number
  91. of dumped codelets.
  92. */
  93. long dumped_codelets_count;
  94. };
  95. void starpu_fxt_options_init(struct starpu_fxt_options *options);
  96. void starpu_fxt_options_shutdown(struct starpu_fxt_options *options);
  97. void starpu_fxt_generate_trace(struct starpu_fxt_options *options);
  98. /**
  99. Determine whether profiling should be started by starpu_init(), or only when
  100. starpu_fxt_start_profiling() is called. \p autostart should be 1 to do so, or 0 to
  101. prevent it.
  102. */
  103. void starpu_fxt_autostart_profiling(int autostart);
  104. /**
  105. Start recording the trace. The trace is by default started from
  106. starpu_init() call, but can be paused by using
  107. starpu_fxt_stop_profiling(), in which case
  108. starpu_fxt_start_profiling() should be called to resume recording
  109. events.
  110. */
  111. void starpu_fxt_start_profiling(void);
  112. /**
  113. Stop recording the trace. The trace is by default stopped when calling
  114. starpu_shutdown(). starpu_fxt_stop_profiling() can however be used to
  115. stop it earlier. starpu_fxt_start_profiling() can then be called to
  116. start recording it again, etc.
  117. */
  118. void starpu_fxt_stop_profiling(void);
  119. void starpu_fxt_write_data_trace(char *filename_in);
  120. void starpu_fxt_write_data_trace_in_dir(char *filename_in, char *dir);
  121. /**
  122. Wrapper to get value of env variable STARPU_FXT_TRACE
  123. */
  124. int starpu_fxt_is_enabled(void);
  125. /**
  126. Add an event in the execution trace if FxT is enabled.
  127. */
  128. void starpu_fxt_trace_user_event(unsigned long code);
  129. /**
  130. Add a string event in the execution trace if FxT is enabled.
  131. */
  132. void starpu_fxt_trace_user_event_string(const char *s);
  133. /** @} */
  134. #ifdef __cplusplus
  135. }
  136. #endif
  137. #endif /* __STARPU_FXT_H__ */