Usually, when you want to listen to two kinds of event, you use
poll/select on Unix (or epoll on Linux). This strategy doesn't work for
MPI events because MPI doesn't provide a Unix file descriptor to pass to
poll/select/epoll. One work-around is to have one thread listen to MPI
events. When it receives your MPI message, it writes something into a
pipe. Then your main thread uses poll/select/epoll to listen to your
socket and to this pipe at the same time.

Another solution is to not busy polling alternatively on both kinds of
them: MPI_Test*() on your communicator, then non-blocking read() on your
socket, then MPI_Test(), etc. Works but wastes CPU cycles. Fortunately
MPI often uses busy polling when waiting for messages anyway, so not
sure it matters.

Brice



Le 25/06/2017 20:08, Trevour Spencer a écrit :
> Dear all,
> I have not yet found a solution for waiting for an event (incoming
> message) to occur either on a TCP socket or on a MPI communicator. I
> wish I could receive some comments from you MPI experts.
> If my question was unclear, I found the same problem described on the
> MPICH list two years ago:
> https://lists.mpich.org/pipermail/discuss/2015-June/004049.html
> He received no reply either.
>
> Is the question stupid for some reason, is the answer trivial, or is
> there no solution to this problem?
>
> Cheers
> Trevour
>
> 2017-06-20 20:15 GMT+02:00 Trevour Spencer <trevourspen...@gmail.com
> <mailto:trevourspen...@gmail.com>>:
>
>     Dear all,
>     I am looking for a solution to receive messages either via MPI or
>     via a TCP socket, whichever arrives next.
>
>     Using the select() method as described for example at
>     http://developerweb.net/viewtopic.php?id=2933
>     <http://developerweb.net/viewtopic.php?id=2933>, I can have my
>     code wait until any of a given set of TCP sockets receives some data.
>
>     Does a similar solution exist, such that the code waits until data
>     is available either from an MPI communicator or from a TCP socket?
>
>     Cheers
>     Trevour
>
>     
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>       Virenfrei. www.avast.com
>     
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
>
>
>
>
> _______________________________________________
> users mailing list
> users@lists.open-mpi.org
> https://rfd.newmexicoconsortium.org/mailman/listinfo/users

_______________________________________________
users mailing list
users@lists.open-mpi.org
https://rfd.newmexicoconsortium.org/mailman/listinfo/users

Reply via email to