First time here? Check out the FAQ!
0

how to launch and debug mpi4py processes

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

ALAN CALDERON CASTRO's avatar
1
ALAN CALDERON CASTRO
asked 2018-12-24 12:34:00 -0600
Wingware Support's avatar
4.2k
Wingware Support
updated 2019-03-13 10:25:39 -0600
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

4 Answers

1

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.

Wingware Support's avatar
4.2k
Wingware Support
answered 2018-12-28 09:36:00 -0600
Wingware Admin's avatar
231
Wingware Admin
updated 2019-03-06 22:28:29 -0600
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

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.

ALAN CALDERON CASTRO's avatar
1
ALAN CALDERON CASTRO
answered 2018-12-26 16:45:00 -0600
Wingware Admin's avatar
231
Wingware Admin
updated 2019-03-06 06:55:55 -0600
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

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.

Wingware Support's avatar
4.2k
Wingware Support
answered 2018-12-24 16:09:00 -0600
Wingware Admin's avatar
231
Wingware Admin
updated 2019-03-06 22:29:14 -0600
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

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

ALAN CALDERON CASTRO's avatar
1
ALAN CALDERON CASTRO
answered 2019-01-01 16:33:00 -0600
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer