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 _starpu_use_fxt == 1
  30. if $job->model_name
  31. printf "\tmodel_name:\t\t\t<%s>\n", $job->model_name
  32. end
  33. end
  34. end
  35. end
  36. document starpu-print-job
  37. Prints a StarPU job
  38. end
  39. define starpu-print-task
  40. set language c
  41. set $task = (struct starpu_task *)$arg0
  42. set $job = (struct _starpu_job *)$task->starpu_private
  43. set $status=0
  44. if $task->status == 0
  45. set $status="STARPU_TASK_INVALID"
  46. end
  47. if $task->status == 1
  48. set $status="STARPU_TASK_BLOCKED"
  49. end
  50. if $task->status == 2
  51. set $status="STARPU_TASK_READY"
  52. end
  53. if $task->status == 3
  54. set $status="STARPU_TASK_RUNNING"
  55. end
  56. if $task->status == 4
  57. set $status="STARPU_TASK_FINISHED"
  58. end
  59. if $task->status == 5
  60. set $status="STARPU_TASK_BLOCKED_ON_TAG"
  61. end
  62. if $task->status == 6
  63. set $status="STARPU_TASK_BLOCKED_ON_TASK"
  64. end
  65. if $task->status == 7
  66. set $status="STARPU_TASK_BLOCKED_ON_DATA"
  67. end
  68. printf "StarPU Task (%p)\n", $task
  69. printf "\tcodelet:\t\t\t<%p>\n", $task->cl
  70. printf "\tcallback:\t\t\t<%p>\n", $task->callback_func
  71. printf "\tsynchronous:\t\t\t<%d>\n", $task->synchronous
  72. printf "\texecute_on_a_specific_worker:\t<%d>\n", $task->execute_on_a_specific_worker
  73. printf "\tworkerid:\t\t\t<%d>\n", $task->workerid
  74. printf "\tdetach:\t\t\t\t<%d>\n", $task->detach
  75. printf "\tdestroy:\t\t\t<%d>\n", $task->destroy
  76. printf "\tregenerate:\t\t\t<%d>\n", $task->regenerate
  77. printf "\tstatus:\t\t\t\t<%s>\n", $status
  78. printf "\tjob:\t\t\t\t<%p>\n", $job
  79. printf "\tndeps:\t\t\t\t<%u>\n", $job->job_successors->ndeps
  80. printf "\tndeps_completed:\t\t<%u>\n", $job->job_successors->ndeps_completed
  81. printf "\tnsuccs:\t\t\t\t<%u>\n", $job->job_successors->nsuccs
  82. if $job
  83. starpu-print-job $job
  84. end
  85. end
  86. document starpu-print-task
  87. Prints a StarPU task
  88. end
  89. define starpu-tasks-on-worker
  90. set language c
  91. set $worker=config->workers[$arg0]
  92. set $task=$worker.local_tasks.head
  93. while $task != 0x0
  94. starpu-print-task $task
  95. set $task=$task->next
  96. end
  97. end
  98. define starpu-tasks-on-workers
  99. set language c
  100. set $num=0
  101. while $num<config->topology->nworkers
  102. printf "Worker %s\n", config->workers[$num].name
  103. starpu-tasks-on-worker $num
  104. set $num = $num + 1
  105. end
  106. end
  107. define starpu-workers
  108. set language c
  109. set $num=0
  110. printf "[Id] Name Arch Mask Devid Bindid Workerid Isrunning Isinitialized\n"
  111. while $num<config->topology->nworkers
  112. set $worker=&config->workers[$num]
  113. printf "[%2d] %-40s %-4d %-4d %-5d %-6d %-8d %-9d %-13d\n", $num, $worker->name, $worker->arch, $worker->worker_mask, \
  114. $worker->devid, $worker->bindid, $worker->workerid, $worker->worker_is_running, $worker->worker_is_initialized
  115. set $num = $num + 1
  116. end
  117. end
  118. document starpu-workers
  119. Prints a list of the StarPU workers
  120. end
  121. define starpu-tags
  122. printf "tags htbl %p\n", tag_htbl
  123. printf "TODO\n"
  124. end
  125. define starpu-tasks
  126. printf "%d submitted tasks\n", nsubmitted
  127. printf "%d ready tasks\n", nready
  128. printf "Tasks being run:\n"
  129. set $n = 0
  130. while $n < config.topology.nworkers
  131. set $task = config.workers[$n].current_task
  132. if ($task)
  133. printf "worker %d:\n", $n
  134. starpu-print-task $task
  135. set $j = (struct _starpu_job *) $task->starpu_private
  136. set $nsuccs = $j->job_successors.nsuccs
  137. set $i = 0
  138. while $i < $nsuccs
  139. set $cg = $j->job_successors.succ[$i]
  140. if ($cg->cg_type == 1)
  141. # STARPU_CG_APPS
  142. printf "waited for by application"
  143. end
  144. if ($cg->cg_type == 2)
  145. # STARPU_CG_TAG
  146. printf "will produce tag %x\n", $cg->succ.tag
  147. end
  148. if ($cg->cg_type == 4)
  149. # STARPU_CG_TASK
  150. printf "dep of task %p\n", $cg->succ.job
  151. starpu-print-task $cg->succ.job->task
  152. end
  153. set $i = $i + 1
  154. end
  155. end
  156. set $n = $n + 1
  157. end
  158. if (tag_htbl)
  159. printf "TODO: tags\n"
  160. end
  161. print "TODO: complete\n"
  162. end
  163. define starpu
  164. printf "Here I am...\n"
  165. end
  166. define starpu-print-mode
  167. if ($arg0 & 1)
  168. printf "R"
  169. end
  170. if ($arg0 & 2)
  171. printf "W"
  172. end
  173. if ($arg0 & 4)
  174. printf " SCRATCH"
  175. end
  176. if ($arg0 & 8)
  177. printf " REDUX"
  178. end
  179. end
  180. define starpu-print-data
  181. set language c
  182. set $data = (starpu_data_handle_t) $arg0
  183. printf "Data handle %p\n", $data
  184. printf "Home node %d\n", $data->home_node
  185. printf "RWlock refs %d\n", $data->refcnt
  186. printf "Busy count %d\n", $data->busy_count
  187. printf "Current mode "
  188. starpu-print-mode $data->current_mode
  189. printf "\n"
  190. if $data->current_mode & (4|8)
  191. set $n = 0
  192. while $n < config.topology.nworkers
  193. set $replicate = $data->per_worker[$n]
  194. printf "Worker %2d %10s:", $n, config->workers[$n]->name
  195. if $replicate.state == 0
  196. printf " OWNER"
  197. end
  198. if $replicate.state == 1
  199. printf " SHARED"
  200. end
  201. if $replicate.state == 2
  202. printf " INVALID"
  203. end
  204. if $replicate.initialized
  205. printf " initialized"
  206. end
  207. printf "\n"
  208. set $n = $n + 1
  209. end
  210. else
  211. set $n = 0
  212. while $n < descr.nnodes
  213. set $replicate = &$data->per_node[$n]
  214. printf "Node %2d (%2d):", $n, $replicate->refcnt
  215. if $replicate.state == 0
  216. printf " OWNER"
  217. end
  218. if $replicate.state == 1
  219. printf " SHARED"
  220. end
  221. if $replicate.state == 2
  222. printf " INVALID"
  223. end
  224. if $replicate.initialized
  225. printf " initialized"
  226. end
  227. printf "\n"
  228. set $n = $n + 1
  229. end
  230. end
  231. printf "Post sync tasks\n"
  232. set $tasklist = $data->post_sync_tasks
  233. while $tasklist != 0x0
  234. starpu-print-task $tasklist->task
  235. set $tasklist = $tasklist->next
  236. end
  237. printf "Requester tasks\n"
  238. set $requesterlist = $data->req_list._head
  239. while $requesterlist != 0x0
  240. printf "mode: "
  241. starpu-print-mode $requesterlist->mode
  242. printf "\n"
  243. starpu-print-job $requesterlist->j
  244. set $requesterlist = $requesterlist->_next
  245. end
  246. if ($data->nchildren)
  247. printf "%d children\n", $data->nchildren
  248. end
  249. end
  250. define starpu-print-datas
  251. set $entry = registered_handles
  252. while $entry
  253. starpu-print-data $entry->handle
  254. printf "\n"
  255. set $entry = (struct handle_entry *) $entry.hh.next
  256. end
  257. end
  258. define starpu-print-datas-summary
  259. set language c
  260. set $entry = registered_handles
  261. set $data_n = 0
  262. set $pw_data_n = 0
  263. set $data_n_allocated = 0
  264. set $replicate_n_owners = 0
  265. set $replicate_n_shared = 0
  266. set $replicate_n_invalid = 0
  267. set $replicate_n_initialized = 0
  268. set $replicate_n_allocated = 0
  269. set $pw_replicate_n_owners = 0
  270. set $pw_replicate_n_shared = 0
  271. set $pw_replicate_n_invalid = 0
  272. set $pw_replicate_n_initialized = 0
  273. set $pw_replicate_n_allocated = 0
  274. while $entry
  275. set $data = (starpu_data_handle_t) $entry->handle
  276. if $data->current_mode & (4|8)
  277. set $pw_data_n = $pw_data_n + 1
  278. set $n = 0
  279. while $n < config.topology.nworkers
  280. set $replicate = $data->per_worker[$n]
  281. if $replicate.state == 0
  282. set $pw_replicate_n_owners = $pw_replicate_n_owners + 1
  283. end
  284. if $replicate.state == 1
  285. set $pw_replicate_n_shared = $pw_replicate_n_shared + 1
  286. end
  287. if $replicate.state == 2
  288. set $pw_replicate_n_invalid = $pw_replicate_n_invalid + 1
  289. end
  290. if $replicate.initialized
  291. set $pw_replicate_n_initialized = $pw_replicate_n_initialized + 1
  292. end
  293. if $replicate.allocated
  294. set $pw_replicate_n_allocated = $pw_replicate_n_allocated + 1
  295. end
  296. set $n = $n + 1
  297. end
  298. else
  299. set $data_n = $data_n + 1
  300. set $n = 0
  301. while $n < descr.nnodes
  302. set $replicate = &$data->per_node[$n]
  303. if $replicate.state == 0
  304. set $replicate_n_owners = $replicate_n_owners + 1
  305. end
  306. if $replicate.state == 1
  307. set $replicate_n_shared = $replicate_n_shared + 1
  308. end
  309. if $replicate.state == 2
  310. set $replicate_n_invalid = $replicate_n_invalid + 1
  311. end
  312. if $replicate.initialized
  313. set $replicate_n_initialized = $replicate_n_initialized + 1
  314. end
  315. if $replicate.allocated
  316. set $replicate_n_allocated = $replicate_n_allocated + 1
  317. set $data_allocated = 1
  318. end
  319. set $n = $n + 1
  320. end
  321. if $data_allocated
  322. set $data_n_allocated = $data_n_allocated + 1
  323. end
  324. end
  325. set $entry = (struct handle_entry *) $entry.hh.next
  326. end
  327. printf "Number of handles: %d\n", $data_n
  328. printf "Number of allocated handles: %d\n", $data_n_allocated
  329. printf "Number of OWNER replicates: %d\n", $replicate_n_owners
  330. printf "Number of SHARED replicates: %d\n", $replicate_n_shared
  331. printf "Number of INVALID replicates: %d\n", $replicate_n_invalid
  332. printf "Number of initialized replicates: %d\n", $replicate_n_initialized
  333. printf "Number of allocated replicates: %d\n", $replicate_n_allocated
  334. printf "Number of per-worker handles: %d\n", $pw_data_n
  335. printf "Number of OWNER per-worker replicates: %d\n", $pw_replicate_n_owners
  336. printf "Number of SHARED per-worker replicates: %d\n", $pw_replicate_n_shared
  337. printf "Number of INVALID per-worker replicates: %d\n", $pw_replicate_n_invalid
  338. printf "Number of initialized per-worker replicates: %d\n", $pw_replicate_n_initialized
  339. printf "Number of allocated per-worker replicates: %d\n", $pw_replicate_n_allocated
  340. end
  341. define starpu-print-request
  342. set $r = (struct _starpu_data_request *)$arg0
  343. printf "Request %p\n", $r
  344. printf "Refcnt %d\n", $r->refcnt
  345. printf "Handle %p\n", $r->handle
  346. printf "src_replicate %p\n", $r->src_replicate
  347. printf "dst_replicate %p\n", $r->dst_replicate
  348. printf "handling_node %d\n", $r->handling_node
  349. if ($r->mode & 1)
  350. printf "R"
  351. end
  352. if ($r->mode & 2)
  353. printf "W"
  354. end
  355. if ($r->mode & 4)
  356. printf "S"
  357. end
  358. if ($r->mode & 8)
  359. printf "X"
  360. end
  361. printf "\n"
  362. printf "completed: %d\n", $r->completed
  363. printf "retval: %d\n", $r->retval
  364. printf "ndeps: %d\n", $r->ndeps
  365. printf "next_req_count: %d\n", $r->next_req_count
  366. end
  367. define starpu-print-requests
  368. set $node = 0
  369. while $node < descr.nnodes
  370. printf "Node %u:\n", $node
  371. set $request = data_requests[$node]._head
  372. while $request != 0
  373. printf " Request %p: handle %p ", $request, $request->handle
  374. starpu-print-mode $request->mode
  375. printf "\n"
  376. set $request = $request->_next
  377. end
  378. set $node = $node + 1
  379. end
  380. end
  381. define starpu-print-prequests
  382. set $node = 0
  383. while $node < descr.nnodes
  384. printf "Node %u:\n", $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