Generic message passing calls



next up previous
Next: Global Operations Up: EASYPVM in more Previous: Process creation and

Generic message passing calls

With the term generic message passing is meant a feature, where a programmer fixes certain data type for subsequent data communication. Data is sent or received using generic send() and recv() functions and the length of the data arrays is expressed in elements (words) rather than bytes. This offers a nearly trivial port to machines with different word lengths (e.g. Cray vs. other systems) or data representation (e.g. low vs. big-endian).

A typical PVM-application contains several message passing calls that are repeated over and over again, thus making PVM-application hard to read, longsome to code and (thus) errorprone. For example before sending the message, one should do in PVM:

  1. initiate a message buffer
  2. pack message into that buffer
  3. send buffer to a specific destination

This requires (in most cases) three PVM-library calls. In PVM a single message can be formed of different data types. This feature is, however, very seldom used in a real application. For that reason EASYPVM offers a subroutine call setdatatype() which fixes the data type for the subsequent message passing operations. A Fortran-code may look like as follows:

  DOUBLE PRECISION A(N)
  ... do something with your data A ..
  CALL setdatatype(REAL8)    ! Sets data type for subsequent operations
  CALL send(dest,100,A,N)    ! Data type is REAL8
  ... do something else with your data A ..
  CALL send(dest,200,A,N)    ! Data type is still REAL8

EASYPVM is also capable sending or receiving matrix blocks. Using function calls send2d() and recv2d() a specific sub-block of a matrix can be accessed. This simplifies programming in many linear algebra applications.

In addition, functions to broadcast() or multicast() data arrays are available. Also a special function that forwards the just received data buffer before starting to unpack it for itself is available (storefwd()). For simple data exchanges function sendrecv() can also be used. It simply combines send() and recv() into one function.



Sami Saarinen
Thu Nov 3 14:56:09 EET 1994