Subject: test file of link b and d

From: Du_Zhi_hui <[email-masked]>
Date: Fri, 11 Oct 1996 10:23:10 +0800 (EAT)

!this is test file 1 with only array assign statement
PROGRAM main
REAL a(1000),b(1000),c(1000),d(1000),x(500),y(0:501)
INTEGER  inx(1000)
!HPF$ PROCESSORS procs(10)
!HPF$ DISTRIBUTE (BLOCK) ONTO procs ::b
!HPF$ DISTRIBUTE (CYCLIC) ONTO procs ::d
!HPF$ ALIGN x(i) WITH y(i+1)
!HPF$ ALIGN a(i) WITH b(i)
!HPF$ ALIGN c(i) WITH d(i)

	a=b
	x(1:500)=y(2:501)
	a=c
	a(2:999)=a(1:998)+a(2:999)+a(3:1000)
        c(2:999)=c(1:998)+c(2:999)+c(3:1000)
	x(1:500)=y(1:500)
	c=d
END PROGRAM main

! the following is the transformation result of test file 1. 
      program main
      real :: a(1000),b(1000),c(1000),d(1000),x(500),y(0:501)
      integer :: inx(1000)
!HPF$      processors procs(10)
!HPF$      distribute  (block) onto  procs :: b
!HPF$      distribute  (cyclic) onto  procs :: d
!HPF$      align x (i) with y(i+1)
!HPF$      align a (i) with b(i)
!HPF$      align c (i) with d(i)
      integer :: temp_index_0
      forall (temp_index_0=0:(1000-1)/1)      a(1+temp_index_0*1) = b(1+&
     &temp_index_0*1)

      forall (temp_index_0=0:(500-1)/1)      x(1+temp_index_0*1) = y(2+t&
     &emp_index_0*1)

      forall (temp_index_0=0:(1000-1)/1)      a(1+temp_index_0*1) = c(1+&
     &temp_index_0*1)

      forall (temp_index_0=0:(999-2)/1)      a(2+temp_index_0*1) = a(1+t&
     &emp_index_0*1)+a(2+temp_index_0*1)+a(3+temp_index_0*1)

      forall (temp_index_0=0:(999-2)/1)      c(2+temp_index_0*1) = c(1+t&
     &emp_index_0*1)+c(2+temp_index_0*1)+c(3+temp_index_0*1)

      forall (temp_index_0=0:(500-1)/1)      x(1+temp_index_0*1) = y(1+t&
     &emp_index_0*1)

      forall (temp_index_0=0:(1000-1)/1)      c(1+temp_index_0*1) = d(1+&
     &temp_index_0*1)

      end program

! This is test file 2 ,it adds some function call compared with test file 1.
! because we introduce temporary variable to deal with function call,the 
! temporary variable should align with the lhs variable.now we have not 
! added the align directive to transformation result.
PROGRAM main
REAL a(1000),b(1000),c(1000),d(1000),x(500),y(0:501)
INTEGER  inx(1000)
!HPF$ PROCESSORS procs(10)
!HPF$ DISTRIBUTE (BLOCK) ONTO procs ::b
!HPF$ DISTRIBUTE (CYCLIC) ONTO procs ::d
!HPF$ ALIGN x(i) WITH y(i+1)
!HPF$ ALIGN a(i) WITH b(i)
!HPF$ ALIGN c(i) WITH d(i)

	a=b
	x(1:500)=y(2:501)
	a=c
	a(2:999)=a(1:998)+a(2:999)+a(3:1000)
        c(2:999)=c(1:998)+c(2:999)+c(3:1000)
	x(1:500)=y(1:500)
	c=d
	a=f1(a)+b+f2(b)
	contains

	function f1(a) result(f_result)
	implicit none
	real :: a(1000),f_result(1000)
	f_result=a

	end function f1

	function f2(ca) result(f2_result)
	implicit none
	real::ca(1000),f2_result(1000)
	f2_result=ca
	end function f2
END PROGRAM main

