gdbinit 16 KB

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