Meditation, The Art of Exploitation

Thinking? At last I have discovered it--thought; this alone is inseparable from me. I am, I exist--that is certain. But for how long? For as long as I am thinking. For it could be, that were I totally to cease from thinking, I should totally cease to exist....I am, then, in the strict sense only a thing that thinks.

Wednesday, October 24, 2007

Totalview debugging tips

Totalview is a multi platform debugger that has the best support for parallel software debugging. Here are a couple of tricks I learnt recently:

1. mpi application startup. With openmpi, use command 'mpirun -tv -np N program'. With mpich2, one can use either 'mpirun -tv -np N program' or 'totalview python -a `which mpiexec` -tvsu -np N program'. Totalview cannot restart program with the first command. Totalview GUI provides an interface to launch MPI application directly, one can specify the MPI library type, NP from the interface. This is the best way to start MPI program with totalview without platform dependent knowledge.

2. Mixed language program debugging. This gem was provided by totalview tech support. Quote:

One method that may be easier than others is to
set a breakpoint in the C++ code where the variable is initialized
(assuming it's in the C++ code where this happens). Then you can dive
on the variable, and if it gets returned to the Fortran code, you
already have a handle on it. Of course, sometimes it's not that simple.
But the basic idea is easy to follow.

When in the Fortran code, dive on the variable in question. In the data
window, you should see a button that says More (and Less) If you are
using 8.3, it shows now as an arrow pointing down with a + sign next to
it. Clicking on this or the more button expands the header, and allows
you to change the language to C or C++. You should then be able to cast
the type to a pointer to the appropriate structure. I've used the
previous method (breakpointing in the C++ initialization routine) just
to find the right type to cast to, but that was basically because I was
unfamiliar with the code being looked at.