starpu_paje.c 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2013 Université de Bordeaux 1
  4. *
  5. * StarPU is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * StarPU is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. #include "starpu_fxt.h"
  17. #include <common/config.h>
  18. #ifdef STARPU_HAVE_POTI
  19. #include <poti.h>
  20. #endif
  21. #ifdef STARPU_USE_FXT
  22. void _starpu_fxt_write_paje_header(FILE *file)
  23. {
  24. unsigned i;
  25. #ifdef STARPU_HAVE_POTI
  26. poti_header(1, 1); /* 1 as parameter means basic, no extended events */
  27. #else
  28. fprintf(file, "%%EventDef PajeDefineContainerType 1\n");
  29. fprintf(file, "%% Alias string\n");
  30. fprintf(file, "%% ContainerType string\n");
  31. fprintf(file, "%% Name string\n");
  32. fprintf(file, "%%EndEventDef\n");
  33. fprintf(file, "%%EventDef PajeDefineEventType 2\n");
  34. fprintf(file, "%% Alias string\n");
  35. fprintf(file, "%% ContainerType string\n");
  36. fprintf(file, "%% Name string\n");
  37. fprintf(file, "%%EndEventDef\n");
  38. fprintf(file, "%%EventDef PajeDefineStateType 3\n");
  39. fprintf(file, "%% Alias string\n");
  40. fprintf(file, "%% ContainerType string\n");
  41. fprintf(file, "%% Name string\n");
  42. fprintf(file, "%%EndEventDef\n");
  43. fprintf(file, "%%EventDef PajeDefineVariableType 4\n");
  44. fprintf(file, "%% Alias string\n");
  45. fprintf(file, "%% ContainerType string\n");
  46. fprintf(file, "%% Name string\n");
  47. fprintf(file, "%%EndEventDef\n");
  48. fprintf(file, "%%EventDef PajeDefineLinkType 5\n");
  49. fprintf(file, "%% Alias string\n");
  50. fprintf(file, "%% ContainerType string\n");
  51. fprintf(file, "%% SourceContainerType string\n");
  52. fprintf(file, "%% DestContainerType string\n");
  53. fprintf(file, "%% Name string\n");
  54. fprintf(file, "%%EndEventDef\n");
  55. fprintf(file, "%%EventDef PajeDefineEntityValue 6\n");
  56. fprintf(file, "%% Alias string\n");
  57. fprintf(file, "%% EntityType string\n");
  58. fprintf(file, "%% Name string\n");
  59. fprintf(file, "%% Color color\n");
  60. fprintf(file, "%%EndEventDef\n");
  61. fprintf(file, "%%EventDef PajeCreateContainer 7\n");
  62. fprintf(file, "%% Time date\n");
  63. fprintf(file, "%% Alias string\n");
  64. fprintf(file, "%% Type string\n");
  65. fprintf(file, "%% Container string\n");
  66. fprintf(file, "%% Name string\n");
  67. fprintf(file, "%%EndEventDef\n");
  68. fprintf(file, "%%EventDef PajeDestroyContainer 8\n");
  69. fprintf(file, "%% Time date\n");
  70. fprintf(file, "%% Name string\n");
  71. fprintf(file, "%% Type string\n");
  72. fprintf(file, "%%EndEventDef\n");
  73. fprintf(file, "%%EventDef PajeNewEvent 9\n");
  74. fprintf(file, "%% Time date\n");
  75. fprintf(file, "%% Type string\n");
  76. fprintf(file, "%% Container string\n");
  77. fprintf(file, "%% Value string\n");
  78. fprintf(file, "%%EndEventDef\n");
  79. fprintf(file, "%%EventDef PajeSetState 10\n");
  80. fprintf(file, "%% Time date\n");
  81. fprintf(file, "%% Container string\n");
  82. fprintf(file, "%% Type string\n");
  83. fprintf(file, "%% Value string\n");
  84. fprintf(file, "%%EndEventDef\n");
  85. fprintf(file, "%%EventDef PajePushState 11\n");
  86. fprintf(file, "%% Time date\n");
  87. fprintf(file, "%% Type string\n");
  88. fprintf(file, "%% Container string\n");
  89. fprintf(file, "%% Value string\n");
  90. fprintf(file, "%%EndEventDef\n");
  91. fprintf(file, "%%EventDef PajePopState 12\n");
  92. fprintf(file, "%% Time date\n");
  93. fprintf(file, "%% Type string\n");
  94. fprintf(file, "%% Container string\n");
  95. fprintf(file, "%%EndEventDef\n");
  96. fprintf(file, "%%EventDef PajeSetVariable 13\n");
  97. fprintf(file, "%% Time date\n");
  98. fprintf(file, "%% Container string\n");
  99. fprintf(file, "%% Type string\n");
  100. fprintf(file, "%% Value double\n");
  101. fprintf(file, "%%EndEventDef\n");
  102. fprintf(file, "%%EventDef PajeAddVariable 14\n");
  103. fprintf(file, "%% Time date\n");
  104. fprintf(file, "%% Type string\n");
  105. fprintf(file, "%% Container string\n");
  106. fprintf(file, "%% Value double\n");
  107. fprintf(file, "%%EndEventDef\n");
  108. fprintf(file, "%%EventDef PajeSubVariable 15\n");
  109. fprintf(file, "%% Time date\n");
  110. fprintf(file, "%% Type string\n");
  111. fprintf(file, "%% Container string\n");
  112. fprintf(file, "%% Value double\n");
  113. fprintf(file, "%%EndEventDef\n");
  114. fprintf(file, "%%EventDef PajeStartLink 18\n");
  115. fprintf(file, "%% Time date\n");
  116. fprintf(file, "%% Type string\n");
  117. fprintf(file, "%% Container string\n");
  118. fprintf(file, "%% Value string\n");
  119. fprintf(file, "%% SourceContainer string\n");
  120. fprintf(file, "%% Key string\n");
  121. fprintf(file, "%%EndEventDef\n");
  122. fprintf(file, "%%EventDef PajeEndLink 19\n");
  123. fprintf(file, "%% Time date\n");
  124. fprintf(file, "%% Type string\n");
  125. fprintf(file, "%% Container string\n");
  126. fprintf(file, "%% Value string\n");
  127. fprintf(file, "%% DestContainer string\n");
  128. fprintf(file, "%% Key string\n");
  129. fprintf(file, "%%EndEventDef\n");
  130. #endif
  131. #ifdef STARPU_HAVE_POTI
  132. poti_DefineContainerType("MPIP", "0", "MPI Program");
  133. poti_DefineContainerType("P", "MPIP", "Program");
  134. poti_DefineContainerType("Mn", "P", "Memory Node");
  135. poti_DefineContainerType("T", "Mn", "Thread");
  136. poti_DefineContainerType("Mm", "Mn", "Memory Manager");
  137. poti_DefineContainerType("W", "T", "Worker");
  138. poti_DefineContainerType("MPICt", "T", "MPI Communication Thread");
  139. poti_DefineContainerType("Sc", "P", "Scheduler");
  140. /* Types for the memory node */
  141. poti_DefineVariableType("bw", "Mm", "Bandwidth", "0 0 0");
  142. poti_DefineStateType("MS", "Mm", "Memory Node State");
  143. poti_DefineEntityValue("A", "MS", "Allocating", ".4 .1 .0");
  144. poti_DefineEntityValue("Ar", "MS", "AllocatingReuse", ".1 .1 .8");
  145. poti_DefineEntityValue("R", "MS", "Reclaiming", ".0 .1 .4");
  146. poti_DefineEntityValue("Co", "MS", "DriverCopy", ".3 .5 .1");
  147. poti_DefineEntityValue("CoA", "MS", "DriverCopyAsync", ".1 .3 .1");
  148. poti_DefineEntityValue("No", "MS", "Nothing", ".0 .0 .0");
  149. /* Types for the Worker of the Memory Node */
  150. poti_DefineEventType("event", "T", "event type");
  151. poti_DefineStateType("S", "T", "Thread State");
  152. poti_DefineEntityValue("I", "S", "Initializing", "0.0 .7 1.0");
  153. poti_DefineEntityValue("D", "S", "Deinitializing", "0.0 .1 .7");
  154. poti_DefineEntityValue("Fi", "S", "FetchingInput", "1.0 .1 1.0");
  155. poti_DefineEntityValue("Po", "S", "PushingOutput", "0.1 1.0 1.0");
  156. poti_DefineEntityValue("C", "S", "Callback", ".0 .3 .8");
  157. poti_DefineEntityValue("B", "S", "Overhead", ".5 .18 .0");
  158. poti_DefineEntityValue("Sl", "S", "Sleeping", ".9 .1 .0");
  159. poti_DefineEntityValue("P", "S", "Progressing", ".4 .1 .6");
  160. /* Types for the MPI Communication Thread of the Memory Node */
  161. poti_DefineEventType("MPIev", "MPICt", "MPI event type");
  162. poti_DefineStateType("CtS", "MPICt", "Communication Thread State");
  163. poti_DefineEntityValue("P", "CtS", "Processing", "0 0 0");
  164. poti_DefineEntityValue("Sl", "CtS", "Sleeping", ".9 .1 .0");
  165. poti_DefineEntityValue("UT", "CtS", "UserTesting", ".2 .1 .6");
  166. poti_DefineEntityValue("UW", "CtS", "UserWaiting", ".4 .1 .3");
  167. poti_DefineEntityValue("SdS", "CtS", "SendSubmitted", "1.0 .1 1.0");
  168. poti_DefineEntityValue("RvS", "CtS", "RecieveSubmitted", "0.1 1.0 1.0");
  169. poti_DefineEntityValue("SdC", "CtS", "SendCompleted", "1.0 .5 1.0");
  170. poti_DefineEntityValue("RvC", "CtS", "RecieveCompleted", "0.5 1.0 1.0");
  171. for (i=1; i<=10; i++)
  172. {
  173. char inctx[8];
  174. snprintf(inctx, sizeof(inctx), "InCtx%u", i);
  175. char *ctx = inctx+2;
  176. poti_DefineStateType(ctx, "T", inctx);
  177. poti_DefineEntityValue("I", ctx, "Initializing", "0.0 .7 1.0");
  178. poti_DefineEntityValue("D", ctx, "Deinitializing", "0.0 .1 .7");
  179. poti_DefineEntityValue("Fi", ctx, "FetchingInput", "1.0 .1 1.0");
  180. poti_DefineEntityValue("Po", ctx, "PushingOutput", "0.1 1.0 1.0");
  181. poti_DefineEntityValue("C", ctx, "Callback", ".0 .3 .8");
  182. poti_DefineEntityValue("B", ctx, "Overhead", ".5 .18 .0");
  183. poti_DefineEntityValue("Sl", ctx, "Sleeping", ".9 .1 .0");
  184. poti_DefineEntityValue("P", ctx, "Progressing", ".4 .1 .6");
  185. }
  186. /* Types for the Scheduler */
  187. poti_DefineVariableType("ntask", "Sc", "Number of tasks", "0 0 0");
  188. /* Link types */
  189. poti_DefineLinkType("MPIL", "P", "MPICt", "MPICt", "Links between two MPI Communication Threads");
  190. poti_DefineLinkType("L", "P", "Mm", "Mm", "Links between two Memory Managers");
  191. /* Creating the MPI Program */
  192. poti_CreateContainer(0, "MPIroot", "MPIP", "0", "root");
  193. #else
  194. fprintf(file, " \n\
  195. 1 MPIP 0 \"MPI Program\" \n\
  196. 1 P MPIP \"Program\" \n\
  197. 1 Mn P \"Memory Node\" \n\
  198. 1 T Mn \"Thread\" \n\
  199. 1 Mm Mn \"Memory Manager\" \n\
  200. 1 W T \"Worker\" \n\
  201. 1 MPICt T \"MPI Communication Thread\" \n\
  202. 1 Sc P \"Scheduler State\" \n\
  203. 2 event T \"event type\" \n\
  204. 2 MPIev MPICt \"MPI event type\" \n\
  205. 3 S T \"Thread State\" \n\
  206. 3 CtS MPICt \"Communication Thread State\" \n");
  207. for (i=1; i<=10; i++)
  208. fprintf(file, "3 Ctx%u T \"InCtx%u\" \n", i, i);
  209. fprintf(file, "\
  210. 3 MS Mm \"Memory Node State\" \n\
  211. 4 ntask Sc \"Number of tasks\" \n\
  212. 4 bw Mm \"Bandwidth\" \n\
  213. 6 I S Initializing \"0.0 .7 1.0\" \n\
  214. 6 D S Deinitializing \"0.0 .1 .7\" \n\
  215. 6 Fi S FetchingInput \"1.0 .1 1.0\" \n\
  216. 6 Po S PushingOutput \"0.1 1.0 1.0\" \n\
  217. 6 C S Callback \".0 .3 .8\" \n\
  218. 6 B S Overhead \".5 .18 .0\" \n\
  219. 6 Sl S Sleeping \".9 .1 .0\" \n\
  220. 6 P S Progressing \".4 .1 .6\" \n");
  221. fprintf(file, "\
  222. 6 P CtS Processing \"0 0 0\" \n\
  223. 6 Sl CtS Sleeping \".9 .1 .0\" \n\
  224. 6 UT CtS UserTesting \".2 .1 .6\" \n\
  225. 6 UW CtS UserWaiting \".4 .1 .3\" \n\
  226. 6 SdS CtS SendSubmitted \"1.0 .1 1.0\" \n\
  227. 6 RvS CtS RecieveSubmitted \"0.1 1.0 1.0\" \n\
  228. 6 SdC CtS SendCompleted \"1.0 .5 1.0\" \n\
  229. 6 RvC CtS RecieveCompleted \"0.5 1.0 1.0\" \n");
  230. for (i=1; i<=10; i++)
  231. fprintf(file, "\
  232. 6 I Ctx%u Initializing \"0.0 .7 1.0\" \n\
  233. 6 D Ctx%u Deinitializing \"0.0 .1 .7\" \n\
  234. 6 Fi Ctx%u FetchingInput \"1.0 .1 1.0\" \n\
  235. 6 Po Ctx%u PushingOutput \"0.1 1.0 1.0\" \n\
  236. 6 C Ctx%u Callback \".0 .3 .8\" \n\
  237. 6 B Ctx%u Overhead \".5 .18 .0\" \n\
  238. 6 Sl Ctx%u Sleeping \".9 .1 .0\" \n\
  239. 6 P Ctx%u Progressing \".4 .1 .6\" \n",
  240. i, i, i, i, i, i, i, i);
  241. fprintf(file, "\
  242. 6 A MS Allocating \".4 .1 .0\" \n\
  243. 6 Ar MS AllocatingReuse \".1 .1 .8\" \n\
  244. 6 R MS Reclaiming \".0 .1 .4\" \n\
  245. 6 Co MS DriverCopy \".3 .5 .1\" \n\
  246. 6 CoA MS DriverCopyAsync \".1 .3 .1\" \n\
  247. 6 No MS Nothing \".0 .0 .0\" \n\
  248. 5 MPIL P MPICt MPICt MPIL \n\
  249. 5 L P Mm Mm L\n");
  250. fprintf(file, "7 0.0 MPIroot MPIP 0 root\n");
  251. #endif
  252. }
  253. #endif