blocking.f

PROGRAM P_P
      IMPLICIT NONE
      INCLUDE "mpif.h"

      INTEGER ierror,rank,size
      INTEGER status(MPI_STATUS_SIZE)

      REAL as,bs,cs,ds,es,fs

      CALL MPI_INIT(ierror)
      CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierror)

      IF(rank.EQ.0) THEN
      as = 4.2
      bs = 8.4
      es=bs+as
      fs=es*as
      write(*,*) rank,' as,bs,cs=',as,bs,cs
         CALL MPI_SEND(as,1,MPI_REAL,1,101,
     &                          MPI_COMM_WORLD,ierror)
         CALL MPI_RECV(cs,1,MPI_REAL,1,102,
     &                      MPI_COMM_WORLD,status,ierror)
       ds = cs*bs
       write(*,*)'I am "0" receiv cs=',cs, 'ds =',ds
       ELSE 
       as = 14.2
       bs = 18.4
       es = as*as
       fs = es+as
       write(*,*) rank,' as,bs,cs=',as,bs,cs
        CALL MPI_RECV(cs,1,MPI_REAL,0,101,
     &                      MPI_COMM_WORLD,status,ierror)
        CALL MPI_SEND(bs,1,MPI_REAL,0,102,
     &                           MPI_COMM_WORLD,ierror)
       ds = cs*as
        WRITE(*,*) 'I am "1" receiv cs=',cs, ' ds =', ds
       END IF
      CALL MPI_FINALIZE(ierror)

      STOP
      END