      PROGRAM PROB02
C
C     PROBLEM 2
C
C  REFERENCE:  PROBLEMS TO TEST PARALLEL AND VECTOR LANGUAGES
C              CSD-TR 516, COMPUTER SCIENCE, PURDUE UNIVERSITY
C              JOHN R. RICE, MAY 1, 1985
C
C              REVISED BY JOHN R. RICE AND J. JING, OCT. 1, 1990
C
C
C      *************************************************
C      *      Adapted for FORTRAN D benchmarking       *
C      *    by  T. HAUPT  (haupt@sccs.npac.syr.edu)    *
C      *                                               *
C      *    Northeast Parallel Architectures Center    *
C      *   at Syracuse University, Syracuse, NY, USA   *
C      *************************************************
C
C
C       VERSION F90D-1.00
C       ==================================================
C
      parameter(nproc0=4)
      parameter(nproc1=2)
      INTEGER N,M,NPROC0
      DATA N / 128 /
      DATA M / 128 /
      REAL ESTAR
      REAL, ARRAY(128,128) :: TEMP

C$      DECOMPOSITION A(128,128)
C$      DISTRIBUTE A(CYCLIC,:)
C$      ALIGN TEMP(i,j) WITH A(i,j)

      WRITE(6,*) 'enter the number of processors'
      READ(5,*) nproc0

      TEMP=1.+0.5/(REAL(-IABS(SPREAD([1:NK],2,MK)
     *                          -SPREAD([1:MK],1,NK)))+0.001)
      ESTAR=SUM(PRODUCT(TEMP,2))


      PRINT 60, N,M
  60  FORMAT ('PROBLEM 2 WITH N,M =',I6,2X,I6)
      PRINT *,'GIVES ESTAR =',ESTAR
      write(6,*) 'the right answer is: 449.7..'

   50 CONTINUE
      STOP
      END




