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
|
! RUN: %python %S/../test_errors.py %s %flang -fopenacc
! Check OpenACC clause validity for the following construct and directive:
! 2.10 Cache
program openacc_cache_validity
implicit none
type atype
real(8), dimension(10) :: arr
real(8) :: s
end type atype
integer :: i
integer, parameter :: N = 256
real(8), dimension(N, N) :: aa
type(atype) :: t
type(atype), dimension(10) :: ta
real(8), dimension(N) :: a
do i = 1, N
!$acc cache(a(i))
!$acc cache(a(1:2,3:4))
!$acc cache(a)
!$acc cache(readonly: a, aa)
!$acc cache(readonly: a(i), aa(i, i))
!$acc cache(t%arr)
!$acc cache(ta(1:2)%arr)
!$acc cache(ta(1:2)%arr(1:4))
!$acc cache(i)
!$acc cache(t%s)
!ERROR: Only array element or subarray are allowed in CACHE directive
!$acc cache(t)
!ERROR: Only array element or subarray are allowed in CACHE directive
!$acc cache(/i/)
!ERROR: The CACHE directive requires at least one of the bounds in the array section subscript triplet to be specified
!$acc cache(a(:))
!ERROR: The CACHE directive requires at least one of the bounds in the array section subscript triplet to be specified
!$acc cache(aa(:,:))
!ERROR: The CACHE directive does not support strided array sections
!$acc cache(a(1:10:2))
!ERROR: The CACHE directive does not support strided array sections
!$acc cache(aa(1:10:2, 1:5))
end do
!ERROR: The CACHE directive must be inside a loop
!$acc cache(a)
end program openacc_cache_validity
|