gdbinit 15 KB

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