brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.7 KiB · 0c576a9 Raw
125 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp2! OpenMP Version 4.53! 2.15.3.4 firstprivate Clause4! Variables that appear in a firstprivate clause on a distribute or5! worksharing constructs must not appear in the private or6! reduction clause in a teams or parallel constructs in the outer context7!8! A list item may appear in a firstprivate or lastprivate clause but not both on9! a distribute directive10 11program omp_firstprivate12  integer :: i, a(10), b(10), c(10)13 14  a = 1015  b = 2016 17  !ERROR: TARGET construct with nested TEAMS region contains statements or directives outside of the TEAMS construct18  !$omp target19  !$omp teams private(a, b)20  !ERROR: FIRSTPRIVATE variable 'a' is PRIVATE in outer context21  !$omp distribute firstprivate(a)22  do i = 1, 1023    a(i) = a(i) + b(i) - i24  end do25  !$omp end distribute26  !$omp end teams27  !$omp teams reduction(+:a)28  !ERROR: FIRSTPRIVATE variable 'a' is PRIVATE in outer context29  !$omp distribute firstprivate(a)30  do i = 1, 1031   b(i) = b(i) + a(i) + i32  end do33  !$omp end distribute34  !$omp end teams35 36  !$omp teams distribute firstprivate(a) lastprivate(b)37  do i = 1, 1038    a(i) = a(i) + b(i) - i39  end do40  !$omp end teams distribute41  !ERROR: Variable 'b' may not appear on both FIRSTPRIVATE and LASTPRIVATE clauses on a TEAMS DISTRIBUTE construct42  !$omp teams distribute firstprivate(a,b) lastprivate(b)43  do i = 1, 1044    a(i) = a(i) + b(i) - i45  end do46  !$omp end teams distribute47  !ERROR: Variable 'a' may not appear on both FIRSTPRIVATE and LASTPRIVATE clauses on a TEAMS DISTRIBUTE construct48  !ERROR: Variable 'b' may not appear on both FIRSTPRIVATE and LASTPRIVATE clauses on a TEAMS DISTRIBUTE construct49  !$omp teams distribute firstprivate(a,b) lastprivate(a,b)50  do i = 1, 1051    a(i) = a(i) + b(i) - i52  end do53  !$omp end teams distribute54  !ERROR: Variable 'b' may not appear on both FIRSTPRIVATE and LASTPRIVATE clauses on a TEAMS DISTRIBUTE construct55  !$omp teams distribute lastprivate(a,b) firstprivate(b)56  do i = 1, 1057    a(i) = a(i) + b(i) - i58  end do59  !$omp end teams distribute60  !ERROR: Variable 'b' may not appear on both FIRSTPRIVATE and LASTPRIVATE clauses on a TEAMS DISTRIBUTE construct61  !ERROR: Variable 'a' may not appear on both FIRSTPRIVATE and LASTPRIVATE clauses on a TEAMS DISTRIBUTE construct62  !$omp teams distribute lastprivate(a,b) firstprivate(b,a)63  do i = 1, 1064    a(i) = a(i) + b(i) - i65  end do66  !$omp end teams distribute67  !$omp end target68 69  print *, a, b70 71  !$omp parallel private(a,b)72  !ERROR: FIRSTPRIVATE variable 'b' is PRIVATE in outer context73  !$omp do firstprivate(b)74  do i = 1, 1075    c(i) = a(i) + b(i) + i76  end do77  !$omp end do78  !$omp end parallel79 80  !$omp parallel reduction(*:a)81  !ERROR: FIRSTPRIVATE variable 'a' is PRIVATE in outer context82  !$omp do firstprivate(a,b)83  do i = 1, 1084    c(i) =  c(i) * a(i) * b(i) * i85  end do86  !$omp end do87  !$omp end parallel88 89  !$omp parallel reduction(+:a)90  !ERROR: FIRSTPRIVATE variable 'a' is PRIVATE in outer context91  !$omp sections firstprivate(a, b)92  !$omp section93  c = c * a + b94  !$omp end sections95  !$omp end parallel96 97  !$omp parallel reduction(*:a)98  !ERROR: FIRSTPRIVATE variable 'a' is PRIVATE in outer context99  !$omp task firstprivate(a,b)100  c =  c * a * b101  !$omp end task102  !$omp end parallel103 104  !$omp parallel reduction(+:b)105  !ERROR: FIRSTPRIVATE variable 'b' is PRIVATE in outer context106  !$omp taskloop firstprivate(b)107  do i = 1, 10108    c(i) = a(i) + b(i) + i109    a = a+i110    b = b-i111  end do112  !$omp end taskloop113  !$omp end parallel114 115  !$omp parallel firstprivate(a)116  !ERROR: FIRSTPRIVATE variable 'a' is PRIVATE in outer context117  !$omp single firstprivate(a)118  print *, a119  !$omp end single120  !$omp end parallel121 122  print *, c123 124end program omp_firstprivate125