[mpich-discuss] MPI_Comm_Spawn question
Eric Hui
Eric.Hui at ggy.com
Wed Jun 29 10:26:52 CDT 2011
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/e685d168/attachment.htm>
More information about the mpich-discuss
mailing list