Using the DDT Debugger

DDT is a debugger from Allinea with a graphical user interface for debugging Fortran, C, and C++ programs that have been parallelized with MPI. Additional information can be found at Often programs are debugged by inserting print statements into the program and then running the program and examining the values printed out. However, it is much faster and much easier to use a debugger, such as DDT, to find program errors instead of inserting print statements.

The following is a list of the important functions allowed by DDT:

DDT sends displays to your desktop using X connections. To find out if your desktop computer accepts X connections enter: xterm -e tcsh If your desktop machine accepts X connections, then this command will open a window. If your desktop does not accept X connections, then you will need to find another desktop computer to be able to use DDT.

For many desktop machines, logging onto CyEnce with ssh -X provides the needed information DDT needs to send its display to your desktop. If not, then you can either:

The following lists the steps needed to use DDT on CyEnce:

Step 1: Compile with the -g option, e.g. for Fortran use: mpif90 -g prog.f90 (If you also want checking for out-of-bounds array references, add the -C option.)

Step 2: Enter: ddt a.out Two DDT windows should then pop up. At the lower left portion of the Session Control Window (the smaller of the two windows), there is a box for the number of nodes needed for the MPI job. (DDT is set up for 2 MPI processes/node and the ISU license allows no more than 16 nodes.)

Step 3: Select the Submit button in the Session Control Window. The Session Control Window will disappear and the program is now ready to be executed under the control of DDT. The remaining window is likely small, so it is a good idea to "maximize" it.

Step 4: In the Project Files Window (left center), select the source file for the main program. The source code for this file will then appear in the center window.

Step 5: Setting breakpoints. Scroll to the statement and right click on this statement and select "add breakpoint";. This sets a break point on this line. Breakpoints may be selected for the MPI processes listed in the All, Root, or Workers toolbar by first left clicking on one of these in the toolbar.

Step 6: Controlling Program Execution. The following summarizes the most useful items from the toolbars at the top of the DDT window:

When stepping through the program one can step using the groups All, Root, or Workers. To synchronize on a line of the program, right click on this line and select Synchronize Group.

Values of local variables are displayed in the right center window for the MPI process selected for the place where execution has stopped. Multi-dimensional array values can be viewed by selecting Multi-Dimensional Array Viewer listed under View.