Depends on the version you are working with. If it includes the -xterm option, 
then that option gets applied to the dynamically spawned procs too, so this 
should be automatically taken care of...but in that case, you wouldn't need 
your script to open an xterm anyway. You would just do:

mpirun --xterm -np 5 gdb ./my_app

or the equivalent. You would then comm_spawn an argv[0] of "gdb", with argv[1] 
being your target app.

I don't know how to avoid including that "gdb" in the comm_spawn argv's - I 
once added an mpirun cmd line option to automatically add it, but got loudly 
told to remove it.  Of course, it should be easy to pass an option to your app 
itself that tells it whether or not to do so!

HTH
Ralph


On Dec 16, 2009, at 4:06 AM, jody wrote:

> Hi
> Until now i always wrote applications for which the number of processes
> was given on the command line with -np.
> To debug these applications i wrote a script, run_gdb.sh which basically
> open a xterm and starts gdb in it for my application.
> This allowed me to have a window for each of the processes being debugged.
> 
> Now, however, i write my first application in which additional processes are
> being spawned. My question is now: how can i open xterm windows in which
> gdb runs for the spawned processes?
> 
> The only way i can think of is to pass my script run_gdb.sh into the argv
> parameters of MPI_Spawn.
> Would this be correct?
> If yes, what about other parameters passed to the spawning process, such as
> environment variables passed via -x? Are they being passed to the spawned
> processes as well? In my case this would be necessary so that processes
> on other machine will get the $DISPLAY environment variable in order to
> display their xterms with gdb on my workstation.
> 
> Another negative point would be the need to change the argv parameters
> every time one switches between debugging and normal running.
> 
> Has anybody got some hints on how to debug spawned processes?
> 
> Thank You
>  Jody
> _______________________________________________
> users mailing list
> us...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/users


Reply via email to