1program foo
2  implicit none
3  integer, parameter :: n = 100
4  integer, dimension(n,n) :: a
5  integer :: i, j, sum = 0
6
7  a = 1
8
9  !$acc parallel copyin(a(1:n,1:n)) firstprivate (sum)
10  !$acc loop gang reduction(+:sum)
11  do i=1, n
12     !$acc loop vector reduction(+:sum)
13     do j=1, n
14        sum = sum + a(i, j)
15     enddo
16  enddo
17  !$acc end parallel
18
19end program foo
20