gdbinit 16 KB

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