Friday, September 4, 2015

Debugging MPI applications with GDB

Basic GDB

'sayHello' being the program binary

> gdb sayHello

> b 10  - set the breakpoint at line 10


> run   - run the program under debugger


> print 'variable_name'  - print the variable name


Ctrl+x , a    will enable the gui based debugging in the gdb.


MPI debugging,

running a program under gdb

> mpiexec -n 4 xterm -e gdb ./gtc

this will bring up 4 xterm terminals. we have to run the processes in each xterm separately.

> mpiexec -n 1 xterm -e gdb ./your_app : -n 3 ./your_app : -n 1 xterm -e gdb ./your_app

here we control the specific process ranks to debug.