NERSCPowering Scientific Discovery Since 1974


Distributed Debugging Tool (DDT) from Allinea Software is a parallel debugger installed on Hopper, Edison and Carver.

The performance of the X Windows-based DDT Graphical User Interface can be greatly improved if used in conjunction with the free NX software.


DDT is a parallel debugger which can be run with up to 8192 processors. It can be used to debug serial, OpenMP, MPI, Coarray Fortran (CAF), UPC (Unified Parallel C) codes. It also supports GPU debugging, but NERSC doesn't currently have a license on Dirac.

Totalview users will find DDT has very similar functionality and an intuitive user interface. All of the primary parallel debugging features from Totalview are available with DDT.

The Allinea DDT web page and 'Allinea DDT and MAP User Guide' (available as $ALLINEA_TOOLS_DOCDIR/userguide.pdf after loading an allineatools module) is a good resource for learning more about some of the advanced DDT features.

Loading the Allinea Tools Module

To use DDT at NERSC, first load the 'allineatools' module to set the correct environment settings:

% module load allineatools

Compiling Code to Run with DDT

In order to use DDT, code must be compiled with the -g option. Add the -O0 flag with the Intel compiler. We also recommend that you do not run with optimization turned on, flags such as -fast.

A Fortran example:

% ftn -g -o testDDT_ex testDDT.f             # on Hopper or Edison
% mpif90 -g -o testDDT_ex testDDT.f # on Carver
% mpiifort -g -mmic -o testDDT_ex testDDT.f # on Babbage for MIC

A C example:

% cc -g -o testDDT_ex testDDT.c             # on Hopper or Edison
% mpicc -g -o testDDT_ex testDDT.c # on Carver
% mpicc -g -mmic -o testDDT_ex testDDT.c # on Babbage for MIC

Starting a Job with DDT

Be sure to log in with an X window forwarding enabled. This could mean using the -X or -Y option to ssh. The -Y option often works better for Mac OSX.

% ssh -X

After loading the allineatools module and compiling with the -g option, request an interactive session on Hopper, Edison, or Carver; be sure to export your DISPLAY environment variable into the batch environment.

% qsub -I -v DISPLAY -q debug -lmppwidth=numCores                      # Hopper or Edison
% qsub -I -v DISPLAY -q debug -lnodes=numNodes:ppn=numTasksPerNode # on Carver
% qsub -I -v DISPLAY -q debug -lnodes=numNodes # on Babbage

Then launch the debugger with the ddt command followed by the name of the executable to debug:

% ddt testDDT_ex

The DDT GUI will pop up, showing a start up menu for you to select what to do. For basic debugging choose the option Run. A user can also choose to Open Core. Attach (to an already running program) is not yet available on Cray machines.

Then a submission window will appear with a prefilled path to the executable to debug. Select the number of processors on which to run and press run. To pass command line arguments to a program enter them in the aprun arguments box.

DDT Submit window

Running DDT on Babbage requires some additional steps. Let's assume that two MIC cards, bc1012-mic0 and bc1012-mic1, are assigned to your batch job:

% get_micfile                            # to get hostfile for MIC cards
% cat micfile.$PBS_JOBID # hostfile generated by get_micfile

Load the allineatools module and start ddt as before. One way that DDT works is to run the executable in MPMD (Multiple Program Multiple Data) mode when you want to run on more than one MIC card, as though you were running separate executables, one on each MIC card. The following is how to specify this in the Run window. Please note that the sum of the processes (8 for this example) should be the sum of the MPI tasks over all cards.

DDT Submit window

Trouble Shooting

If you are having trouble launching DDT try these steps.

Make sure you have the most recent version of the system.config configuration file. The first time you run DDT, you pick up a master template which then gets stored locally in your home directory in ~/.allinea/${NERSC_HOST}/system.config where ${NERSC_HOST} is the machine name: hopper, edison or carver. If you are having problems launching DDT you could be using an older verion of the system.config file and you may want to remove the entire directory:

% rm -rf ~/.allinea/${NERSC_HOST}  

Remove any stale processes that may have been left by DDT.

% rm -rf $TMPDIR/allinea-$USER 

In case of a font problem where every character is displayed as a square, please delete the .fontconfig directory in your home directory and restart ddt.

% rm -rf ~/.fontconfig

Make sure you are requesting an interactive batch session on Hopper, Edison, or Carver; be sure to export your DISPLAY environment variable into the batch environment. NERSC has configured DDT to run from the interactive batch jobs.

