blob: 07fb86469573732f45753da646f94cf4170cda7b (
plain)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
! RUN: %python %S/../test_errors.py %s %flang -fopenacc
! Check OpenACC clause validity for the following construct and directive:
! 2.12 Atomic
program openacc_atomic_validity
implicit none
integer :: i
integer, parameter :: N = 256
integer, dimension(N) :: c
logical :: l
!$acc parallel
!$acc atomic update
c(i) = c(i) + 1
!$acc atomic update
c(i) = c(i) + 1
!$acc end atomic
!$acc atomic write
c(i) = 10
!$acc atomic write if(l)
c(i) = 10
!$acc atomic write
c(i) = 10
!$acc end atomic
!$acc atomic write if(.true.)
c(i) = 10
!$acc end atomic
!$acc atomic read
i = c(i)
!$acc atomic read if(.true.)
i = c(i)
!$acc atomic read
i = c(i)
!$acc end atomic
!$acc atomic read if(l)
i = c(i)
!$acc end atomic
!ERROR: FINALIZE clause is not allowed on the ATOMIC READ FINALIZE IF(L)
!$acc atomic read finalize if(l)
i = c(i)
!$acc end atomic
!$acc atomic capture
c(i) = i
i = i + 1
!$acc end atomic
!$acc atomic capture if(l .EQV. .false.)
c(i) = i
i = i + 1
!$acc end atomic
!$acc atomic update
!ERROR: RHS of atomic update statement must be scalar
!ERROR: LHS of atomic update statement must be scalar
c = c + 1
!$acc atomic update if(i == 0)
c(i) = c(i) + 1
!ERROR: At most one IF clause can appear on the ATOMIC UPDATE IF(I == 0) IF(.TRUE.)
!$acc atomic update if(i == 0) if(.true.)
c(i) = c(i) + 1
!$acc end parallel
end program openacc_atomic_validity
|