PGDBG

From ACENET
Jump to: navigation, search

CLI

Once you have compiled your code with the -g option to debug your code on the command line with pgdbg type

$ pgdbg -text -mpi:mpirun -np 2 ./hydro

where the -text option specifies the CLI, -mpi:mpirun specifies the MPI starter program, -np 2 runs the job with 2 processes, and ./hydro is the executable you wish to debug. Due to license restrictions, you cannot have more than 16 processes.

Once inside the debugger set break points in the source file. Make sure that there is a break point for each processes. If not all processes reach break points it will cause problems with setting additional breaks points later. This can be done by typing

b "hydro.cpp"@105

and making sure that line 105 in source file "hydro.cpp" is reachable by all processes. Execution of the program can be continued by typing

cont

Execution will continue until halted at the break points you set.

To continue debugging with only one processes or thread type

focus [0.0]

where [0.0] has the form [process.thread]. So [0.0] focuses on thread 0 of process 0. All further commands will be applied to only thread 0 of process 0.

For more about commands see PGI Tools Guide, Chapters 4 and 5.

GUI

To run the Portland Group Graphical User Interface type

$ mpirun -np 4 --debugger pgdbg --debug ./hydro

When in the main window of PGDBG, go to "File" -> "Open Target" and select the executable. For more about the pgdbg GUI see PGI Tools Guide.

Notes

The above commands have only been tested with mpicxx wrapper which uses the pgCC compiler. It is quite likely that all the Portland group compilers work with pgdbg, it is a bit less likely that other compilers will work as expected.