1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
! { dg-do run }
program asyncwait
integer, parameter :: N = 64
real, allocatable :: a(:), b(:), c(:)
integer i
allocate (a(N))
allocate (b(N))
allocate (c(N))
!$acc parallel async (0)
!$acc loop
do i = 1, N
a(i) = 1
end do
!$acc end parallel
!$acc parallel async (1)
!$acc loop
do i = 1, N
b(i) = 1
end do
!$acc end parallel
!$acc parallel wait (0, 1)
!$acc loop
do i = 1, N
c(i) = a(i) + b(i)
end do
!$acc end parallel
do i = 1, N
if (c(i) .ne. 2.0) STOP 1
end do
!$acc kernels async (0)
!$acc loop
do i = 1, N
a(i) = 1
end do
!$acc end kernels
!$acc kernels async (1)
!$acc loop
do i = 1, N
b(i) = 1
end do
!$acc end kernels
!$acc kernels wait (0, 1)
!$acc loop
do i = 1, N
c(i) = a(i) + b(i)
end do
!$acc end kernels
do i = 1, N
if (c(i) .ne. 2.0) STOP 2
end do
deallocate (a)
deallocate (b)
deallocate (c)
end program asyncwait
|