<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr">Does rank 0 stop here since ranks 0 and 1 are still connected through Comm_World? If so, then the code attached before does not explicitly demonstrate the problem, since I can't disconnect from Comm_World.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 29, 2016 at 6:04 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 Halim,<div><br></div><div>Please find attached a minimal example that seems to reproduce this. This is a more simplified version that does not do nameserver lookup.</div><div><br></div><div>I compiled this as</div><div>mpicxx -g test_two_procs.c -L /opt/mpich-3.2_install/lib/ -o two_procs</div><div><br></div><div>Run this with</div><div>mpiexec -np 2 ./two_procs</div><div><br></div><div>We can see that rank 0 waits at Finalize, until rank 1 reaches it, even though both rank 0 and rank 1 call MPI_Comm_disconnect. It is my understanding that rank 0 should have finished without having to wait for rank 1.</div><div><br></div><div>Also MPI_Comm_disconnect cannot be called on MPI_Comm_world.</div><div><br></div><div>I have another minimal example, that involves nameserver lookup but I think this example should demonstrate it for now. Hope this helps.</div><div><br></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On Mon, Feb 29, 2016 at 5:39 PM, Halim Amer <span dir="ltr"><<a href="mailto:aamer@anl.gov" target="_blank">aamer@anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">MPI_Finalize is collective over a set of connected processes. If the server hangs in MPI_Finalize, it means that it is still connected to a subset of the clients. It is difficult to know the reason without a concrete piece of code. If you send us a minimal example that reproduces the problem, we might be able to identify the issue.<br>
<br>
--Halim<br>
<br>
<a href="http://www.mcs.anl.gov/~aamer" rel="noreferrer" target="_blank">www.mcs.anl.gov/~aamer</a><span><br>
<br>
On 2/29/16 9:00 AM, K. N. Ramachandran wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
Hello all,<br>
<br>
I had tried just calling MPI_Comm_disconnect instead of MPI_Comm_split.<br>
<br>
I had tried this on just the server side, as well as both on the server<br>
and client, but I still see the issue of busy-wait at MPI_Finalize on<br>
the server side. Can anyone give any further inputs on this?<br>
<br>
It looks like the server process should be able to terminate early, but<br>
is held up by the client, even though they should be disconnected from<br>
each other.<br>
<br>
<br>
<br>
On Sat, Feb 27, 2016 at 7:00 PM, K. N. Ramachandran <<a href="mailto:knram06@gmail.com" target="_blank">knram06@gmail.com</a><br></span><span>
<mailto:<a href="mailto:knram06@gmail.com" target="_blank">knram06@gmail.com</a>>> wrote:<br>
<br>
Hi Pavan,<br>
<br>
Thank you for the reply. I have presented only a very simplified<br>
case of one server and one client and that is why the problem looks<br>
strange.<br>
<br>
The general case is one server acting as a meeting point and N<br>
clients join the server and one intra comm is formed among them all.<br>
Then the server splits off and terminates, leaving the intracomm and<br>
then letting the clients work amongst themselves now.<br>
<br>
I had also tried MPI_Comm_disconnect on the server, after calling<br>
MPI_Comm_split, but even in that case, the server busy-waits for the<br>
client at Finalize. The single server and single client was only to<br>
demonstrate the problem I am facing.<br>
<br>
Please let me know if you might need more information. Thanks.<br>
<br>
On Sat, Feb 27, 2016 at 11:59 AM, Balaji, Pavan <<a href="mailto:balaji@anl.gov" target="_blank">balaji@anl.gov</a><br></span><span>
<mailto:<a href="mailto:balaji@anl.gov" target="_blank">balaji@anl.gov</a>>> wrote:<br>
<br>
<br>
It's unclear what exactly you are trying to do here. Why are<br>
the clients connecting to the server and then immediately<br>
"splitting off"?<br>
<br>
Your "split-off" functionality needs to be implemented using<br>
MPI_Comm_disconnect, not using MPI_Comm_split. Comm_split<br>
divides a communicator into smaller communicators, but all<br>
processes are still very much connected. So as long as the<br>
server process is connected to the client processes, it might<br>
still receive messages from the client process and thus cannot<br>
simply exit. Comm_disconnect, on the other hand, disconnects<br>
the client processes from the server processes.<br>
<br>
But then again, I have no idea why you are connecting to the<br>
server and disconnecting immediately.<br>
<br>
-- Pavan<br>
<br>
> On Feb 26, 2016, at 5:31 PM, K. N. Ramachandran<br></span><div><div>
<<a href="mailto:knram06@gmail.com" target="_blank">knram06@gmail.com</a> <mailto:<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<br>
MPICH-3.2 and I am trying to resolve an issue where a server<br>
process busy waits at MPI_Finalize.<br>
><br>
> We are trying to create a server process that accepts<br>
incoming connections from a known number of clients (say, N<br>
clients), forms a new communicator amongst everyone (server and<br>
clients) and then splits itself from the group and terminates,<br>
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<br>
nameserver and clients lookup the name to join the server. The<br>
server and client processes are started with separate calls to<br>
mpiexec, one to start the server and the rest N calls to start<br>
the clients.<br>
><br>
> The server process busy-waits at the MPI_Finalize call, after<br>
it splits from the communicator and only finishes when all other<br>
clients reach their MPI_Finalize too.<br>
><br>
> Consider a simplified case of only one server and one client.<br>
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<br>
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<br>
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<br>
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<br>
immediately at MPI_Finalize()? I had tried MPI_Comm_disconnect<br>
(also MPI_Comm_free) on both the server and client, but that<br>
didn't help.<br>
><br>
> 3) We don't want to see the server process consuming one<br>
core at 100% while it waits at MPI_Finalize. Are other<br>
alternatives apart from making the server process sleep, wakeup<br>
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>
> _______________________________________________<br></div></div>
> discuss mailing list <a href="mailto:discuss@mpich.org" target="_blank">discuss@mpich.org</a> <mailto:<a href="mailto:discuss@mpich.org" target="_blank">discuss@mpich.org</a>><span><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></span>
discuss mailing list <a href="mailto:discuss@mpich.org" target="_blank">discuss@mpich.org</a> <mailto:<a href="mailto:discuss@mpich.org" target="_blank">discuss@mpich.org</a>><span><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>
<br>
<br>
Regards,<br>
K.N.Ramachandran<br>
<br>
<br>
<br>
<br>
Regards,<br>
K.N.Ramachandran<br>
<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>
<br>
</span></blockquote><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>
</div></div></blockquote></div><br><br clear="all"><div><br></div></div></div>Thanks,<br><div><div dir="ltr">K.N.Ramachandran</div></div>
</div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">K.N.Ramachandran<br><div>Ph: 814-441-4279</div></div></div>
</div>