| 1 |
! RUN: %python %S/../test_errors.py %s %flang -fopenacc |
| 2 |
|
| 3 |
! Check OpenACC clause validity for the following construct and directive: |
| 4 |
! 2.14.3 Set |
| 5 |
|
| 6 |
program openacc_clause_validity |
| 7 |
|
| 8 |
implicit none |
| 9 |
|
| 10 |
integer :: i, j |
| 11 |
integer, parameter :: N = 256 |
| 12 |
real(8), dimension(N) :: a |
| 13 |
|
| 14 |
!$acc parallel |
| 15 |
!ERROR: Directive SET may not be called within a compute region |
| 16 |
!$acc set default_async(i) |
| 17 |
!$acc end parallel |
| 18 |
|
| 19 |
!$acc serial |
| 20 |
!ERROR: Directive SET may not be called within a compute region |
| 21 |
!$acc set default_async(i) |
| 22 |
!$acc end serial |
| 23 |
|
| 24 |
!$acc kernels |
| 25 |
!ERROR: Directive SET may not be called within a compute region |
| 26 |
!$acc set default_async(i) |
| 27 |
!$acc end kernels |
| 28 |
|
| 29 |
!$acc parallel |
| 30 |
!$acc loop |
| 31 |
do i = 1, N |
| 32 |
!ERROR: Directive SET may not be called within a compute region |
| 33 |
!$acc set default_async(i) |
| 34 |
a(i) = 3.14 |
| 35 |
end do |
| 36 |
!$acc end parallel |
| 37 |
|
| 38 |
!$acc serial |
| 39 |
!$acc loop |
| 40 |
do i = 1, N |
| 41 |
!ERROR: Directive SET may not be called within a compute region |
| 42 |
!$acc set default_async(i) |
| 43 |
a(i) = 3.14 |
| 44 |
end do |
| 45 |
!$acc end serial |
| 46 |
|
| 47 |
!$acc kernels |
| 48 |
!$acc loop |
| 49 |
do i = 1, N |
| 50 |
!ERROR: Directive SET may not be called within a compute region |
| 51 |
!$acc set default_async(i) |
| 52 |
a(i) = 3.14 |
| 53 |
end do |
| 54 |
!$acc end kernels |
| 55 |
|
| 56 |
!$acc parallel loop |
| 57 |
do i = 1, N |
| 58 |
!ERROR: Directive SET may not be called within a compute region |
| 59 |
!$acc set default_async(i) |
| 60 |
a(i) = 3.14 |
| 61 |
end do |
| 62 |
|
| 63 |
!$acc serial loop |
| 64 |
do i = 1, N |
| 65 |
!ERROR: Directive SET may not be called within a compute region |
| 66 |
!$acc set default_async(i) |
| 67 |
a(i) = 3.14 |
| 68 |
end do |
| 69 |
|
| 70 |
!$acc kernels loop |
| 71 |
do i = 1, N |
| 72 |
!ERROR: Directive SET may not be called within a compute region |
| 73 |
!$acc set default_async(i) |
| 74 |
a(i) = 3.14 |
| 75 |
end do |
| 76 |
|
| 77 |
!ERROR: At least one of DEFAULT_ASYNC, DEVICE_NUM, DEVICE_TYPE clause must appear on the SET directive |
| 78 |
!$acc set |
| 79 |
|
| 80 |
!ERROR: At least one of DEFAULT_ASYNC, DEVICE_NUM, DEVICE_TYPE clause must appear on the SET directive |
| 81 |
!$acc set if(.TRUE.) |
| 82 |
|
| 83 |
!ERROR: At most one DEFAULT_ASYNC clause can appear on the SET directive |
| 84 |
!$acc set default_async(2) default_async(1) |
| 85 |
|
| 86 |
!ERROR: At most one DEFAULT_ASYNC clause can appear on the SET directive |
| 87 |
!$acc set default_async(2) default_async(1) |
| 88 |
|
| 89 |
!ERROR: At most one DEVICE_NUM clause can appear on the SET directive |
| 90 |
!$acc set device_num(1) device_num(i) |
| 91 |
|
| 92 |
!ERROR: At most one DEVICE_TYPE clause can appear on the SET directive |
| 93 |
!$acc set device_type(*) device_type(nvidia) |
| 94 |
|
| 95 |
!$acc set default_async(2) |
| 96 |
!$acc set default_async(i) |
| 97 |
!$acc set device_num(1) |
| 98 |
!$acc set device_num(i) |
| 99 |
!$acc set device_type(default) |
| 100 |
!$acc set device_num(1) default_async(2) device_type(*) |
| 101 |
|
| 102 |
!ERROR: The DEVICE_TYPE clause on the SET directive accepts only one value |
| 103 |
!$acc set device_type(*, default) |
| 104 |
|
| 105 |
!ERROR: At least one of DEFAULT_ASYNC, DEVICE_NUM, DEVICE_TYPE clause must appear on the SET directive |
| 106 |
!$acc set |
| 107 |
|
| 108 |
end program openacc_clause_validity |