brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.5 KiB · a41c461 Raw
271 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=512! Check OpenMP clause validity for the following directives:3!     2.10 Device constructs4program main5   use iso_c_binding6 7  real(8) :: arrayA(256), arrayB(256)8  integer :: N9  type(c_ptr) :: cptr10 11  arrayA = 1.414d012  arrayB = 3.14d013  N = 25614 15  !$omp target map(arrayA)16  do i = 1, N17     a = 3.14d018  enddo19  !$omp end target20 21  !$omp target device(0)22  do i = 1, N23     a = 3.14d024  enddo25  !$omp end target26 27  !ERROR: At most one DEVICE clause can appear on the TARGET directive28  !$omp target device(0) device(1)29  do i = 1, N30     a = 3.14d031  enddo32  !$omp end target33 34  !ERROR: SCHEDULE clause is not allowed on the TARGET directive35  !$omp target schedule(static)36  do i = 1, N37     a = 3.14d038  enddo39  !$omp end target40 41  !$omp target defaultmap(tofrom:scalar)42  do i = 1, N43     a = 3.14d044  enddo45  !$omp end target46 47  !$omp target defaultmap(tofrom)48  do i = 1, N49     a = 3.14d050  enddo51  !$omp end target52 53  !ERROR: At most one DEFAULTMAP clause can appear on the TARGET directive54  !$omp target defaultmap(tofrom:scalar) defaultmap(tofrom:scalar)55  do i = 1, N56     a = 3.14d057  enddo58  !$omp end target59 60  !$omp target thread_limit(4)61  do i = 1, N62     a = 3.14d063  enddo64  !$omp end target65 66  !ERROR: At most one THREAD_LIMIT clause can appear on the TARGET directive67  !$omp target thread_limit(4) thread_limit(8)68  do i = 1, N69     a = 3.14d070  enddo71  !$omp end target72 73  !$omp teams num_teams(3) thread_limit(10) default(shared) private(i) shared(a)74  do i = 1, N75     a = 3.14d076  enddo77  !$omp end teams78 79  !ERROR: At most one NUM_TEAMS clause can appear on the TEAMS directive80  !$omp teams num_teams(2) num_teams(3)81  do i = 1, N82     a = 3.14d083  enddo84  !$omp end teams85 86  !ERROR: The parameter of the NUM_TEAMS clause must be a positive integer expression87  !$omp teams num_teams(-1)88  do i = 1, N89     a = 3.14d090  enddo91  !$omp end teams92 93  !ERROR: At most one THREAD_LIMIT clause can appear on the TEAMS directive94  !$omp teams thread_limit(2) thread_limit(3)95  do i = 1, N96     a = 3.14d097  enddo98  !$omp end teams99 100  !ERROR: The parameter of the THREAD_LIMIT clause must be a positive integer expression101  !$omp teams thread_limit(-1)102  do i = 1, N103     a = 3.14d0104  enddo105  !$omp end teams106 107  !ERROR: At most one DEFAULT clause can appear on the TEAMS directive108  !$omp teams default(shared) default(private)109  do i = 1, N110     a = 3.14d0111  enddo112  !$omp end teams113 114  !$omp target teams num_teams(2) defaultmap(tofrom:scalar)115  do i = 1, N116      a = 3.14d0117  enddo118  !$omp end target teams119 120  !$omp target map(tofrom:a)121  do i = 1, N122     a = 3.14d0123  enddo124  !$omp end target125 126  !ERROR: Only the ALLOC, FROM, TO, TOFROM map types are permitted for MAP clauses on the TARGET directive127  !$omp target map(delete:a)128  do i = 1, N129     a = 3.14d0130  enddo131  !$omp end target132 133  !$omp target data device(0) map(to:a)134  do i = 1, N135    a = 3.14d0136  enddo137  !$omp end target data138 139  !$omp target data device(0) use_device_addr(cptr)140   cptr = c_null_ptr141  !$omp end target data142 143  !$omp target data device(0) use_device_addr(cptr)144   cptr = c_null_ptr145  !$omp end target data146 147  !ERROR: At least one of MAP, USE_DEVICE_ADDR, USE_DEVICE_PTR clause must appear on the TARGET DATA directive148  !$omp target data device(0)149  do i = 1, N150     a = 3.14d0151  enddo152  !$omp end target data153 154  !ERROR: The device expression of the DEVICE clause must be a positive integer expression155  !$omp target enter data map(alloc:A) device(-2)156 157  !ERROR: The device expression of the DEVICE clause must be a positive integer expression158  !$omp target exit data map(delete:A) device(-2)159 160  !ERROR: At most one IF clause can appear on the TARGET ENTER DATA directive161  !$omp target enter data map(to:a) if(.true.) if(.false.)162 163  !ERROR: Only the ALLOC, TO, TOFROM map types are permitted for MAP clauses on the TARGET ENTER DATA directive164  !$omp target enter data map(from:a)165 166  !$omp target exit data map(delete:a)167 168  !ERROR: At most one DEVICE clause can appear on the TARGET EXIT DATA directive169  !$omp target exit data map(from:a) device(0) device(1)170 171  !ERROR: Only the DELETE, FROM, RELEASE, TOFROM map types are permitted for MAP clauses on the TARGET EXIT DATA directive172  !$omp target exit data map(to:a)173 174  !$omp target update if(.true.) device(1) to(a) from(b) depend(inout:c) nowait175 176  !ERROR: At most one IF clause can appear on the TARGET UPDATE directive177  !$omp target update to(a) if(.true.) if(.false.)178 179  !ERROR: At most one DEVICE clause can appear on the TARGET UPDATE directive180  !$omp target update device(0) device(1) from(b)181 182  !$omp target183  !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.184  !$omp distribute185  do i = 1, N186     a = 3.14d0187  enddo188  !$omp end distribute189  !$omp end target190 191  !$omp target192  !$omp teams193  !$omp distribute194  do i = 1, N195     a = 3.14d0196  enddo197  !$omp end distribute198  !$omp end teams199  !$omp end target200 201  !$omp target202  !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.203  !ERROR: At most one COLLAPSE clause can appear on the DISTRIBUTE directive204  !$omp distribute collapse(2) collapse(3)205  do i = 1, N206     do j = 1, N207        do k = 1, N208           a = 3.14d0209        enddo210     enddo211  enddo212  !$omp end distribute213  !$omp end target214 215  !$omp target216  !$omp teams217  !ERROR: At most one COLLAPSE clause can appear on the DISTRIBUTE directive218  !$omp distribute collapse(2) collapse(3)219  do i = 1, N220     do j = 1, N221        do k = 1, N222           a = 3.14d0223        enddo224     enddo225  enddo226  !$omp end distribute227  !$omp end teams228  !$omp end target229 230  !$omp target231  !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.232  !$omp distribute dist_schedule(static, 2)233  do i = 1, N234     a = 3.14d0235  enddo236  !$omp end distribute237  !$omp end target238 239  !$omp target240  !$omp teams241  !$omp distribute dist_schedule(static, 2)242  do i = 1, N243     a = 3.14d0244  enddo245  !$omp end distribute246  !$omp end teams247  !$omp end target248 249  !$omp target250  !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.251  !ERROR: At most one DIST_SCHEDULE clause can appear on the DISTRIBUTE directive252  !$omp distribute dist_schedule(static, 2) dist_schedule(static, 3)253  do i = 1, N254     a = 3.14d0255  enddo256  !$omp end distribute257  !$omp end target258 259  !$omp target260  !$omp teams261  !ERROR: At most one DIST_SCHEDULE clause can appear on the DISTRIBUTE directive262  !$omp distribute dist_schedule(static, 2) dist_schedule(static, 3)263  do i = 1, N264     a = 3.14d0265  enddo266  !$omp end distribute267  !$omp end teams268  !$omp end target269 270end program main271