I had some confusion regarding MPI,sockets and TCP/IP. Are all these three communication protocols which can make use of different interconnects like Infiniband,ethernet or is it something else? Sorry for the trouble if the question sounds naive but I really get confused with these three terms.
For longer connections, the Transmission Control Protocol (TCP) is a primary transport mechanism utilized by MPI.
TCP is being used for MPI control channel (smpd), while UDP is being used for other services such as remote-desktop.
MPI is free to use any available communication path(s) for MPI messages in the new communicator; the socket is only used for the initial handshaking.
TCP/IP is widely used primarily because it is standardized vs competing networking protocol suites such as IPX/SPX and Appletalk. The World Wide Web, the web, is another reason TCP/IP is so popular. HTTP is an application layer protocol designed within the framework of the Internet protocol suite.
TCP/IP is a family of networking protocols. IP is the lower-level protocol that's responsible for getting packets of data from place to place across the Internet. TCP sits on top of IP and adds virtual circuit/connection semantics. With IP alone you can only send and receive independent packets of data that are not organized into a stream or connection. It's possible to use virtually any physical transport mechanism to move IP packets around. For local networks it's usually Ethernet, but you can use anything. There's even an RFC specifying a way to send IP packets by carrier pigeon.
Sockets is a semi-standard API for accessing the networking features of the operating system. Your program can call various functions named socket, bind, listen, connect, etc., to send/receive data, connect to other computers, and listen for connections from other computers. You can theoretically use any family of networking protocols through the sockets API--the protocol family is a parameter that you pass in--but these days you pretty much always specify TCP/IP. (The other option that's in common use is local Unix sockets.)
MPI is an API for passing messages among processes running on a cluster of servers. MPI is higher level than both TCP/IP and sockets. It can theoretically use any family of networking protocols, and if it's using TCP/IP or some other family that's supported by the sockets API, then it probably uses the sockets API to communicate with the operating system.
If the purpose behind your question is to decide how you should write a parallel programming application, you should probably not be looking at TCP/IP or sockets as those things are going to be much lower level than you want. You'll probably want to look at something like MPI or any of the PGAS languages like UPC, Co-array Fortran, Global Arrays, Chapel, etc. They're going to be far easier to use than essentially writing your own networking layer.
When you use one of these higher level libraries, you get lots of nice abstractions like collective operations, remote memory access, and other features that make it easier to just write your parallel code instead of dealing with all of the OS stuff underneath. It also makes your code portable between different machines/architectures.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With