<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr">Hello all,<div><br></div><div>I had tried just calling MPI_Comm_disconnect instead of MPI_Comm_split.</div><div><br></div><div>I had tried this on just the server side, as well as both on the server and client, but I still see the issue of busy-wait at MPI_Finalize on the server side. Can anyone give any further inputs on this?</div><div><br></div><div>It looks like the server process should be able to terminate early, but is held up by the client, even though they should be disconnected from each other.</div><div><br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Feb 27, 2016 at 7:00 PM, K. N. Ramachandran <span dir="ltr"><<a href="mailto:knram06@gmail.com" target="_blank">knram06@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Pavan,<div><br></div><div>Thank you for the reply. I have presented only a very simplified case of one server and one client and that is why the problem looks strange.</div><div><br></div><div>The general case is one server acting as a meeting point and N clients join the server and one intra comm is formed among them all. Then the server splits off and terminates, leaving the intracomm and then letting the clients work amongst themselves now.</div><div><br></div><div>I had also tried MPI_Comm_disconnect on the server, after calling MPI_Comm_split, but even in that case, the server busy-waits for the client at Finalize. The single server and single client was only to demonstrate the problem I am facing. </div><div><br></div><div>Please let me know if you might need more information. Thanks.</div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On Sat, Feb 27, 2016 at 11:59 AM, Balaji, Pavan <span dir="ltr"><<a href="mailto:balaji@anl.gov" target="_blank">balaji@anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
It's unclear what exactly you are trying to do here. Why are the clients connecting to the server and then immediately "splitting off"?<br>
<br>
Your "split-off" functionality needs to be implemented using MPI_Comm_disconnect, not using MPI_Comm_split. Comm_split divides a communicator into smaller communicators, but all processes are still very much connected. So as long as the server process is connected to the client processes, it might still receive messages from the client process and thus cannot simply exit. Comm_disconnect, on the other hand, disconnects the client processes from the server processes.<br>
<br>
But then again, I have no idea why you are connecting to the server and disconnecting immediately.<br>
<br>
-- Pavan<br>
<div><div><br>
> On Feb 26, 2016, at 5:31 PM, K. N. Ramachandran <<a href="mailto:knram06@gmail.com" target="_blank">knram06@gmail.com</a>> wrote:<br>
><br>
> Hello all,<br>
><br>
> I have recently begun working on a project that uses MPICH-3.2 and I am trying to resolve an issue where a server process busy waits at MPI_Finalize.<br>
><br>
> We are trying to create a server process that accepts incoming connections from a known number of clients (say, N clients), forms a new communicator amongst everyone (server and clients) and then splits itself from the group and terminates, so that the clients now only work with each other.<br>
><br>
> For very problem specific reasons, we cannot do<br>
> 'mpiexec -np N (other args)'<br>
><br>
> So we have a server that publishes a service name to a nameserver and clients lookup the name to join the server. The server and client processes are started with separate calls to mpiexec, one to start the server and the rest N calls to start the clients.<br>
><br>
> The server process busy-waits at the MPI_Finalize call, after it splits from the communicator and only finishes when all other clients reach their MPI_Finalize too.<br>
><br>
> Consider a simplified case of only one server and one client. The simplified pseudocode is:<br>
><br>
> Server process:<br>
> MPI_Init();<br>
> MPI_Open_port(...);<br>
> MPI_Publish_name(...); //publish service name to nameserver<br>
><br>
> MPI_accept(...); // accept incoming connections and store into intercomm<br>
> MPI_Intercomm_merge(...); // merge new client into intra-comm<br>
><br>
> // now split the server from the client<br>
> MPI_Comm_rank(intra comm, rank); // rank=0<br>
> MPI_Comm_split(intra comm, (rank==0), rank, lone comm);<br>
><br>
> MPI_Finalize(); // busy-waits here till client's sleep duration<br>
><br>
> Client process: (simplified - assuming only one client is trying to connect)<br>
> MPI_Init();<br>
> MPI_Lookup_name(..);<br>
> MPI_Connect(...)<br>
><br>
> // merge<br>
> MPI_Intercomm_merge(...); // merge with server<br>
><br>
> // get rank and split<br>
> MPI_Comm_rank(intra comm, rank); // rank=1<br>
> MPI_Comm_split(intra comm, rank==0, rank, lone comm);<br>
><br>
> sleep(10); // sleep for 10 seconds - causes server to busy wait at MPI_Finalize for sleep duration<br>
><br>
> MPI_Finalize(); // server and client finish here<br>
><br>
> So my questions are:<br>
><br>
> 1) Is busy-wait at MPI_Finalize the expected behaviour?<br>
><br>
> 2) How to truly "disconnect" the server, so that it can end immediately at MPI_Finalize()? I had tried MPI_Comm_disconnect (also MPI_Comm_free) on both the server and client, but that didn't help.<br>
><br>
> 3) We don't want to see the server process consuming one core at 100% while it waits at MPI_Finalize. Are other alternatives apart from making the server process sleep, wakeup and keep polling a client, and then finally call MPI_Finalize?<br>
><br>
> Thank you for any inputs that you can give here.<br>
><br>
><br>
> Regards,<br>
> K.N.Ramachandran<br>
</div></div>> _______________________________________________<br>
> discuss mailing list <a href="mailto:discuss@mpich.org" target="_blank">discuss@mpich.org</a><br>
> To manage subscription options or unsubscribe:<br>
> <a href="https://lists.mpich.org/mailman/listinfo/discuss" rel="noreferrer" target="_blank">https://lists.mpich.org/mailman/listinfo/discuss</a><br>
<br>
_______________________________________________<br>
discuss mailing list <a href="mailto:discuss@mpich.org" target="_blank">discuss@mpich.org</a><br>
To manage subscription options or unsubscribe:<br>
<a href="https://lists.mpich.org/mailman/listinfo/discuss" rel="noreferrer" target="_blank">https://lists.mpich.org/mailman/listinfo/discuss</a><br>
</blockquote></div><br><br clear="all"><div><br></div></div></div>Regards,<br><div><div dir="ltr">K.N.Ramachandran</div></div>
</div></div>
</blockquote></div><br><br clear="all"><div><br></div>Regards,<br><div class="gmail_signature"><div dir="ltr">K.N.Ramachandran</div></div>
</div></div>