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

! This program requires remap communication 

      PROGRAM MAIN 
      REAL X(-99:264), Y(-4:802) 
!HPF$ PROCESSORS P(4) 
!HPF$ TEMPLATE TX(5:771),TY(7:3299) 
!HPF$ DISTRIBUTE TX(CYCLIC) ONTO P 
!HPF$ DISTRIBUTE TY(BLOCK) ONTO P 
!HPF$ ALIGN X(i) WITH TX(2*i+205) 
!HPF$ ALIGN Y(i) WITH TY(4*i+28) 

      FORALL (i=-99:264) X(i) = 0 
      FORALL (i=-4:802) Y(i) = i 
      FORALL (i=-2:192:1) X(i) = Y(4*i+11) + Y(4*i+6) 

      CALL FOO(X(-99:255:2),Y(-4:788:3)) 
      CALL FOO(X(-98:79:1),Y(-2:262:1)) 

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

      SUBROUTINE FOO(X,Y) 
      REAL X(:), Y(:) 
!HPF$ INHERIT X,Y 
      FORALL (i=1:177) 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 
!          4 -99 -4 264 802 -2 192 1 2 1 2 4 4 4 
!          5 771 7 3299 205 28 11 6  
!          -99 255 2 -4 788 3 
!          -98 79 1 -2 262 1 