!this is test file 3 ,it contains some where statement
PROGRAM main
REAL a(1000),b(1000),c(1000),d(1000),x(500),y(0:501)
INTEGER  inx(1000)
!HPF$ PROCESSORS procs(10)
!HPF$ DISTRIBUTE (BLOCK) ONTO procs ::b
!HPF$ DISTRIBUTE (CYCLIC) ONTO procs ::d
!HPF$ ALIGN x(i) WITH y(i+1)
!HPF$ ALIGN a(i) WITH b(i)
!HPF$ ALIGN c(i) WITH d(i)

	where (a>b) a=b
	x(1:500)=y(2:501)
	a=c
	where (a(2:999)>a(1:998)) a(2:999)=a(1:998)+a(2:999)+a(3:1000)
        c(2:999)=c(1:998)+c(2:999)+c(3:1000)
	where (y/=0) x(1:500)=y(1:500)
	c=d
END PROGRAM main

! the following is the transformation of test file 2. we have not added 
! align directive for temp_var_1 and temp_var_2 
      program main
      real :: a(1000),b(1000),c(1000),d(1000),x(500),y(0:501)
      integer :: inx(1000)
!HPF$      processors procs(10)
!HPF$      distribute  (block) onto  procs :: b
!HPF$      distribute  (cyclic) onto  procs :: d
!HPF$      align x (i) with y(i+1)
!HPF$      align a (i) with b(i)
!HPF$      align c (i) with d(i)
      integer :: temp_index_0
      real :: temp_var_1(1000)
      real :: temp_var_2(1000)
      forall (temp_index_0=0:(1000-1)/1)      a(1+temp_index_0*1) = b(1+&
     &temp_index_0*1)

      forall (temp_index_0=0:(500-1)/1)      x(1+temp_index_0*1) = y(2+t&
     &emp_index_0*1)

      forall (temp_index_0=0:(1000-1)/1)      a(1+temp_index_0*1) = c(1+&
     &temp_index_0*1)

      forall (temp_index_0=0:(999-2)/1)      a(2+temp_index_0*1) = a(1+t&
     &emp_index_0*1)+a(2+temp_index_0*1)+a(3+temp_index_0*1)

      forall (temp_index_0=0:(999-2)/1)      c(2+temp_index_0*1) = c(1+t&
     &emp_index_0*1)+c(2+temp_index_0*1)+c(3+temp_index_0*1)

      forall (temp_index_0=0:(500-1)/1)      x(1+temp_index_0*1) = y(1+t&
     &emp_index_0*1)

      forall (temp_index_0=0:(1000-1)/1)      c(1+temp_index_0*1) = d(1+&
     &temp_index_0*1)

      temp_var_1 = f1 (a)
      temp_var_2 = f2 (b)
      forall (temp_index_0=0:(1000-1)/1)      a(1+temp_index_0*1) = temp&
     &_var_1(1+temp_index_0)+b(1+temp_index_0*1)+temp_var_2(1+temp_index&
     &_0)

      contains
      function f1 (a) result(f_result)
      implicit none
      real :: a(1000),f_result(1000)
      integer :: temp_index_0
      forall (temp_index_0=0:(1000-1)/1)      f_result(1+temp_index_0*1)&
     & = a(1+temp_index_0*1)

      end function

      function f2 (ca) result(f2_result)
      implicit none
      real :: ca(1000),f2_result(1000)
      integer :: temp_index_0
      forall (temp_index_0=0:(1000-1)/1)      f2_result(1+temp_index_0*1&
     &) = ca(1+temp_index_0*1)

      end function

      end program

! The following is the transformation result of test file 3.
      program main
      real :: a(1000),b(1000),c(1000),d(1000),x(500),y(0:501)
      integer :: inx(1000)