% qsub -I -v DISPLAY -q debug -lmppwidth=numCores                      # Hopper or Edison
% qsub -I -v DISPLAY -q debug -lnodes=numNodes:ppn=numTasksPerNode # on Carver
% qsub -I -v DISPLAY -q debug -lnodes=numNodes # on Babbage

Finally make sure you have compiled your code with -g. A large number of users who are having trouble running with parallel debuggers forget to compile their codes with debugging flags turned on. If none of these tips help, please contact the consultants at

Basic Debugging Functionality

The DDT GUI interface should be intuitive to anyone who has used a parallel debugger like Totalview before. Users can set breakpoints, step through code, set watches, examine and change variables, dive into arrays, dereference pointers, view variables across processors, step through processors etc. Please see the DDT Users Guide if you have trouble with any of these basic features.                                                                                                                                                                                                                                                                                                                 

Useful DDT Features

Process Groups

With DDT, the user can easily change the debugger to focus on a single process or group of processes. If Focus on current Processor is chosen, then stepping through the code, setting a breakpoint etc will occur only for a given processor. If Focus on current Group is chosen then the entire group of processors will advance when stepping forward in a program and a breakpoint will be set for all processors in a group.

Similary, when Focus on current Thread is chosen, then all actions are for an OpenMP thread. DDT doesn't allow to create a thread group. However, one can click the Step Threads Together box to make all threads to move together inside a parallel region. In the image shown above, this box is grayed out simply because the code is not an OpenMP code.

A user can create new sub-groups of processors in several ways. One way is to click on the Create Group button at the bottom of the Process Group Window. Another way is to right-click in the Process Group Window to create a group and then drag the desired processors to the group. Groups can also be created more efficiently using sub-groups from the Parallel Stack View described below. The below image shows 3 different groups of processors, the default All group, a group with only a single master processor Master and a group with the remaining Workers processors.

Parallel Stack View

A feature which should help users debug at high concurrencies is DDT's Parallel Stack View window found in the lower left area, which allows the user to see the position of all processors in a code at the same time from the main window. A program is displayed as a branching tree with the number and location of each processor at each point. Instead of clicking through windows to determine where each processor has stopped, the Parallel Stack View presents a quick overview which easily allows users to identify stray processes. Users can also create sub-groups of processors from a branch of the tree by right clicking on the branch. A new group will appear in the Process Group Window at the top of the GUI.

Message Queues

DDT can allows to examine the status of the intermal MPI message buffers. With this feature, you can detect a coding error that generates communication deadlock where all processes are waiting for each other when no message was sent.

Currently message queue debugging is not provided on Hopper and Edison.

There are three types of message queues:

  • Send: Calls to MPI send functions that have not yet completed; shown in red arrows
  • Receive: Calls to MPI receive functions that have not yet completed; shown in green arrows
  • Unexpected Message: Represents messages received by the system but the corresponding receive function call has not been made ; shown in blue arrows

To view message queues, you need to select Message Queues from the View pull-down menu. Below are some examples: 

DDT Receive Message Queue

DDT Send and Receive Message Queues

Memory Debugging

DDT has a memory debugging tool that can show heap memory usage across processors.

To access the memory debugging feature, you must first build your code for memory debugging. On Carver, you can build it as usual. However, on Hopper and Edison, you have to follow certain steps. Below is a table showing steps for building a static executable using different compilers for memory debugging on Hopper and Edison. For the compilers other than PGI, the linking step is made of two parts. The first is to run in verbose mode using the -v flag to show all the linking steps taken. The second step is to rerun the last linker line after inserting some more options.

Compiler For static linking

% ftn -g -c prog.f
% ftn -Bddt -o prog prog.o


% ftn -g -c prog.f
% ftn -v -o prog prog.o          # -v to get the last linker line

Rerun the last linker line after inserting '-zmuldefs' right after the command and putting ${DDT_LINK_DMALLOC} just before -lc:
% /opt/gcc/4.7.1/snos/libexec/gcc/x86_64-suse-linux/4.7.1/collect2 -zmuldefs ... ${DDT_LINK_DMALLOC} -lc ...


% ftn -g -c prog.f
% ftn -v -o prog prog.o

Do similarly as above:
% /opt/cray/cce/8.0.7/cray-binutils/x86_64-unknown-linux-gnu/bin/ld -zmuldefs ... ${DDT_LINK_DMALLOC} -lc ...


% ftn -g -c prog.f
% ftn -v -o prog prog.o

