Debian Codegraph @

libgomp/testsuite/libgomp.oacc-fortran/array-stride-dt-1.f90

raw
1 ! { dg-do run }
2
3 type t
4 integer, allocatable :: A(:,:)
5 end type t
6
7 type(t), allocatable :: b(:)
8
9 integer :: i
10
11 allocate(b(1:20))
12 do i=1,20
13 allocate(b(i)%A(1:20,1:20))
14 end do
15
16 do i=1,20
17 b(i)%A(:,:) = 0
18 end do
19
20 !$acc enter data copyin(b)
21 do i=1,20
22 !$acc enter data copyin(b(i)%A)
23 end do
24
25 b(1)%A(:,:) = 5
26
27 !$acc update device(b(::2))
28 !$acc update device(b(1)%A(::3,::4))
29
30 do i=1,20
31 !$acc exit data copyout(b(i)%A)
32 end do
33 !$acc exit data copyout(b)
34
35 ! This is necessarily conservative because the "update" is allowed to copy
36 ! e.g. the whole of the containing block for a discontinuous update.
37 ! Try to ensure that the update covers a sufficient portion of the array.
38
39 if (any(b(1)%A(::3,::4) .ne. 5)) stop 1
40 do i=2,20
41 if (any(b(i)%A(:,:) .ne. 0)) stop 2
42 end do
43
44 end