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 info | implementation-specific information on how to establish an address (handle) |
OUT port_name | newly established port (string) |
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 of the 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_name | a port (string) |
This function releases the network address represented by port_name.
MPI_COMM_ACCEPT(port_name, info, root, comm, newcomm) | |
IN port_name | port name (string, significant only at root) |
IN info | implementation-dependent information (handle, significant only at root) |
IN root | rank of root in comm (integer) |
IN comm | intra-communicator over which call is collective (handle) |
OUT newcomm | inter-communicator with client as remote group (handle) |
MPI_COMM_ACCEPT establishes communication with a client. It is collective over the calling communicator. It returns an inter-communicator that allows communication with the client.
The port_name must have been established through a call to MPI_OPEN_PORT.
info can be used to provide directives that may influence the behavior of the ACCEPT call.