Do similary as above. There are two locations to put ${DDT_LINK_DMALLOC} as there are two -lc's:
% ld -zmuldefs ... ${DDT_LINK_DMALLOC} -lc ... ${DDT_LINK_DMALLOC} -lc ...

The example commands are shown for a Fortran case. cc and CC should be used similarly for C and C++ codes. In case of a C++ code, ${DDT_LINK_DMALLOCXX} is to be used instead of ${DDT_LINK_DMALLOC}.

A simple script, static_linking_ddt_md, is provided in your $PATH to help you complete the somewhat complicated steps shown above.

% module load allineatools
% ftn -g -c prog.f
% static_linking_ddt_md ftn -o prog prog.o # instead of 'ftn -o prog prog.o'
% ls -l prog
-rwx------ 1 wyang wyang 6701908 2012-10-15 15:19 prog

You need to separate the compile and link stages. That is, you need to create *.o files using the -c compile flag first; otherwise, you can see the following message:

/usr/bin/ld: cannot find /scratch/scratchdirs/wyang/ifortnr7R21.o: No such file or directory

 For multi-threaded codes, DDT_LINK_DMALLOCTH and DDT_LINK_DMALLOCTHCXX are used in place of DDT_LINK_DMALLOC and DDT_LINK_DMALLOCXX, respectively. Again, a utility script, static_linking_ddt_md_th, is provided to help with linking:

% static_linking_ddt_md_th ftn -mp -o prog prog.o   # instead of 'ftn -mp -o prog prog.o' 

Below is a table showing how to prepare your code using dyanmic linking on Hopper and Edison. The example is provided for a Fortran code case. Adjustments should be made for C and C++ codes as above. Again, in case of a C++ code, ${DDT_LINK_DMALLOC} must be repalced with ${DDT_LINK_DMALLOCXX} .

Compiler For dynamic linking
PGI, Cray

% ftn -g -c prog.f
% ftn -dyanmic -o prog prog.o ${DDT_LINK_DMALLOC} --Wl,--allow-multiple-definition

GNU, Intel

% ftn -g -c prog.f
% ftn -dynamic -o prog.o ${DDT_LINK_DMALLOC} -zmuldefs

For multi-threaded codes, ${DDT_LINK_DMALLOCTH} or ${DDT_LINK_DMALLOCTHCXX} should be used instead.

Next, when DDT starts, you must click the "Memory Debugging" checkbox in the DDT run menu that first comes up

DDT Groups

To set detailed memory debugging options, click the 'Details...' button on the far right side, which will open the 'Memory Debugging Options' window. There you can set the heap debugging level, the number of guard pages before or after arrays (but not both) for detection of heap overflow or underflow in the program, etc. The default page size is 4 KB.

DDT - memory debugging option

When running ddt with a statically built code, please deselect the 'Preload the memory debugging library' item. Otherwise, ddt can hang indefinitely during startup on Cray machines.

Also, unclick the 'Preload ...' checkbox with a dynamically linked executable on the Cray machines if a C++ version of Allinea's dmalloc library was used (that is, when $DDT_LINK_DMALLOCXX or $DDT_LINK_DMALLOCTHCXX was used). Otherwise, ddt hangs during startup.

Several features are enabled with memory debugging. To see them, select Current Memory Usage and Memory Statistics under the Tools  menu.  You might see something that looks like the following:

DDT - Current Memory Usage

It displays current heap memory usage of the program and the routines where it is allocated. Clicking on a histogram bar on the right, you will see the 'Allocation Details' box on the left filled up with information about where the memory allocation was made. By clicking on one of the pointers in the 'Allocation Details' list you can get information mapped to source code:

DDT - Pointer Details

It is known that memory debugging can fail with the error message "A tree node closed prematurely. One or more proceses may be unusable.", especially with MPI_Bcast. A workaround is to disable 'store stack backtraces for memory allocations' option in the 'Enable Memory Debugging' setting. This problem will be fixed in the next release.

Offline Debugging

Offline debugging is to run DDT in a command-line mode, without using GUI. This mode may be useful if all you want is to get tracepoint (a specified location in the code where requested values are printed) output or stack backtraces without directly interacting with DDT. This can be good for a "parameter study" where you want to check for an error condition for a range of a parameter value, which would become a tedious task if GUI is used.

To run DDT in this mode, you submit a batch job using a batch script that looks like:

% cat runit
#PBS ...

module load allineatools
ddt -offline filename.html -n 4 myprogram arg1 ... # to get HTML output file
ddt -offline filename      -n 4 myprogram arg1 ... # to get plain text output file

% qsub runit 6350051.hopque01

