[Pympi-users] Debugging with pyMPI
Status: Alpha
Brought to you by:
patmiller
|
From: Julian C. <rjc...@cs...> - 2005-08-16 20:47:10
|
Last month Pat Miller outlined how to encapsulate mpi code so that it will
run regardless of the presence/absence of mpi as follows:
def Computation(...):
value = ...
if mpi is not None:
value = mpi.allreduce(value)
return value
Sometimes you need to debug your actual mpi code to find out where you
messed up. I discovered that you can run the graphical debugger under idle
at np 1, AS LONG AS you start up idle *without* the network subprocess,
which is used for debugging.
If the startup directory was "/home/jcook/python/Python-2.4", then you could
use the following command to startup idle under pyMPI. Note the "-n" to
switch off the debugging subprocess.
mpirun -np 1 /home/jcook/python/Python-2.4/bin/pyMPI Lib/idlelib/idle.py -n
After idle starts, you can load the file you want to debug and step into it
or set a breakpoint and run it. I used it to find a difficult error, where
(in some low level function) one input had to be an exact multiple of
another - but the code never checked for this (because I never added it).
pyMPI had no trouble running the debugger, so I found it fairly quickly. It
would be nice to use Idle with np >1, but I have not figured out how to do
it..
Julian Cook
|