123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- ! { dg-do run }
- program test
- implicit none
- integer, allocatable :: a1(:)
- integer, allocatable :: b1(:)
- integer, allocatable :: c1(:)
- integer, allocatable :: b2(:,:)
- integer, allocatable :: c3(:,:,:)
- allocate (a1(5))
- if (.not.allocated (a1)) call abort()
- a1 = 10
- !$acc parallel copy(a1(1:5))
- a1(1) = 1
- a1(2) = 2
- a1(3) = 3
- a1(4) = 4
- a1(5) = 5
- !$acc end parallel
- if (a1(1) .ne. 1) call abort
- if (a1(2) .ne. 2) call abort
- if (a1(3) .ne. 3) call abort
- if (a1(4) .ne. 4) call abort
- if (a1(5) .ne. 5) call abort
- deallocate(a1)
- allocate (a1(0:4))
- if (.not.allocated (a1)) call abort()
- a1 = 10
- !$acc parallel copy(a1(0:4))
- a1(0) = 1
- a1(1) = 2
- a1(2) = 3
- a1(3) = 4
- a1(4) = 5
- !$acc end parallel
- if (a1(0) .ne. 1) call abort
- if (a1(1) .ne. 2) call abort
- if (a1(2) .ne. 3) call abort
- if (a1(3) .ne. 4) call abort
- if (a1(4) .ne. 5) call abort
- deallocate(a1)
- allocate (b2(5,5))
- if (.not.allocated (b2)) call abort()
- b2 = 11
- !$acc parallel copy(b2(1:5,1:5))
- b2(1,1) = 1
- b2(2,2) = 2
- b2(3,3) = 3
- b2(4,4) = 4
- b2(5,5) = 5
- !$acc end parallel
- if (b2(1,1) .ne. 1) call abort
- if (b2(2,2) .ne. 2) call abort
- if (b2(3,3) .ne. 3) call abort
- if (b2(4,4) .ne. 4) call abort
- if (b2(5,5) .ne. 5) call abort
- deallocate(b2)
- allocate (b2(0:4,0:4))
- if (.not.allocated (b2)) call abort()
- b2 = 11
- !$acc parallel copy(b2(0:4,0:4))
- b2(0,0) = 1
- b2(1,1) = 2
- b2(2,2) = 3
- b2(3,3) = 4
- b2(4,4) = 5
- !$acc end parallel
- if (b2(0,0) .ne. 1) call abort
- if (b2(1,1) .ne. 2) call abort
- if (b2(2,2) .ne. 3) call abort
- if (b2(3,3) .ne. 4) call abort
- if (b2(4,4) .ne. 5) call abort
- deallocate(b2)
- allocate (c3(5,5,5))
- if (.not.allocated (c3)) call abort()
- c3 = 12
- !$acc parallel copy(c3(1:5,1:5,1:5))
- c3(1,1,1) = 1
- c3(2,2,2) = 2
- c3(3,3,3) = 3
- c3(4,4,4) = 4
- c3(5,5,5) = 5
- !$acc end parallel
- if (c3(1,1,1) .ne. 1) call abort
- if (c3(2,2,2) .ne. 2) call abort
- if (c3(3,3,3) .ne. 3) call abort
- if (c3(4,4,4) .ne. 4) call abort
- if (c3(5,5,5) .ne. 5) call abort
- deallocate(c3)
- allocate (c3(0:4,0:4,0:4))
- if (.not.allocated (c3)) call abort()
- c3 = 12
- !$acc parallel copy(c3(0:4,0:4,0:4))
- c3(0,0,0) = 1
- c3(1,1,1) = 2
- c3(2,2,2) = 3
- c3(3,3,3) = 4
- c3(4,4,4) = 5
- !$acc end parallel
- if (c3(0,0,0) .ne. 1) call abort
- if (c3(1,1,1) .ne. 2) call abort
- if (c3(2,2,2) .ne. 3) call abort
- if (c3(3,3,3) .ne. 4) call abort
- if (c3(4,4,4) .ne. 5) call abort
- deallocate(c3)
- allocate (a1(5))
- if (.not.allocated (a1)) call abort()
- allocate (b1(5))
- if (.not.allocated (b1)) call abort()
- allocate (c1(5))
- if (.not.allocated (c1)) call abort()
- a1 = 10
- b1 = 3
- c1 = 7
-
- !$acc parallel copyin(a1(1:5)) create(c1(1:5)) copyout(b1(1:5))
- c1(1) = a1(1)
- c1(2) = a1(2)
- c1(3) = a1(3)
- c1(4) = a1(4)
- c1(5) = a1(5)
- b1(1) = c1(1)
- b1(2) = c1(2)
- b1(3) = c1(3)
- b1(4) = c1(4)
- b1(5) = c1(5)
- !$acc end parallel
- if (b1(1) .ne. 10) call abort
- if (b1(2) .ne. 10) call abort
- if (b1(3) .ne. 10) call abort
- if (b1(4) .ne. 10) call abort
- if (b1(5) .ne. 10) call abort
- deallocate(a1)
- deallocate(b1)
- deallocate(c1)
- allocate (a1(0:4))
- if (.not.allocated (a1)) call abort()
- allocate (b1(0:4))
- if (.not.allocated (b1)) call abort()
- allocate (c1(0:4))
- if (.not.allocated (c1)) call abort()
- a1 = 10
- b1 = 3
- c1 = 7
-
- !$acc parallel copyin(a1(0:4)) create(c1(0:4)) copyout(b1(0:4))
- c1(0) = a1(0)
- c1(1) = a1(1)
- c1(2) = a1(2)
- c1(3) = a1(3)
- c1(4) = a1(4)
- b1(0) = c1(0)
- b1(1) = c1(1)
- b1(2) = c1(2)
- b1(3) = c1(3)
- b1(4) = c1(4)
- !$acc end parallel
- if (b1(0) .ne. 10) call abort
- if (b1(1) .ne. 10) call abort
- if (b1(2) .ne. 10) call abort
- if (b1(3) .ne. 10) call abort
- if (b1(4) .ne. 10) call abort
- deallocate(a1)
- deallocate(b1)
- deallocate(c1)
- allocate (a1(5))
- if (.not.allocated (a1)) call abort()
- a1 = 10
- !$acc parallel copy(a1(2:3))
- a1(2) = 2
- a1(3) = 3
- !$acc end parallel
- if (a1(1) .ne. 10) call abort
- if (a1(2) .ne. 2) call abort
- if (a1(3) .ne. 3) call abort
- if (a1(4) .ne. 10) call abort
- if (a1(5) .ne. 10) call abort
- deallocate(a1)
- end program test
|