Please note that we are using 'ddt -offline ...' in place of 'aprun' or 'mpirun' for launching an application. Output of the debugging session is saved in the specified file ('filename.html' or 'filename' in the above example).

Some options can be used for the ddt command:

  • -ddtsession sessionfile: run using settings saved using the Save Session option during a previous GUI run session
  • -n numTasks: run with numTasks (MPI) tasks
  • -memory: enable memory debugging
  • -trace-at LOCATION[,N:M,P],VAR1,VAR2,...: set a tracepoint at location LOCATION (given by either 'filename:linenumber' or 'functionname' as in 'main.c:22' or 'myfunction'), beginning recording after the N-th visit of each process to the location, and recording every M-th subsequent pass until it has been triggered P times; record the value of variable VAR1, VAR2, ...
  • -break-at LOCATION[,N:M:P]: set a breakpoint at a location using the format explained above; the stack back traces of pausing processes will be recorded at the breakpoint before they are then made to continue

An example using the following simple code is shown below:

      program offline
!... Prepared for a debugger tutorial by NERSC
include 'mpif.h'
integer, parameter :: n = 24
real, allocatable :: a(:)
integer i, me
call mpi_init(ierr)
call mpi_comm_rank(mpi_comm_world,me,ierr)
allocate (a(n))
call random_number(a)
do i=1,n
if (mod(i,2) == 1) call sub(i,n,a) ! 'sub' called when i=1,3,5,...
end do
print *, me, sum(a)
call mpi_finalize(ierr)
subroutine sub(i,n,a)
integer n, i, j
real a(n)
do j=1,n
a(j) = cos(a(j))
end do

 The following is to set a tracepoint at the beginning of the routine 'sub' where values of i and a(1) are to be printed; and to set a breakpoint at line 23, using the activation scheme of '5:3:2':

ddt -offline offline.html -n 4 -trace-at sub,i,a\(1\) -break-at offline.f:23,5:3:2 ./offline+hopper

The output file is broken into three sections: Messages (showing process activities such as startup and termination etc., as well as call backtrace at breakpoints), Tracepoints (showing output from activated tracepoints), and Output (program output).

Installed Versions

PackagePlatformCategoryVersionModuleInstall DateDate Made Default
Allinea tools babbage applications/ debugging 4.2.2-38982 allineatools/4.2.2-38982 2014-10-16 2014-10-16
Allinea tools babbage applications/ debugging 4.2.2-39982 allineatools/4.2.2-39982 2015-01-14 2015-01-14
Allinea tools babbage applications/ debugging 5.0-40932 allineatools/5.0-40932 2015-02-26
Allinea tools carver applications/ debugging 4.2-34404 allineatools/4.2-34404 2014-01-21 2014-02-21
Allinea tools carver applications/ debugging 4.2-36237 allineatools/4.2-36237 2014-05-02 2014-05-20
Allinea tools carver applications/ debugging 4.2.1-36484 allineatools/4.2.1-36484 2014-05-22
Allinea tools carver_sl6 applications/ debugging 4.2.2-39105 allineatools/4.2.2-39105 2014-11-03 2014-11-03
Allinea tools carver_sl6 applications/ debugging 4.2.2-39982 allineatools/4.2.2-39982 2015-01-14 2015-01-14
Allinea tools carver_sl6 applications/ debugging 5.0-40932 allineatools/5.0-40932 2015-02-26
Allinea tools edison applications/ debugging 4.2.2-39105 allineatools/4.2.2-39105 2014-11-03 2014-11-03
Allinea tools edison applications/ debugging 4.2.2-39982 allineatools/4.2.2-39982 2015-01-09 2015-01-09
Allinea tools edison applications/ debugging 5.0-40932 allineatools/5.0-40932 2015-02-12
Allinea tools hopper applications/ debugging 4.2.2-39105 allineatools/4.2.2-39105 2014-11-03 2014-11-03
Allinea tools hopper applications/ debugging 4.2.2-39982 allineatools/4.2.2-39982 2015-01-14 2015-01-14
Allinea tools hopper applications/ debugging 5.0-40932 allineatools/5.0-40932 2015-02-12
Allinea tools hopper_cle52 applications/ debugging 4.2.2-39982 allineatools/4.2.2-39982 2015-03-03 2015-03-03
Allinea tools hopper_cle52 applications/ debugging 5.0-40932 allineatools/5.0-40932 2015-03-03
Allinea tools hopper_cle52 applications/ debugging 5.0-41047 allineatools/5.0-41047 2015-03-03

Introductory Video Tutorial

Watch the video.