1 ! Test ACC UPDATE with derived types.
6 integer, parameter :: n
= 10
11 integer(8) :: a
, b
, c(n
)
30 !$acc enter data copyin(var)
32 !$acc parallel loop present(var)
36 !$acc end parallel loop
38 !$acc update host(var%a)
40 if (var
%a
/= var
%b
) stop 1
44 !$acc update device(var%b)
46 !$acc parallel loop present(var)
50 !$acc end parallel loop
52 !$acc update host(var%a)
54 if (var
%a
/= var
%b
) stop 2
56 !$acc parallel loop present (var)
60 !$acc end parallel loop
62 !$acc update host(var%c)
67 if (var
%c(i
) /= i
) stop 3
71 !$acc update device(var%a)
72 !$acc update device(var%c)
76 !$acc parallel loop present(var) reduction(+:res)
78 if (var
%c(i
) /= var
%a
) res
= res
+ 1
85 !$acc update device(var%c)
87 !$acc parallel loop present(var)
91 !$acc end parallel loop
93 !$acc update host(var%c(5))
96 if (i
/= 5 .and
. var
%c(i
) /= 0) stop 5
97 if (i
== 5 .and
. var
%c(i
) /= 1) stop 6
100 !$acc parallel loop present(var)
104 !$acc end parallel loop
106 !$acc update host(var%in%d)
109 if (var
%in
%d(i
) /= var
%a
) stop 7
114 !$acc update device(var%c)
118 !$acc parallel loop present(var)
122 !$acc end parallel loop
124 !$acc update host(var%c(n/2:n))
127 if (i
< n
/2 .and
. var
%c(i
) /= -1) stop 8
128 if (i
>= n
/2 .and
. var
%c(i
) /= i
) stop 9
132 !$acc update device(var%in%d)
134 !$acc parallel loop present(var)
138 !$acc end parallel loop
140 !$acc update host(var%in%d(5))
143 if (i
/= 5 .and
. var
%in
%d(i
) /= 0) stop 10
144 if (i
== 5 .and
. var
%in
%d(i
) /= 1) stop 11
147 !$acc exit data delete(var)
149 call derived_acc_subroutine(var
)
150 end program derived_acc
152 subroutine derived_acc_subroutine(var
)
166 !$acc enter data copyin(var)
168 !$acc parallel loop present(var)
172 !$acc end parallel loop
174 !$acc update host(var%a)
176 if (var
%a
/= var
%b
) stop 12
180 !$acc update device(var%b)
182 !$acc parallel loop present(var)
186 !$acc end parallel loop
188 !$acc update host(var%a)
190 if (var
%a
/= var
%b
) stop 13
192 !$acc parallel loop present (var)
196 !$acc end parallel loop
198 !$acc update host(var%c)
203 if (var
%c(i
) /= i
) stop 14
207 !$acc update device(var%a)
208 !$acc update device(var%c)
212 !$acc parallel loop present(var) reduction(+:res)
214 if (var
%c(i
) /= var
%a
) res
= res
+ 1
217 if (res
/= 0) stop 15
221 !$acc update device(var%c)
223 !$acc parallel loop present(var)
227 !$acc end parallel loop
229 !$acc update host(var%c(5))
232 if (i
/= 5 .and
. var
%c(i
) /= 0) stop 16
233 if (i
== 5 .and
. var
%c(i
) /= 1) stop 17
236 !$acc parallel loop present(var)
240 !$acc end parallel loop
242 !$acc update host(var%in%d)
245 if (var
%in
%d(i
) /= var
%a
) stop 18
250 !$acc update device(var%c)
254 !$acc parallel loop present(var)
258 !$acc end parallel loop
260 !$acc update host(var%c(n/2:n))
263 if (i
< n
/2 .and
. var
%c(i
) /= -1) stop 19
264 if (i
>= n
/2 .and
. var
%c(i
) /= i
) stop 20
268 !$acc update device(var%in%d)
270 !$acc parallel loop present(var)
274 !$acc end parallel loop
276 !$acc update host(var%in%d(5))
279 if (i
/= 5 .and
. var
%in
%d(i
) /= 0) stop 21
280 if (i
== 5 .and
. var
%in
%d(i
) /= 1) stop 22
283 !$acc exit data delete(var)
284 end subroutine derived_acc_subroutine