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