Discussion:
[OMPI users] waiting for message either from MPI communicator or from TCP socket
Trevour Spencer
2017-06-20 18:15:24 UTC
Permalink
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, 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>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Trevour Spencer
2017-06-25 18:08:22 UTC
Permalink
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
Post by Trevour Spencer
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, 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>
<#m_-4216220911187895472_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
r***@open-mpi.org
2017-06-25 18:44:50 UTC
Permalink
I suspect nobody is answering because the question makes no sense to us. You are implying that the TCP socket is outside of MPI since it isn’t tied to a communicator. If you want to setup a non-MPI communication path between two procs and monitor it separate from the MPI library, you can certainly do so - there is nothing that prevents you from doing it.

I suspect that question went similarly unanswered for the same reason.
Post by Trevour Spencer
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 <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
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> <x-msg://5/#m_-4216220911187895472_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
_______________________________________________
users mailing list
https://rfd.newmexicoconsortium.org/mailman/listinfo/users
Brice Goglin
2017-06-25 19:19:52 UTC
Permalink
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
Post by Trevour Spencer
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
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
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
https://rfd.newmexicoconsortium.org/mailman/listinfo/users
Trevour Spencer
2017-06-25 20:15:30 UTC
Permalink
Thank you, Brice,
you confirmed what I worried about already. So, I will either have a
significant overhead from thread context switches or a good amount of my
cpu power will go into polling. This is really bad. If there is no
interrupt based mechanism such as select(), which can wait for a number of
sockets without wasting cpu cycles, I doubt that my master/worker type
application (as mentioned by the other guy on the MPICH list) will run with
decent efficiency. It seems like I'll have to sacrifice an extra node to
serve as interface between the control commands coming in via TCP and the
worker messages via MPI, so that the remaining nodes can run at full
performance.

Nevertheless, your answer was very helpful to me. Thanks!
Trevour
Post by Brice Goglin
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
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
<https://lists.mpich.org/pipermail/discuss/2015-June/004049.html>
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
Post by Trevour Spencer
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, 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
https://rfd.newmexicoconsortium.org/mailman/listinfo/users
Loading...