TCPMPL has been implemented in C++. It gives the features of TCPMPL as a
class interface to the user application which uses it. The following is
the class interface:
class TCPMPL {
TCPMPL(void);
TCPMPL();
void initTCPMPL(int &argc, char ** &argv);
int getId(void) const;
int getTCPMPLSize()() const;
bool sendData(char *ptr, int nbytes, int id);
bool sendDataVector(const struct iovec *vector, int count,
int id);
bool recvDataFrom(char *ptr, int nbytes, int id);
bool recvData(char *ptr, int nbytes, int *id);
bool probeForData(int *source, int *length, long seconds,
long microseconds);
bool waitForData();
}
- initTCPMPL
-
This is the method that user applications need to call before any user code
that can be executed in parallel. This method starts the processes on the
remote machines specified. It also establishes the communication
channels between all its peers.
- getId
-
This method is used to get the identity of the parallel process. It
returns a value 0 for the master and 1 to N-1 for the slaves.
- getTCPMPLSize
-
This method is used by user applications to get the total number of
processes running in the group. It returns N, where N is the total
number of processes in the group.
- sendData
- This method is used by user application to
send information to its peers. This method takes as input the
information to be sent as a sequence of bytes and the length of the
buffer to be sent together with the identity of the destination process
in the group.
- sendDataVector
-
This method is used to send multiple buffers of data as a single message
to the destination process. Sometimes user applications have
information stored in multiple buffers. All the data in multiple
buffers need to be sent to the destination as a single message. This
reduces the copying since the user application does not need to copy all
the data into a single contiguous buffer to send the data to the
destination process.
- recvDataFrom
-
This method is used by user applications to receive data from a
particular process identified by the identity number. It also has to
specify the size of the message to be received. If the data that is
waiting to be received is larger than the size specified by the user,
the routine returns error.
- recvData
-
This method is used by user application to receive data from any source
process. This method requires the user application to specify the size
of the message that has to be received. This method returns the
identity of the process from which the data has been received back to
the user.
- probeForData
-
This method is used by user applications to probe for any data that is
available from any source process. Asynchronous user applications do
not know when the data is arriving to a particular process. Therefore,
this method is used to check whether there is any message that has
arrived from any source process. It returns the message size and the
identity of the process from which the message is available back to the
user application. It also asks the user application to specify the time
in seconds and microseconds for which probeForData has to wait before
returning control back to the user about the status of message available.
- waitForData
-
This method is used by user applications to wait for data to arrive from
any source process. This method is a blocking call. It waits
infinitely for a message to arrive. User applications are advised to
use this call only if the application knows for sure that a message is
going to arrive to this process.
Radharamanan Radhakrishnan
Mon Mar 15 18:20:48 EST 1999