360_debugging_tools.doxy 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * This file is part of the StarPU Handbook.
  3. * Copyright (C) 2009--2011 Universit@'e de Bordeaux
  4. * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2016 CNRS
  5. * Copyright (C) 2011, 2012 INRIA
  6. * See the file version.doxy for copying conditions.
  7. */
  8. /*! \page DebuggingTools Debugging Tools
  9. StarPU provides several tools to help debugging applications. Execution traces
  10. can be generated and displayed graphically, see \ref GeneratingTracesWithFxT.
  11. \section DebuggingInGeneral TroubleShooting In General
  12. Generally-speaking, if you have troubles, pass \ref enable-debug "--enable-debug" to
  13. <c>./configure</c> to enable some checks which impact performance, but will
  14. catch common issues, possibly earlier than the actual problem you are observing,
  15. which may just be a consequence of a bug that happened earlier. Also, make sure
  16. not to have the \ref enable-fast "--enable-fast" option which drops very useful
  17. catchup assertions. If your program is valgrind-safe, you can use it, see \ref
  18. UsingOtherDebugger.
  19. Depending on your toolchain, it might happen that you get
  20. <c>undefined reference to `__stack_chk_guard'</c> errors. In that case, use the
  21. <c>--disable-fstack-protector-all</c> option to avoid the issue.
  22. Then, if your program crashes with an assertion error, a segfault, etc. you can send us the result of
  23. \verbatim
  24. thread apply all bt
  25. \endverbatim
  26. run in <c>gdb</c> at the point of the crash.
  27. In case your program just hangs, but it may also be useful in case of a crash
  28. too, it helps to source <c>gdbinit</c> as described in the next section to be
  29. able to run and send us the output of the following commands:
  30. \verbatim
  31. starpu-workers
  32. starpu-tasks
  33. starpu-print-requests
  34. starpu-print-prequests
  35. starpu-print-frrequests
  36. starpu-print-irrequests
  37. \endverbatim
  38. To give us an idea of what is happening within StarPU. If the outputs are not too long, you can even run
  39. \verbatim
  40. starpu-all-tasks
  41. starpu-print-all-tasks
  42. starpu-print-datas-summary
  43. starpu-print-datas
  44. \endverbatim
  45. \section UsingGdb Using The Gdb Debugger
  46. Some <c>gdb</c> helpers are provided to show the whole StarPU state:
  47. \verbatim
  48. (gdb) source tools/gdbinit
  49. (gdb) help starpu
  50. \endverbatim
  51. For instance,
  52. <ul>
  53. <li> one can print all tasks with <c>starpu-print-all-tasks</c>, </li>
  54. <li> print all datas with <c>starpu-print-datas</c>, </li>
  55. <li> print all pending data transfers with <c>starpu-print-prequests</c>, <c>starpu-print-requests</c>, <c>starpu-print-frequests</c>, <c>starpu-print-irequests</c>,</li>
  56. <li> print pending MPI requests with <c>starpu-mpi-print-detached-requests</c></li>
  57. </ul>
  58. Some functions can only work if \ref enable-debug "--enable-debug"
  59. was passed to <c>./configure</c>
  60. (because they impact performance)
  61. \section UsingOtherDebugger Using Other Debugging Tools
  62. Valgrind can be used on StarPU: valgrind.h just needs to be found at <c>./configure</c>
  63. time, to tell valgrind about some known false positives and disable host memory
  64. pinning. Other known false positives can be suppressed by giving the suppression
  65. files in <c>tools/valgrind/*.suppr</c> to valgrind's <c>--suppressions</c> option.
  66. The environment variable \ref STARPU_DISABLE_KERNELS can also be set to <c>1</c> to make
  67. StarPU does everything (schedule tasks, transfer memory, etc.) except actually
  68. calling the application-provided kernel functions, i.e. the computation will not
  69. happen. This permits to quickly check that the task scheme is working properly.
  70. \section UsingTheTemanejoTaskDebugger Using The Temanejo Task Debugger
  71. StarPU can connect to Temanejo >= 1.0rc2 (see
  72. http://www.hlrs.de/temanejo), to permit
  73. nice visual task debugging. To do so, build Temanejo's <c>libayudame.so</c>,
  74. install <c>Ayudame.h</c> to e.g. <c>/usr/local/include</c>, apply the
  75. <c>tools/patch-ayudame</c> to it to fix C build, re-<c>./configure</c>, make
  76. sure that it found it, rebuild StarPU. Run the Temanejo GUI, give it the path
  77. to your application, any options you want to pass it, the path to <c>libayudame.so</c>.
  78. It permits to visualize the task graph, add breakpoints, continue execution
  79. task-by-task, and run <c>gdb</c> on a given task, etc.
  80. \image html temanejo.png
  81. \image latex temanejo.png "" width=\textwidth
  82. Make sure to specify at least the same number of CPUs in the dialog box as your
  83. machine has, otherwise an error will happen during execution. Future versions
  84. of Temanejo should be able to tell StarPU the number of CPUs to use.
  85. Tag numbers have to be below <c>4000000000000000000ULL</c> to be usable for
  86. Temanejo (so as to distinguish them from tasks).
  87. */