Ask Your Question

how to launch and debug mpi4py processes

asked 2018-12-24 12:34:00 -0500


updated 2019-03-13 10:25:39 -0500

From Wing IDE, how can I launch and debug processes that will be interacting through mpi4py?

edit retag flag offensive close merge delete

4 Answers

Sort by » oldest newest most voted

answered 2018-12-28 09:36:00 -0500

updated 2019-03-06 22:28:29 -0500

Wingware Admin gravatar image

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.

edit flag offensive delete link more

answered 2018-12-26 16:45:00 -0500


updated 2019-03-06 06:55:55 -0500

Wingware Admin gravatar image

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

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.

edit flag offensive delete link more

answered 2018-12-24 16:09:00 -0500

updated 2019-03-06 22:29:14 -0500

Wingware Admin gravatar image

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

Please let me know if this does not help.

edit flag offensive delete link more

answered 2019-01-01 16:33:00 -0500


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!!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-12-24 12:34:00 -0500

Seen: 964 times

Last updated: Mar 06 '19