202. Server Routines


Up: Establishing Communication Next: Client Routines Previous: Names, Addresses, Ports, and All That

A server makes itself available with two routines. First it must call MPI_OPEN_PORT to establish a port at which it may be contacted. Secondly it must call MPI_COMM_ACCEPT to accept connections from clients.

MPI_OPEN_PORT(info, port_name)
IN infoimplementation-specific information on how to establish an address (handle)
OUT port_namenewly established port (string)
int MPI_Open_port(MPI_Info info, char *port_name)
MPI_OPEN_PORT(INFO, PORT_NAME, IERROR)
CHARACTER*(*) PORT_NAME
INTEGER INFO, IERROR
{ void MPI::Open_port(const MPI::Info& info, char* port_name) (binding deprecated, see Section Deprecated since MPI-2.2 ) }

This function establishes a network address, encoded in the port_name string, at which the server will be able to accept connections from clients. port_name is supplied by the system, possibly using information in the info argument.

MPI copies a system-supplied port name into port_name. port_name identifies the newly opened port and can be used by a client to contact the server. The maximum size string that may be supplied by the system is MPI_MAX_PORT_NAME.
Advice to users.

The system copies the port name into port_name. The application must pass a buffer of sufficient size to hold this value. ( End of advice to users.)

port_name is essentially a network address. It is unique within the communication universe to which it belongs (determined by the implementation), and may be used by any client within that communication universe. For instance, if it is an internet (host:port) address, it will be unique on the internet. If it is a low level switch address on an IBM SP, it will be unique to that SP.
Advice to implementors.

These examples are not meant to constrain implementations. A port_name could, for instance, contain a user name or the name of a batch job, as long as it is unique within some well-defined communication domain. The larger the communication domain, the more useful MPI's client/server functionality will be. ( End of advice to implementors.)
The precise form of the address is implementation-defined. For instance, an internet address may be a host name or IP address, or anything that the implementation can decode into an IP address. A port name may be reused after it is freed with MPI_CLOSE_PORT and released by the system.


Advice to implementors.

Since the user may type in port_name by hand, it is useful to choose a form that is easily readable and does not have embedded spaces. ( End of advice to implementors.)
info may be used to tell the implementation how to establish the address. It may, and usually will, be MPI_INFO_NULL in order to get the implementation defaults.

MPI_CLOSE_PORT(port_name)
IN port_namea port (string)
int MPI_Close_port(char *port_name)
MPI_CLOSE_PORT(PORT_NAME, IERROR)
CHARACTER*(*) PORT_NAME
INTEGER IERROR
{ void MPI::Close_port(const char* port_name) (binding deprecated, see Section Deprecated since MPI-2.2 ) }
This function releases the network address represented by port_name.

MPI_COMM_ACCEPT(port_name, info, root, comm, newcomm)
IN port_nameport name (string, used only on root)
IN infoimplementation-dependent information (handle, used only on root)
IN rootrank in comm of root node (integer)
IN commintracommunicator over which call is collective (handle)
OUT newcommintercommunicator with client as remote group (handle)
int MPI_Comm_accept(char *port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *newcomm)
MPI_COMM_ACCEPT(PORT_NAME, INFO, ROOT, COMM, NEWCOMM, IERROR)
CHARACTER*(*) PORT_NAME
INTEGER INFO, ROOT, COMM, NEWCOMM, IERROR
{ MPI::Intercomm MPI::Intracomm::Accept(const char* port_name, const MPI::Info& info, int root) const (binding deprecated, see Section Deprecated since MPI-2.2 ) }

MPI_COMM_ACCEPT establishes communication with a client. It is collective over the calling communicator. It returns an intercommunicator that allows communication with the client.

The port_name must have been established through a call to MPI_OPEN_PORT.

info is a implementation-defined string that may allow fine control over the ACCEPT call.



Up: Establishing Communication Next: Client Routines Previous: Names, Addresses, Ports, and All That


Return to MPI-2.2 Standard Index
Return to MPI Forum Home Page

(Unofficial) MPI-2.2 of September 4, 2009
HTML Generated on September 10, 2009