       program SH
C      ===============================================================
C      array assignments with shifts
C      taken from the Livermore Loops, kernel 7
C      ===============================================================
C      please send comments to haupt@npac.syr.edu

       parameter ( N1 = 1000000)
       parameter ( N = 10000)
       real, pointer, dimension(:) :: X, Y, Z, U
       real Q, R, T
       integer k
CHPF$   processors p(1)
CHPF$   template d(1000000)
CHPF$   distribute d(block) onto p
CHPF$   align (:) with d(:) :: X, Y, Z, U
          real*8 time1(3),time2(3),tused           
   
c     start_timer
C        call pghpf_times(time1) 
         Allocate(X(N))
         Allocate(Y(N))
         Allocate(Z(N))
         Allocate(U(N))

C            Initialisation of scalars
            Q = 10.0
    	    R = 1.5
    	    T = 3.77
C           Initialization loop
    	    U = 7.0
            X = 8.0
            Y = 9.0
            Z = 10.0

            do it=1,5
C****************************************************************************
C***  KERNEL 7      EQUATION OF STATE FRAGMENT
C****************************************************************************
C
C
	    forall (k=1:N-6)   
     &   X(k)=     U(k) + R*( Z(k) + R*Y(k)) +
     &        T*( U(k+3) + R*( U(k+2) + R*U(k+1)) +
     &        T*( U(k+6) + Q*( U(k+5) + Q*U(k+4))))
C
C
C****************************************************************************
          enddo
c         stop_timer
C        call pghpf_times(time2) 

      print *,' ' 
      print *,'*******************************'
      print *,'         PARKBENCH '
      print *,' LOW LEVEL HPF BENCHMARK SUITE'
      print *,'         AS  KERNEL'
      print *,' PROBLEM SIZE: N =', N
      print *,' FINAL RESULT = ', X(N-6)
      print *,' EXPECTED VALUE FOR SIZE ', N 
      print *,' IS  11211.0 +/- 0.1'
      print *,'*******************************'

c     print execution time
C     tused=time2(1)-time1(1)
      print 100, tused
 100  format(/,'elapsed time', 1p,e12.4,' seconds.')

      STOP
      END
