
! ***** This is level 2 program *****

! This program requires shift communication 

      PROGRAM MAIN 
      REAL X(-39:225), Y(-48:879) 
!HPF$ PROCESSORS P(8) 
!HPF$ TEMPLATE TX(-156:987),TY(-77:907) 
!HPF$ DISTRIBUTE TX(CYCLIC) ONTO P 
!HPF$ DISTRIBUTE TY(CYCLIC) ONTO P 
!HPF$ ALIGN X(i) WITH TX(4*i+2) 
!HPF$ ALIGN Y(i) WITH TY(1*i+3) 

      FORALL (i=-39:225) X(i) = 0 
      FORALL (i=-48:879) Y(i) = i 
      FORALL (i=-3:200:2) X(i) = Y(4*i+8) + Y(4*i+2) 

      CALL FOO(X(-39:221:2),Y(-47:868:3)) 
      CALL FOO(X(-37:93:1),Y(-44:261:1)) 

      PRINT 111, (X(i),i=-39,225) 
111   FORMAT(1x,f17.2) 
      END 

      SUBROUTINE FOO(X,Y) 
      REAL X(:), Y(:) 
!HPF$ INHERIT X,Y 
      FORALL (i=1:130) X(i)=X(i)-Y(i)-Y(i+1) 
      END 
!          p,lx,ly,ux,uy,l,u,s,d1,d2,ax,ay,a1,a2, 
!          ltx,utx,lty,uty,bx,by,b1,b2, 
!          lxs1,uxs1, sxs1, lys1, uys1, sys1, 
!          lxs2,uxs2, sxs2, lys2, uys2, sys2 
!          8 -39 -48 225 879 -3 200 2 2 2 4 1 4 4 
!          -156 987 -77 907 2 3 8 2  
!          -39 221 2 -47 868 3 
!          -37 93 1 -44 261 1 
