4 real, allocatable :: a(:), b(:), c(:), d(:), e(:)
18 !$acc enter data copyin (a(1:N)) copyin (b(1:N)) copyin (N) async
20 !$acc parallel async wait
27 !$acc update host (a(1:N), b(1:N)) async wait
31 if (a(i) .ne. 3.0) STOP 1
32 if (b(i) .ne. 3.0) STOP 2
38 !$acc update device (a(1:N), b(1:N)) async (1)
40 !$acc parallel async (1) wait (1)
47 !$acc update self (a(1:N), b(1:N)) async (1) wait (1)
51 if (a(i) .ne. 2.0) STOP 3
52 if (b(i) .ne. 2.0) STOP 4
60 !$acc enter data copyin (c(1:N), d(1:N)) async (1)
61 !$acc update device (a(1:N), b(1:N)) async (1)
63 !$acc parallel async (1)
65 b(i) = (a(i) * a(i) * a(i)) / a(i)
69 !$acc parallel async (1)
71 c(i) = (a(i) * 4) / a(i)
75 !$acc parallel async (1)
77 d(i) = ((a(i) * a(i) + a(i)) / a(i)) - a(i)
81 !$acc update host (a(1:N), b(1:N), c(1:N), d(1:N)) async (1) wait (1)
86 if (a(i) .ne. 3.0) STOP 5
87 if (b(i) .ne. 9.0) STOP 6
88 if (c(i) .ne. 4.0) STOP 7
89 if (d(i) .ne. 1.0) STOP 8
98 !$acc enter data copyin (e(1:N)) async (1)
99 !$acc update device (a(1:N), b(1:N), c(1:N), d(1:N)) async (1)
101 !$acc parallel async (1)
103 b(i) = (a(i) * a(i) * a(i)) / a(i)
107 !$acc parallel async (1)
109 c(i) = (a(i) * 4) / a(i)
113 !$acc parallel async (1)
115 d(i) = ((a(i) * a(i) + a(i)) / a(i)) - a(i)
119 !$acc parallel wait (1) async (1)
121 e(i) = a(i) + b(i) + c(i) + d(i)
125 !$acc update host (a(1:N), b(1:N), c(1:N), d(1:N), e(1:N)) async (1) wait (1)
127 !$acc exit data delete (N, a(1:N), b(1:N), c(1:N), d(1:N), e(1:N))
130 if (a(i) .ne. 2.0) STOP 9
131 if (b(i) .ne. 4.0) STOP 10
132 if (c(i) .ne. 4.0) STOP 11
133 if (d(i) .ne. 1.0) STOP 12
134 if (e(i) .ne. 11.0) STOP 13
136 end program asyncwait