[mpich-discuss] How to terminate MPI_Comm_accept

Balaji, Pavan balaji at anl.gov
Tue Oct 7 23:09:52 CDT 2014


Hirak,

Your approach should work fine.  I’m not sure what issue you are facing.  I assume thread 1 is doing this:

while (1) {
	MPI_Comm_accept(..);
	MPI_Recv(.., tag, ..);
	if (tag == REGULAR_CONNECTION)
		continue;
	else if (tag == TERMINATION) {
		MPI_Send(..);
		break;
	}
}

In this case, all clients do an MPI_Comm_connect and then send a message with tag = REGULAR_CONNECTION.  When thread 2 is done with its work, it’ll do an MPI_Comm_connect and then send a message with tag = TERMINATION, wait for a response from thread 1, and call finalize.

  — Pavan

On Oct 7, 2014, at 10:58 PM, Roy, Hirak <Hirak_Roy at mentor.com> wrote:

> Hi Huiwei,
>  
> Thanks for your response.
>  
> I don’t think the solution you suggested will work.
> MPI_Comm_accept is a blocking MPI call and the call does not return until there is a matching MPI_Comm_connect or implementation specified timeout ( the timeout can not be configured and reasonably high).
> So when Thread2 is waiting on MPI_Comm_accept, it neither can receive any message nor can check any shared flag value.
>  
> That’s why I tried to terminate the accept by connecting from thread1.
>  
> Please let me know if you have any other suggestion.
>  
> Thanks,
> Hirak
> _______________________________________________
> discuss mailing list     discuss at mpich.org
> To manage subscription options or unsubscribe:
> https://lists.mpich.org/mailman/listinfo/discuss

--
Pavan Balaji  ✉️
http://www.mcs.anl.gov/~balaji

_______________________________________________
discuss mailing list     discuss at mpich.org
To manage subscription options or unsubscribe:
https://lists.mpich.org/mailman/listinfo/discuss


More information about the discuss mailing list