| 1 |
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp |
| 2 |
! OpenMP Version 4.5 |
| 3 |
! Various checks with the nesting of BARRIER construct |
| 4 |
|
| 5 |
program omp_nest_barrier |
| 6 |
integer i, k, j |
| 7 |
k = 0; |
| 8 |
|
| 9 |
!$omp do |
| 10 |
do i = 1, 10 |
| 11 |
k = k + 1 |
| 12 |
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. |
| 13 |
!$omp barrier |
| 14 |
j = j -1 |
| 15 |
end do |
| 16 |
|
| 17 |
!$omp do simd |
| 18 |
do i = 1, 10 |
| 19 |
k = k + 1 |
| 20 |
!ERROR: The only OpenMP constructs that can be encountered during execution of a 'SIMD' region are the `ATOMIC` construct, the `LOOP` construct, the `SIMD` construct and the `ORDERED` construct with the `SIMD` clause. |
| 21 |
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. |
| 22 |
!$omp barrier |
| 23 |
j = j -1 |
| 24 |
end do |
| 25 |
|
| 26 |
!$omp parallel do |
| 27 |
do i = 1, 10 |
| 28 |
k = k + 1 |
| 29 |
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. |
| 30 |
!$omp barrier |
| 31 |
j = j -1 |
| 32 |
end do |
| 33 |
|
| 34 |
!$omp parallel do simd |
| 35 |
do i = 1, 10 |
| 36 |
k = k + 1 |
| 37 |
!ERROR: The only OpenMP constructs that can be encountered during execution of a 'SIMD' region are the `ATOMIC` construct, the `LOOP` construct, the `SIMD` construct and the `ORDERED` construct with the `SIMD` clause. |
| 38 |
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. |
| 39 |
!$omp barrier |
| 40 |
j = j -1 |
| 41 |
end do |
| 42 |
|
| 43 |
!$omp parallel |
| 44 |
do i = 1, 10 |
| 45 |
k = k + 1 |
| 46 |
!$omp barrier |
| 47 |
j = j -1 |
| 48 |
end do |
| 49 |
!$omp end parallel |
| 50 |
|
| 51 |
!$omp task |
| 52 |
do i = 1, 10 |
| 53 |
k = k + 1 |
| 54 |
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. |
| 55 |
!$omp barrier |
| 56 |
j = j -1 |
| 57 |
end do |
| 58 |
!$omp end task |
| 59 |
|
| 60 |
!$omp taskloop |
| 61 |
do i = 1, 10 |
| 62 |
k = k + 1 |
| 63 |
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. |
| 64 |
!$omp barrier |
| 65 |
j = j -1 |
| 66 |
end do |
| 67 |
!$omp end taskloop |
| 68 |
|
| 69 |
!$omp critical |
| 70 |
do i = 1, 10 |
| 71 |
k = k + 1 |
| 72 |
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. |
| 73 |
!$omp barrier |
| 74 |
j = j -1 |
| 75 |
end do |
| 76 |
!$omp end critical |
| 77 |
|
| 78 |
!$omp master |
| 79 |
do i = 1, 10 |
| 80 |
k = k + 1 |
| 81 |
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. |
| 82 |
!$omp barrier |
| 83 |
j = j -1 |
| 84 |
end do |
| 85 |
!$omp end master |
| 86 |
|
| 87 |
!$omp ordered |
| 88 |
do i = 1, 10 |
| 89 |
k = k + 1 |
| 90 |
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. |
| 91 |
!$omp barrier |
| 92 |
j = j -1 |
| 93 |
end do |
| 94 |
!$omp end ordered |
| 95 |
|
| 96 |
!$omp ordered |
| 97 |
do i = 1, 10 |
| 98 |
!ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region. |
| 99 |
!$omp distribute |
| 100 |
do k =1, 10 |
| 101 |
print *, "hello" |
| 102 |
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. |
| 103 |
!$omp barrier |
| 104 |
j = j -1 |
| 105 |
end do |
| 106 |
!$omp end distribute |
| 107 |
end do |
| 108 |
!$omp end ordered |
| 109 |
|
| 110 |
!$omp master |
| 111 |
do i = 1, 10 |
| 112 |
!ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region. |
| 113 |
!$omp distribute |
| 114 |
do k =1, 10 |
| 115 |
print *, "hello" |
| 116 |
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. |
| 117 |
!$omp barrier |
| 118 |
j = j -1 |
| 119 |
end do |
| 120 |
!$omp end distribute |
| 121 |
end do |
| 122 |
!$omp end master |
| 123 |
|
| 124 |
!$omp critical |
| 125 |
do i = 1, 10 |
| 126 |
!ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region. |
| 127 |
!$omp distribute |
| 128 |
do k =1, 10 |
| 129 |
print *, "hello" |
| 130 |
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. |
| 131 |
!$omp barrier |
| 132 |
j = j -1 |
| 133 |
end do |
| 134 |
!$omp end distribute |
| 135 |
end do |
| 136 |
!$omp end critical |
| 137 |
|
| 138 |
!$omp taskloop |
| 139 |
do i = 1, 10 |
| 140 |
!ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region. |
| 141 |
!$omp distribute |
| 142 |
do k =1, 10 |
| 143 |
print *, "hello" |
| 144 |
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. |
| 145 |
!$omp barrier |
| 146 |
j = j -1 |
| 147 |
end do |
| 148 |
!$omp end distribute |
| 149 |
end do |
| 150 |
!$omp end taskloop |
| 151 |
|
| 152 |
!$omp task |
| 153 |
do i = 1, 10 |
| 154 |
!ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region. |
| 155 |
!$omp distribute |
| 156 |
do k =1, 10 |
| 157 |
print *, "hello" |
| 158 |
!ERROR: `BARRIER` region may not be closely nested inside of `WORKSHARING`, `LOOP`, `TASK`, `TASKLOOP`,`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region. |
| 159 |
!$omp barrier |
| 160 |
j = j -1 |
| 161 |
end do |
| 162 |
!$omp end distribute |
| 163 |
end do |
| 164 |
!$omp end task |
| 165 |
|
| 166 |
end program omp_nest_barrier |