brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.1 KiB · 9e6e602 Raw
99 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=522 3! Check OpenMP declarative directives4 5! 2.4 requires6 7subroutine requires_1(a)8  real(8), intent(inout) :: a9  !$omp requires reverse_offload, unified_shared_memory, atomic_default_mem_order(relaxed)10  a = a + 0.0111end subroutine requires_112 13subroutine requires_2(a)14  real(8), intent(inout) :: a15  !$omp requires unified_address16  a = a + 0.0117end subroutine requires_218 19! 2.8.2 declare-simd20 21subroutine declare_simd_1(a, b)22  real(8), intent(inout) :: a, b23  !ERROR: 'a' in ALIGNED clause must be of type C_PTR, POINTER or ALLOCATABLE24  !$omp declare simd(declare_simd_1) aligned(a)25  a = 3.14 + b26end subroutine declare_simd_127 28module m129  abstract interface30     subroutine sub(x,y)31       integer, intent(in)::x32       integer, intent(in)::y33     end subroutine sub34  end interface35end module m136 37subroutine declare_simd_238  use m139  procedure (sub) sub140  !ERROR: NOTINBRANCH and INBRANCH clauses are mutually exclusive and may not appear on the same DECLARE SIMD directive41  !$omp declare simd(sub1) inbranch notinbranch42  procedure (sub), pointer::p43  p=>sub144  call p(5,10)45end subroutine declare_simd_246 47subroutine sub1 (x,y)48  integer, intent(in)::x, y49  print *, x+y50end subroutine sub151 52! 2.10.6 declare-target53! 2.15.2 threadprivate54 55module m256contains57  subroutine foo58    !$omp declare target59    !WARNING: The entity with PARAMETER attribute is used in a DECLARE TARGET directive [-Wopen-mp-usage]60    !WARNING: The entity with PARAMETER attribute is used in a DECLARE TARGET directive [-Wopen-mp-usage]61    !$omp declare target (foo, N, M)62    !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]63    !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly64    !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly65    !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly66    !$omp declare target to(Q, S) link(R)67    !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly68    !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly69    !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly70    !$omp declare target enter(Q, S) link(R)71    !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]72    !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly73    !ERROR: MAP clause is not allowed on the DECLARE TARGET directive74    !$omp declare target to(Q) map(from:Q)75    !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly76    !ERROR: MAP clause is not allowed on the DECLARE TARGET directive77    !$omp declare target enter(Q) map(from:Q)78    integer, parameter :: N=10000, M=102479    integer :: i80    real :: Q(N, N), R(N,M), S(M,M)81    !ERROR: A variable that appears in a THREADPRIVATE directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly82    !$omp threadprivate(i)83  end subroutine foo84end module m285 86! 2.16 declare-reduction87 88subroutine declare_red_1()89  integer :: my_var90  !$omp declare reduction (my_add_red : integer : omp_out = omp_out + omp_in) initializer (omp_priv=0)91  my_var = 092  !$omp parallel reduction (my_add_red : my_var) num_threads(4)93  my_var = 194  !$omp end parallel95  print *, "sum of thread numbers is ", my_var96end subroutine declare_red_197 98end99