[mpich-discuss] MPI_Comm_Spawn question
Eric Hui
Eric.Hui at ggy.com
Wed Jun 29 12:53:36 CDT 2011
Hi Dave,
I was reading section 10.3.2 in the MPI 2.2 spec and here is what it says for MPI_Comm_Spawn:
The intercommunicator returned by MPI_COMM_SPAWN contains the parent processes in the local group and the child processes in the remote group. The ordering of processes in the local and remote groups is the same as the ordering of the group of the comm in the parents and of MPI_COMM_WORLD of the children, respectively. This intercommunicator can be obtained in the children through the function MPI_COMM_GET_PARENT.
From the above paragraph, it sounds to me like this new intercommunicator should include both the parent and the child processes. Did I misinterpret the spec?
When I call MPI_Comm_get_parent in the child, it only include the children processes, but not the parent. I am not sure how I can get the parent included if MPI_Comm_get_parent does not return it.
Actually the example code that I am using is based on the example I found here in the MPI forum here:
http://www.mpi-forum.org/docs/mpi22-report/node210.htm#Node210
Regards,
Eric
From: Eric Hui
Sent: Wednesday, June 29, 2011 11:27 AM
To: mpich-discuss at mcs.anl.gov
Subject: MPI_Comm_Spawn question
I started my MPI program with one process only and tried to use MPI_Comm_Spawn to launch three more copies like this:
//main
MPI_Comm ParentComm;
MPI_Comm InterComm;
MPI_Comm_get_parent (&ParentComm);
if (ParentComm == MPI_COMM_NULL)
{
MPI_Comm_spawn("myapp.exe", argv, NumMPIHelpers, MPI_INFO_NULL, 0, MPI_COMM_SELF, &InterComm, MPI_ERRCODES_IGNORE);
ShowRank (InterComm); //*<-- this shows size = 1, rank = 0
}
else
{
ShowRank (ParentComm); //* this shows size = 3, rank = 0, 1 or 2 for the childs
}
//showrank function
void ShowRank (MPI_Comm Com)
{
MPI_Comm_rank (Com, &MPIRank); /* get current process id */
MPI_Comm_size (Com, &MPISize); /* get number of processes */
DWORD Pid = GetCurrentProcessId();
CString Msg;
Msg.Format ("MPI_Comm = %ld, Process ID = %ld, Size = %ld, Rank = %ld", Com, Pid, MPISize, MPIRank);
AddMsg (Msg);
}
I am trying to join the parents and the children together into one group.
Do I need to call MPI_Intercomm_merge? I thought the "InterComm" is already supposed to have size = 4 with rank = 0, 1, 2 and 3.
Thanks,
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20110629/e3ff736f/attachment.htm>
More information about the mpich-discuss
mailing list