Jeff Squyres wrote:
> On Oct 7, 2004, at 2:17 AM, Vinod Kannan wrote:
>
>> I want a single parent process to spawn off say 4 child processes
>> (preferably using spawn and not spawn_multiple). I then want the child
>> processes to be communicate with
>
>
> Random note: the output of SPAWN and SPAWN_MULTIPLE are the same: an
> intecommunicator spanning *all* the children and parents. The main
> difference between SPAWN and SPAWN_MULTIPLE is that SPAWN only allows
> one command line (i.e., argv). SPAWN_MULTIPLE allows multiple command
> lines (i.e., you can specify multiple different executables --
> MPMPD-style). Regardless of which you use, the processes that are
> started are all in one MPI_COMM_WORLD after they finish MPI_INIT.
>
>> each other using an individual communicator for each pair of
>> children. Say process parent spawns of child1, child2, child3. I want
>> child1 to be able to communicate with child2 using an
>> intercommunicator (or an intracommunicator with only child1 and child2
>> as members) and similarly child2<->child3 and child3<->child1.
>
>
> Yes, this is possible.
>
>> From what I understand of Communicators, I can use Spawn_multiple to
>> create the children and then use Intercomm_create passing COMM_SELF &
>> COMM_WORLD with peer group leaders rank as the one who I want to
>> communicate with. Am I correct? Is there a more elegant and insulated
>> way than using Spawn_multiple?
>
>
> In your example, SPAWN_MULTIPLE will return a single intercomm with two
> groups:
>
> group 1: parent
> group 2: child1, child2, child3
>
> There are a variety of ways to split this into process-pair
> communicators. One way, for example, is to INTERCOMM_MERGE this down to
> an intracommunicator and then creatively use an ordered sequence of
> MPI_COMM_SPLIT's to generate the process-pair comms (note that if you
> put in MPI_UNDEFINED for the color, that process will not be included in
> the output communicator). For example, use the following color values
> for COMM_SPLIT:
>
> time parent child1 child2 child3
> 0 UNDEFINED 1 1 UNDEFINED
> 1 UNDEFINED 1 UNDEFINED 1
> 2 UNDEFINED UNDEFINED 1 1
>
> Hope that helps.
Jeff,
Why do you suggest the merge? This seems to add a layer of
complication. Following the spawn the children are all part of their
own MPI_COMM_WORLD. Just have the children do the successive splits
with their MPI_COMM_WORLD.
Dave.
>
--
Dr. David Cronk, Ph.D. phone: (865) 974-3735
Research Leader fax: (865) 974-8296
Innovative Computing Lab
http://www.cs.utk.edu/~cronk
University of Tennessee, Knoxville
|