Global Operations



next up previous
Next: Performance tracing via Up: EASYPVM in more Previous: Generic message passing

Global Operations

EASYPVM provides many common global communication routines like global syncronization, summation, product, min-max and concatenate functions. All these functions are also generic, that is, exactly the same function call is suitable for INTEGER, REAL or DOUBLE PRECISION data types, as well as for different COMPLEX data types.

If all NODE processes share the same (SPMD-)code, one can syncronize processes in the following mannergif:

  CALL gsync()

Only after all processes have reached this point in the source code, the NODEs can proceed their execution. This feature is available in a very difficult manner through dynamic process groups in PVM 3.x and was called barrier() in older PVM 2.4.x.

Global summation, product, min/max are also available through a single, generic library call (unlike in the Intel's NX-library). It is under user responsibility to assure that the correct data type is in use. A code for INTEGER summation may look like as follows:

  INTEGER MYVAR, RESULT, mynode
  MYVAR = mynode()
  CALL setdatatype(INTEGER4)
  CALL gsum(MYVAR,1,RESULT)  ! Perform global summation with INTEGERs

As result each of the NODE processes have the sum of local MYVAR's accumulated in the RESULT-variable. It should be noted that the program is essentially the same for the REAL-variables, except that function call setdatatype(INTEGER4) must be replaced by setdatatype(REAL4).

With the nearest neighbour capability in EASYPVM is meant a set of functions which return the rank index of every nearest neighbour process in a logical 3D-torus. For example, exchanging data with the neighbour processes in left (west()) and right (east()) sides can be coded as follows:

  REAL*8 U(0:N+1,0:Mlocal+1)
  CALL setdatatype(REAL8)
  if (me .lt. nproc-1) then
    CALL send(east(),100,U(1,Mlocal),N)
  endif
  if (me .gt. 0) then
    CALL recv(west(),100,U(1,0),N)
    CALL send(west(),200,U(1,1),N)
  endif
  if (me .lt. nproc-1) then
    CALL recv(east(),200,U(1,Mlocal+1),N)
  endif



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