gdbinit 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. # StarPU --- Runtime system for heterogeneous multicore architectures.
  2. #
  3. # Copyright (C) 2010-2013 Université de Bordeaux 1
  4. # Copyright (C) 2010, 2011, 2012, 2013 Centre National de la Recherche Scientifique
  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. # To set a breakpoint when starting gdb with option "-ex run",
  17. # here what you need to do:
  18. #set breakpoint pending on
  19. #break starpu_mpi.c:419
  20. define starpu-print-job
  21. set language c
  22. set $job = (struct _starpu_job *)$arg0
  23. printf "StarPU Job (%p)\n", $job
  24. if ($job != 0)
  25. printf "\ttask:\t\t\t\t<%p>\n", $job->task
  26. printf "\tsubmitted:\t\t\t<%d>\n", $job->submitted
  27. printf "\tterminated:\t\t\t<%d>\n", $job->terminated
  28. printf "\tjob_id:\t\t\t\t<%d>\n", $job->job_id
  29. if $job->task
  30. printf "\tname:\t\t\t\t<%s>\n", $job->task->name
  31. end
  32. end
  33. end
  34. document starpu-print-job
  35. Prints a StarPU job
  36. end
  37. define starpu-print-task
  38. set language c
  39. set $task = (struct starpu_task *)$arg0
  40. set $job = (struct _starpu_job *)$task->starpu_private
  41. set $status=0
  42. if $task->status == 0
  43. set $status="STARPU_TASK_INVALID"
  44. end
  45. if $task->status == 1
  46. set $status="STARPU_TASK_BLOCKED"
  47. end
  48. if $task->status == 2
  49. set $status="STARPU_TASK_READY"
  50. end
  51. if $task->status == 3
  52. set $status="STARPU_TASK_RUNNING"
  53. end
  54. if $task->status == 4
  55. set $status="STARPU_TASK_FINISHED"
  56. end
  57. if $task->status == 5
  58. set $status="STARPU_TASK_BLOCKED_ON_TAG"
  59. end
  60. if $task->status == 6
  61. set $status="STARPU_TASK_BLOCKED_ON_TASK"
  62. end
  63. if $task->status == 7
  64. set $status="STARPU_TASK_BLOCKED_ON_DATA"
  65. end
  66. printf "StarPU Task (%p)\n", $task
  67. printf "\tname:\t\t\t\t<%s>\n", $task->name
  68. printf "\tcodelet:\t\t\t<%p>\n", $task->cl
  69. printf "\tcallback:\t\t\t<%p>\n", $task->callback_func
  70. printf "\tsynchronous:\t\t\t<%d>\n", $task->synchronous
  71. printf "\texecute_on_a_specific_worker:\t<%d>\n", $task->execute_on_a_specific_worker
  72. printf "\tworkerid:\t\t\t<%d>\n", $task->workerid
  73. printf "\tdetach:\t\t\t\t<%d>\n", $task->detach
  74. printf "\tdestroy:\t\t\t<%d>\n", $task->destroy
  75. printf "\tregenerate:\t\t\t<%d>\n", $task->regenerate
  76. printf "\tstatus:\t\t\t\t<%s>\n", $status
  77. printf "\tjob:\t\t\t\t<%p>\n", $job
  78. printf "\tndeps:\t\t\t\t<%u>\n", $job->job_successors->ndeps
  79. printf "\tndeps_completed:\t\t<%u>\n", $job->job_successors->ndeps_completed
  80. printf "\tnsuccs:\t\t\t\t<%u>\n", $job->job_successors->nsuccs
  81. if $job
  82. starpu-print-job $job
  83. end
  84. end
  85. document starpu-print-task
  86. Prints a StarPU task
  87. end
  88. define starpu-tasks-on-worker
  89. set language c
  90. set $worker=config->workers[$arg0]
  91. set $task=$worker.local_tasks.head
  92. while $task != 0x0
  93. starpu-print-task $task
  94. set $task=$task->next
  95. end
  96. end
  97. define starpu-tasks-on-workers
  98. set language c
  99. set $num=0
  100. while $num<config->topology->nworkers
  101. printf "Worker %s\n", config->workers[$num].name
  102. starpu-tasks-on-worker $num
  103. set $num = $num + 1
  104. end
  105. end
  106. define starpu-workers
  107. set language c
  108. set $num=0
  109. printf "[Id] Name Arch Mask Devid Bindid Workerid Isrunning Isinitialized\n"
  110. while $num<config->topology->nworkers
  111. set $worker=&config->workers[$num]
  112. printf "[%2d] %-40s %-4d %-4d %-5d %-6d %-8d %-9d %-13d\n", $num, $worker->name, $worker->arch, $worker->worker_mask, \
  113. $worker->devid, $worker->bindid, $worker->workerid, $worker->worker_is_running, $worker->worker_is_initialized
  114. set $num = $num + 1
  115. end
  116. end
  117. document starpu-workers
  118. Prints a list of the StarPU workers
  119. end
  120. define starpu-tags
  121. printf "tags htbl %p\n", tag_htbl
  122. printf "TODO\n"
  123. end
  124. define starpu-tasks
  125. printf "%d submitted tasks\n", nsubmitted
  126. printf "%d ready tasks\n", nready
  127. printf "Tasks being run:\n"
  128. set $n = 0
  129. while $n < config.topology.nworkers
  130. set $task = config.workers[$n].current_task
  131. if ($task)
  132. printf "worker %d:\n", $n
  133. starpu-print-task $task
  134. set $j = (struct _starpu_job *) $task->starpu_private
  135. set $nsuccs = $j->job_successors.nsuccs
  136. set $i = 0
  137. while $i < $nsuccs
  138. set $cg = $j->job_successors.succ[$i]
  139. if ($cg->cg_type == 1)
  140. # STARPU_CG_APPS
  141. printf "waited for by application"
  142. end
  143. if ($cg->cg_type == 2)
  144. # STARPU_CG_TAG
  145. printf "will produce tag %x\n", $cg->succ.tag
  146. end
  147. if ($cg->cg_type == 4)
  148. # STARPU_CG_TASK
  149. printf "dep of task %p\n", $cg->succ.job
  150. starpu-print-task $cg->succ.job->task
  151. end
  152. set $i = $i + 1
  153. end
  154. end
  155. set $n = $n + 1
  156. end
  157. if (tag_htbl)
  158. printf "TODO: tags\n"
  159. end
  160. print "TODO: complete\n"
  161. end
  162. define starpu
  163. printf "Here I am...\n"
  164. end
  165. define starpu-print-mode
  166. if ($arg0 & 1)
  167. printf "R"
  168. end
  169. if ($arg0 & 2)
  170. printf "W"
  171. end
  172. if ($arg0 & 4)
  173. printf " SCRATCH"
  174. end
  175. if ($arg0 & 8)
  176. printf " REDUX"
  177. end
  178. end
  179. define starpu-print-data
  180. set language c
  181. set $data = (starpu_data_handle_t) $arg0
  182. printf "Data handle %p\n", $data
  183. printf "Home node %d\n", $data->home_node
  184. printf "RWlock refs %d\n", $data->refcnt
  185. printf "Busy count %d\n", $data->busy_count
  186. printf "Current mode "
  187. starpu-print-mode $data->current_mode
  188. printf "\n"
  189. if $data->current_mode & (4|8)
  190. set $n = 0
  191. while $n < config.topology.nworkers
  192. set $replicate = $data->per_worker[$n]
  193. printf "Worker %2d %10s:", $n, config->workers[$n]->name
  194. if $replicate.state == 0
  195. printf " OWNER"
  196. end
  197. if $replicate.state == 1
  198. printf " SHARED"
  199. end
  200. if $replicate.state == 2
  201. printf " INVALID"
  202. end
  203. if $replicate.initialized
  204. printf " initialized"
  205. end
  206. printf "\n"
  207. set $n = $n + 1
  208. end
  209. else
  210. set $n = 0
  211. while $n < descr.nnodes
  212. set $replicate = &$data->per_node[$n]
  213. printf "Node %2d (%2d):", $n, $replicate->refcnt
  214. if $replicate.state == 0
  215. printf " OWNER"
  216. end
  217. if $replicate.state == 1
  218. printf " SHARED"
  219. end
  220. if $replicate.state == 2
  221. printf " INVALID"
  222. end
  223. if $replicate.initialized
  224. printf " initialized"
  225. end
  226. printf "\n"
  227. set $n = $n + 1
  228. end
  229. end
  230. printf "Post sync tasks\n"
  231. set $tasklist = $data->post_sync_tasks
  232. while $tasklist != 0x0
  233. starpu-print-task $tasklist->task
  234. set $tasklist = $tasklist->next
  235. end
  236. printf "Requester tasks\n"
  237. set $requesterlist = $data->req_list._head
  238. while $requesterlist != 0x0
  239. printf "mode: "
  240. starpu-print-mode $requesterlist->mode
  241. printf "\n"
  242. starpu-print-job $requesterlist->j
  243. set $requesterlist = $requesterlist->_next
  244. end
  245. if ($data->nchildren)
  246. printf "%d children\n", $data->nchildren
  247. end
  248. end
  249. define starpu-print-datas
  250. set $entry = registered_handles
  251. while $entry
  252. starpu-print-data $entry->handle
  253. printf "\n"
  254. set $entry = (struct handle_entry *) $entry.hh.next
  255. end
  256. end
  257. define starpu-print-datas-summary
  258. set language c
  259. set $entry = registered_handles
  260. set $data_n = 0
  261. set $pw_data_n = 0
  262. set $data_n_allocated = 0
  263. set $replicate_n_owners = 0
  264. set $replicate_n_shared = 0
  265. set $replicate_n_invalid = 0
  266. set $replicate_n_initialized = 0
  267. set $replicate_n_allocated = 0
  268. set $pw_replicate_n_owners = 0
  269. set $pw_replicate_n_shared = 0
  270. set $pw_replicate_n_invalid = 0
  271. set $pw_replicate_n_initialized = 0
  272. set $pw_replicate_n_allocated = 0
  273. while $entry
  274. set $data = (starpu_data_handle_t) $entry->handle
  275. if $data->current_mode & (4|8)
  276. set $pw_data_n = $pw_data_n + 1
  277. set $n = 0
  278. while $n < config.topology.nworkers
  279. set $replicate = $data->per_worker[$n]
  280. if $replicate.state == 0
  281. set $pw_replicate_n_owners = $pw_replicate_n_owners + 1
  282. end
  283. if $replicate.state == 1
  284. set $pw_replicate_n_shared = $pw_replicate_n_shared + 1
  285. end
  286. if $replicate.state == 2
  287. set $pw_replicate_n_invalid = $pw_replicate_n_invalid + 1
  288. end
  289. if $replicate.initialized
  290. set $pw_replicate_n_initialized = $pw_replicate_n_initialized + 1
  291. end
  292. if $replicate.allocated
  293. set $pw_replicate_n_allocated = $pw_replicate_n_allocated + 1
  294. end
  295. set $n = $n + 1
  296. end
  297. else
  298. set $data_n = $data_n + 1
  299. set $n = 0
  300. while $n < descr.nnodes
  301. set $replicate = &$data->per_node[$n]
  302. if $replicate.state == 0
  303. set $replicate_n_owners = $replicate_n_owners + 1
  304. end
  305. if $replicate.state == 1
  306. set $replicate_n_shared = $replicate_n_shared + 1
  307. end
  308. if $replicate.state == 2
  309. set $replicate_n_invalid = $replicate_n_invalid + 1
  310. end
  311. if $replicate.initialized
  312. set $replicate_n_initialized = $replicate_n_initialized + 1
  313. end
  314. if $replicate.allocated
  315. set $replicate_n_allocated = $replicate_n_allocated + 1
  316. set $data_allocated = 1
  317. end
  318. set $n = $n + 1
  319. end
  320. if $data_allocated
  321. set $data_n_allocated = $data_n_allocated + 1
  322. end
  323. end
  324. set $entry = (struct handle_entry *) $entry.hh.next
  325. end
  326. printf "Number of handles: %d\n", $data_n
  327. printf "Number of allocated handles: %d\n", $data_n_allocated
  328. printf "Number of OWNER replicates: %d\n", $replicate_n_owners
  329. printf "Number of SHARED replicates: %d\n", $replicate_n_shared
  330. printf "Number of INVALID replicates: %d\n", $replicate_n_invalid
  331. printf "Number of initialized replicates: %d\n", $replicate_n_initialized
  332. printf "Number of allocated replicates: %d\n", $replicate_n_allocated
  333. printf "Number of per-worker handles: %d\n", $pw_data_n
  334. printf "Number of OWNER per-worker replicates: %d\n", $pw_replicate_n_owners
  335. printf "Number of SHARED per-worker replicates: %d\n", $pw_replicate_n_shared
  336. printf "Number of INVALID per-worker replicates: %d\n", $pw_replicate_n_invalid
  337. printf "Number of initialized per-worker replicates: %d\n", $pw_replicate_n_initialized
  338. printf "Number of allocated per-worker replicates: %d\n", $pw_replicate_n_allocated
  339. end
  340. define starpu-print-request
  341. set $r = (struct _starpu_data_request *)$arg0
  342. printf "Request %p\n", $r
  343. printf "Refcnt %d\n", $r->refcnt
  344. printf "Handle %p\n", $r->handle
  345. printf "src_replicate %p\n", $r->src_replicate
  346. printf "dst_replicate %p\n", $r->dst_replicate
  347. printf "handling_node %d\n", $r->handling_node
  348. if ($r->mode & 1)
  349. printf "R"
  350. end
  351. if ($r->mode & 2)
  352. printf "W"
  353. end
  354. if ($r->mode & 4)
  355. printf "S"
  356. end
  357. if ($r->mode & 8)
  358. printf "X"
  359. end
  360. printf "\n"
  361. printf "completed: %d\n", $r->completed
  362. printf "retval: %d\n", $r->retval
  363. printf "ndeps: %d\n", $r->ndeps
  364. printf "next_req_count: %d\n", $r->next_req_count
  365. end
  366. define starpu-print-requests
  367. set $node = 0
  368. while $node < descr.nnodes
  369. printf "Node %u:\n", $node
  370. set $request = data_requests[$node]._head
  371. while $request != 0
  372. printf " Request %p: handle %p ", $request, $request->handle
  373. starpu-print-mode $request->mode
  374. printf "\n"
  375. set $request = $request->_next
  376. end
  377. set $node = $node + 1
  378. end
  379. end
  380. define starpu-print-prequests
  381. set $node = 0
  382. while $node < descr.nnodes
  383. printf "Node %u:\n", $node
  384. printf "%u pending requests\n", data_requests_npending[$node]
  385. set $request = data_requests_pending[$node]._head
  386. while $request != 0
  387. printf " Request %p: handle %p ", $request, $request->handle
  388. starpu-print-mode $request->mode
  389. printf "\n"
  390. set $request = $request->_next
  391. end
  392. set $node = $node + 1
  393. end
  394. end
  395. define starpu-print-frequests
  396. set $node = 0
  397. while $node < descr.nnodes
  398. printf "Node %u:\n", $node
  399. set $request = prefetch_requests[$node]._head
  400. while $request != 0
  401. printf " Request %p: handle %p ", $request, $request->handle
  402. starpu-print-mode $request->mode
  403. printf "\n"
  404. set $request = $request->_next
  405. end
  406. set $node = $node + 1
  407. end
  408. end
  409. define starpu-memusage
  410. set scheduler-locking on
  411. set $node = 0
  412. while $node < descr.nnodes
  413. printf "Node %u:\n", $node
  414. set $total = 0
  415. set $total_b = 0
  416. set $wt = 0
  417. set $wt_b = 0
  418. set $home = 0
  419. set $home_b = 0
  420. set $redux = 0
  421. set $redux_b = 0
  422. set $relax = 0
  423. set $relax_b = 0
  424. set $noref = 0
  425. set $noref_b = 0
  426. set $nodataref = 0
  427. set $nodataref_b = 0
  428. set $nosubdataref = 0
  429. set $nosubdataref_b = 0
  430. set $mc = mc_list[$node]->_head
  431. while $mc != 0
  432. set $handle = $mc->data
  433. set $size = _starpu_data_get_size($handle)
  434. set $total = $total + 1
  435. set $total_b = $total_b + $size
  436. if $handle->wt_mask & (1 << $node)
  437. set $wt = $wt + 1
  438. set $wt_b = $wt_b + $size
  439. end
  440. if $node == $handle->home_node
  441. set $home = $home + 1
  442. set $home_b = $home_b + $size
  443. end
  444. if $mc->relaxed_coherency == 2
  445. set $redux = $redux + 1
  446. set $redux_b = $redux_b + $size
  447. end
  448. if $mc->relaxed_coherency == 1
  449. set $relax = $relax + 1
  450. set $relax_b = $relax_b + $size
  451. if $mc->replicate
  452. if $mc->replicate->refcnt == 0
  453. set $noref = $noref + 1
  454. set $noref_b = $noref_b + $size
  455. end
  456. end
  457. end
  458. if $mc->relaxed_coherency == 0
  459. if (may_free_subtree($handle,$node))
  460. set $nosubdataref = $nosubdataref + 1
  461. set $nosubdataref_b = $nosubdataref_b + $size
  462. end
  463. if $handle->per_node[$node].refcnt == 0
  464. set $nodataref = $nodataref + 1
  465. set $nodataref_b = $nodataref_b + $size
  466. end
  467. end
  468. set $mc = $mc->_next
  469. end
  470. printf " Total: %u, %u\n", $total, $total_b
  471. printf " WT: %u, %u\n", $wt, $wt_b
  472. printf " home: %u, %u\n", $home, $home_b
  473. printf " redux: %u, %u\n", $redux, $redux_b
  474. printf " relax: %u, %u\n", $relax, $relax_b
  475. printf " noref: %u, %u\n", $noref, $noref_b
  476. printf " nosubdataref: %u, %u\n", $nosubdataref, $nosubdataref_b
  477. printf " nodataref: %u, %u\n", $nodataref, $nodataref_b
  478. set $node = $node + 1
  479. end
  480. end
  481. document starpu
  482. List of StarPU-specific gdb functions:
  483. starpu-workers prints a list of the StarPU workers
  484. starpu-tasks-on-workers prints a list of the tasks currently running on workers
  485. starpu-tasks-on-worker prints a list of the tasks running on the given worker
  486. starpu-print-job prints a StarPU job
  487. starpu-print-task prints a StarPU task
  488. starpu-print-data prints a StarPU data handle
  489. starpu-print-datas prints all StarPU data handles
  490. starpu-print-datas-summary prints a summary of data handles
  491. starpu-print-request prints a StarPU data request
  492. starpu-print-requests prints all StarPU data requests
  493. starpu-print-prequests prints all pending StarPU data requests
  494. starpu-print-frequests prints all StarPU prefetch data requests
  495. starpu-tasks prints a list of the tasks flowing in StarPU
  496. starpu-tags prints a list of the tags known to StarPU
  497. starpu-memusage prints the memory node usage
  498. end