Skip to content

Debugging

Rupert Nash edited this page Nov 3, 2015 · 1 revision

Debugging locally

HemeLB contains some code to support debugging MPI parallel programs without having a parallel debugger. This is enabled by setting the CMake variable HEMELB_BUILD_DEBUGGER to ON and HEMELB_OPTIMISATION to -g -O0 (or a higher level). You then must run the executable with the option -debug 1.

On application startup, it will start a shell for each rank that has been run (in tabs in your terminal) and attach your system default debugger to the processes that you have mpirun. The processes will automatically resume.

To stop program execution and break, get the debugger (hemelb::debug::Debugger::Get()) and then call its BreakHere() method. You can do this conditionally, e.g.

if (value > it_should_be)
  debug::Debugger::Get()->BreakHere();

And those ranks where the condition is true will stop execution and drop into the debugger.

Clone this wiki locally