!HPF$      processors procs(10)
!HPF$      distribute  (block) onto  procs :: b
!HPF$      distribute  (cyclic) onto  procs :: d
!HPF$      align x (i) with y(i+1)
!HPF$      align a (i) with b(i)
!HPF$      align c (i) with d(i)
      integer :: temp_index_0
      forall (temp_index_0=0:(1000-1)/1, a(1+temp_index_0*1) .gt. b(1+te&
     &mp_index_0*1))      a(1+temp_index_0*1) = b(1+temp_index_0*1)

      forall (temp_index_0=0:(500-1)/1)      x(1+temp_index_0*1) = y(2+t&
     &emp_index_0*1)

      forall (temp_index_0=0:(1000-1)/1)      a(1+temp_index_0*1) = c(1+&
     &temp_index_0*1)

      forall (temp_index_0=0:(999-2)/1, a(2+temp_index_0*1) .gt. a(1+tem&
     &p_index_0*1))      a(2+temp_index_0*1) = a(1+temp_index_0*1)+a(2+t&
     &emp_index_0*1)+a(3+temp_index_0*1)

      forall (temp_index_0=0:(999-2)/1)      c(2+temp_index_0*1) = c(1+t&
     &emp_index_0*1)+c(2+temp_index_0*1)+c(3+temp_index_0*1)

      forall (temp_index_0=0:(500-1)/1, y(0+temp_index_0*1) .ne. 0)     &
     & x(1+temp_index_0*1) = y(1+temp_index_0*1)

      forall (temp_index_0=0:(1000-1)/1)      c(1+temp_index_0*1) = d(1+&
     &temp_index_0*1)

      end program

! the following is the transformation of test file 2. we  add 
! align directive for temp_var_1 and temp_var_2 by hand 
      program main
      real :: a(1000),b(1000),c(1000),d(1000),x(500),y(0:501)
      integer :: inx(1000)
!HPF$      processors procs(10)
!HPF$      distribute  (block) onto  procs :: b
!HPF$      distribute  (cyclic) onto  procs :: d
!HPF$      align x (i) with y(i+1)
!HPF$      align a (i) with b(i)
!HPF$      align c (i) with d(i)
      integer :: temp_index_0
      real :: temp_var_1(1000)
      real :: temp_var_2(1000)
!HPF$      align temp_var_1(i) with a(i)
!HPF$      align temp_var_2(i) with a(i)
      forall (temp_index_0=0:(1000-1)/1)      a(1+temp_index_0*1) = b(1+&
     &temp_index_0*1)

      forall (temp_index_0=0:(500-1)/1)      x(1+temp_index_0*1) = y(2+t&
     &emp_index_0*1)

      forall (temp_index_0=0:(1000-1)/1)      a(1+temp_index_0*1) = c(1+&
     &temp_index_0*1)

      forall (temp_index_0=0:(999-2)/1)      a(2+temp_index_0*1) = a(1+t&
     &emp_index_0*1)+a(2+temp_index_0*1)+a(3+temp_index_0*1)

      forall (temp_index_0=0:(999-2)/1)      c(2+temp_index_0*1) = c(1+t&
     &emp_index_0*1)+c(2+temp_index_0*1)+c(3+temp_index_0*1)

      forall (temp_index_0=0:(500-1)/1)      x(1+temp_index_0*1) = y(1+t&
     &emp_index_0*1)

      forall (temp_index_0=0:(1000-1)/1)      c(1+temp_index_0*1) = d(1+&
     &temp_index_0*1)

      temp_var_1 = f1 (a)
      temp_var_2 = f2 (b)
      forall (temp_index_0=0:(1000-1)/1)      a(1+temp_index_0*1) = temp&
     &_var_1(1+temp_index_0)+b(1+temp_index_0*1)+temp_var_2(1+temp_index&
     &_0)

      contains
      function f1 (a) result(f_result)
      implicit none
      real :: a(1000),f_result(1000)
      integer :: temp_index_0
      forall (temp_index_0=0:(1000-1)/1)      f_result(1+temp_index_0*1)&
     & = a(1+temp_index_0*1)

      end function

      function f2 (ca) result(f2_result)
      implicit none
      real :: ca(1000),f2_result(1000)
      integer :: temp_index_0
      forall (temp_index_0=0:(1000-1)/1)      f2_result(1+temp_index_0*1&
     &) = ca(1+temp_index_0*1)

      end function

      end program