how to launch and debug mpi4py processes
From Wing IDE, how can I launch and debug processes that will be interacting through mpi4py?
From Wing IDE, how can I launch and debug processes that will be interacting through mpi4py?
Wing Pro can launch multiple debug processes at once from the Debug > Processes menu and if you enable Debug Child Processes under the Debug/Execute tab in Project Properties (from the Project menu) then it can also automatically debug child processes started by a parent process that is already being debugged. When multiple processes are present, the tools that have a stack frame selector will also show a process selector so you can switch between the processes.
If it's easier to launch things from outside Wing then you would use wingdbstub to start debug. That isn't isn't command line debugging like pdb, but instead attaches the process to the IDE and lets you debug will all the tools there, just as if you had started the debug process from Wing.
Another way to handle this is to start multiple instances of Wing, which maybe for beginners will be more intuitive. To prevent Wing from reusing an existing instance, add --new to the command line that starts Wing.
Thank you very much for your answer. What I'm looking for is a simple procedure from Wing IDE so that my students would be able to debug the code they write for my class on parallel and concurrent programming. I want they to learn how to use mpi4py's mpicommworld as processes' communicator. Thus what I need is to launch X number of processes from Wing IDE and debug each of them as well as their interactions through mpicommworld. They will be working on python scripts like this:
from mpi4py import MPI
import numpy
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
# passing MPI datatypes explicitly
if rank == 0:
data = numpy.arange(1000, dtype='i')
comm.Send([data, MPI.INT], dest=1, tag=77)
elif rank == 1:
data = numpy.empty(1000, dtype='i')
comm.Recv([data, MPI.INT], source=0, tag=77)
# automatic MPI datatype discovery
if rank == 0:
data = numpy.arange(100, dtype=numpy.float64)
comm.Send(data, dest=1, tag=13)
elif rank == 1:
data = numpy.empty(100, dtype=numpy.float64)
comm.Recv(data, source=0, tag=13)
I think i understood your previous suggestion on how to debug externally launched processes, but so far seems to me similar as using pdb to debug processes and I'm looking for a simpler debugging method which take advantage of graphic representation of stack, variables, etc that we have on Wing IDE.
As far as I can tell mpi4py is just a regular module you import so debugging should work as for all other Python code. If you need to debug code launched from outside of Wing, you can do that with wingdbstub as described at https://wingware.com/doc/debug/debugg...
Please let me know if this does not help.
Thank you very much for all your help!! I will try each of the alternatives you described to see which one fits better in my class, or just to present them all to my class and let them choose. Cheers!!
To enter a block of code:
Comments