126 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang -fopenmp2! OpenMP Version 5.13! Check OpenMP construct validity for the following directives:4! 2.19.9 Ordered Construct5 6subroutine sub1()7 integer :: i, j, N = 108 real :: arrayA(10), arrayB(10)9 real, external :: foo, bar10 11 !$omp do ordered(1)12 do i = 1, N13 !$omp ordered depend(source)14 arrayA(i) = foo(i)15 !$omp ordered depend(sink: i - 1)16 arrayB(i) = bar(i - 1)17 end do18 !$omp end do19 20 !$omp do ordered(1)21 do i = 1, N22 !$omp target23 do j = 1, N24 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter25 !$omp ordered depend(source)26 arrayA(i) = foo(i)27 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter28 !$omp ordered depend(sink: i - 1)29 arrayB(i) = bar(i - 1)30 end do31 !$omp end target32 end do33 !$omp end do34 35 !$omp target36 !$omp parallel do ordered(1)37 do i = 1, N38 !$omp ordered depend(source)39 arrayA(i) = foo(i)40 !$omp ordered depend(sink: i - 1)41 arrayB(i) = bar(i - 1)42 end do43 !$omp end parallel do44 !$omp end target45 46 !$omp target parallel do ordered(1)47 do i = 1, N48 !$omp ordered depend(source)49 arrayA(i) = foo(i)50 !$omp ordered depend(sink: i - 1)51 arrayB(i) = bar(i - 1)52 end do53 !$omp end target parallel do54 55 !ERROR: ORDERED clause is not allowed on the TARGET TEAMS DISTRIBUTE PARALLEL DO directive56 !$omp target teams distribute parallel do ordered(1)57 do i = 1, N58 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter59 !$omp ordered depend(source)60 arrayA(i) = foo(i)61 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter62 !$omp ordered depend(sink: i - 1)63 arrayB(i) = bar(i - 1)64 end do65 !$omp end target teams distribute parallel do66 67 !$omp do ordered68 do i = 1, N69 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter70 !$omp ordered depend(source)71 arrayA(i) = foo(i)72 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter73 !$omp ordered depend(sink: i - 1)74 arrayB(i) = bar(i - 1)75 end do76 !$omp end do77 78 !$omp parallel do ordered79 do i = 1, N80 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter81 !$omp ordered depend(source)82 arrayA(i) = foo(i)83 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter84 !$omp ordered depend(sink: i - 1)85 arrayB(i) = bar(i - 1)86 end do87 !$omp end parallel do88 89 !$omp target parallel do ordered90 do i = 1, N91 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter92 !$omp ordered depend(source)93 arrayA(i) = foo(i)94 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter95 !$omp ordered depend(sink: i - 1)96 arrayB(i) = bar(i - 1)97 end do98 !$omp end target parallel do99 100 !$omp do ordered(1)101 do i = 1, N102 !ERROR: The number of variables in the SINK iteration vector does not match the parameter specified in ORDERED clause103 !ERROR: The iteration vector element 'j' is not an induction variable within the ORDERED loop nest104 !$omp ordered depend(sink: i - 1) depend(sink: i - 1, j)105 arrayB(i) = bar(i - 1, j)106 end do107 !$omp end do108 109 !$omp do ordered(2)110 do i = 1, N111 do j = 1, N112 !ERROR: The number of variables in the SINK iteration vector does not match the parameter specified in ORDERED clause113 !$omp ordered depend(sink: i - 1) depend(sink: i - 1, j)114 arrayB(i) = foo(i - 1) + bar(i - 1, j)115 end do116 end do117 !$omp end do118 119 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter120 !$omp ordered depend(source)121 122 !ERROR: An ORDERED construct with the DEPEND clause must be closely nested in a worksharing-loop (or parallel worksharing-loop) construct with ORDERED clause with a parameter123 !ERROR: The iteration vector element 'i' is not an induction variable within the ORDERED loop nest124 !$omp ordered depend(sink: i - 1)125end126