[MPICH] Disconnecting spawned processes after MPI_Intercomm_merge

James S Perrin james.s.perrin at manchester.ac.uk
Tue Sep 26 14:28:34 CDT 2006


Hi,

Rajeev Thakur wrote:
>>The problem occurs when I create an intracommunicator with 
>>MPI_Intercomm_merge(). I've tried freeing and disconnecting 
>>from the new 
>>intracomm but the child processes seem to be waiting for the 
>>parent to MPI_Finalize(). 
> 
>  
> It's a bug in the current release of MPICH2 that the finalize on the client
> synchronizes with the finalize on the server. It happens even without the
> intercomm_merge I think.

No, it works if the intercomm_merge isn't there (at least with 1.0.3 win32), 
I've put the spawn in a loop and had the child init, disconnect, finalize and 
exit correctly for serveral iterations.


James

>>-----Original Message-----
>>From: owner-mpich-discuss at mcs.anl.gov 
>>[mailto:owner-mpich-discuss at mcs.anl.gov] On Behalf Of James S Perrin
>>Sent: Tuesday, September 26, 2006 12:03 PM
>>To: mpich
>>Subject: [MPICH] Disconnecting spawned processes after 
>>MPI_Intercomm_merge
>>
>>Hi,
>>	I'm following up to my earlier query about using forked 
>>processes in MPI . As 
>>this was considered a no-no I've being trying to put together 
>>the appropiate 
>>framework using spawned processes. Simply I want to start a 
>>set of spawned 
>>processes and then end them (due to a 3rd party API forcing 
>>an exit) and keep 
>>the parent processes running.
>>
>>	After searching online and looking at the MPI-2 spec it 
>>seems the use of 
>>MPI_Comm_disconnect is not well documented. However I've got 
>>a simple example to 
>>work, which just launches and closes the spawned processes once.
>>
>>	The problem occurs when I create an intracommunicator with 
>>MPI_Intercomm_merge(). I've tried freeing and disconnecting 
>>from the new 
>>intracomm but the child processes seem to be waiting for the 
>>parent to 
>>MPI_Finalize(). How do I release the intracomm? Is this a bug 
>>or feature?
>>
>>	"Using MPI" implies that I might be better off using 
>>intercommunicators for my 
>>"parallel-server, parallel-client" application so I guess I 
>>should explore this.
>>
>>spawn_master.c
>>int main (int argc, char * argv[])
>>{
>>   int no_exit = 1;
>>   MPI_Comm inter_comm, new_world;
>>
>>   MPI_Init (&argc, &argv);
>>   MPI_Comm_spawn("./spawn_worker", &argv[1], 1, MPI_INFO_NULL, 0, 
>>MPI_COMM_WORLD, &inter_comm, errs);
>>   MPI_Intercomm_merge(inter_comm, 0, &new_world);
>>
>>   // Let worker do its thing
>>
>>   MPI_Comm_free(&new_world);
>>   MPI_Comm_disconnect(&inter_comm);
>>
>>   while(no_exit)
>>   {
>>      // go and do something else
>>   }
>>
>>   MPI_Finalize();
>>   return EXIT_SUCCESS;
>>}
>>
>>
>>spawn_worker.c
>>int main (int argc, char * argv[])
>>{
>>   MPI_Comm parent, new_world;
>>
>>   MPI_Init (&argc, &argv);
>>   MPI_Comm_get_parent(&parent);
>>   MPI_Intercomm_merge(parent, 1, &new_world);
>>
>>   // Do something useful
>>
>>   MPI_Comm_free(&new_world);
>>   MPI_Comm_disconnect(&parent);
>>   MPI_Finalize();
>>   return EXIT_SUCCESS;
>>}
>>
>>
>>Appologies for rambling but I kept coming across new bits of 
>>info as I was 
>>writing this.
>>
>>Regards
>>James
>>-- 
>>--------------------------------------------------------------
>>---------------
>>James S. Perrin,                   | email: 
>>james.perrin at manchester.ac.uk
>>Manchester Visualization Centre,   | 
>>www.sve.man.ac.uk/General/Staff/perrin
>>Kilburn Building, The University,  | tel: +44 161 275 6945
>>Manchester, England. M13 9PL.      | fax: +44 161 275 6800/6040
>>--------------------------------------------------------------
>>---------------
>>"The test of intellect is the refusal to belabour the 
>>obvious" -Alfred Bester
>>--------------------------------------------------------------
>>---------------
>>
>>
> 
> 


-- 
-----------------------------------------------------------------------------
James S. Perrin,                   | email: james.perrin at man.ac.uk
Manchester Visualization Centre,   | www.sve.man.ac.uk/General/Staff/perrin
Kilburn Building, The University,  | tel: +44 161 275 6945
Manchester, England. M13 9PL.      | fax: +44 161 275 6800/6040
-----------------------------------------------------------------------------
"The test of intellect is the refusal to belabour the obvious" -Alfred Bester
-----------------------------------------------------------------------------




More information about the mpich-discuss mailing list