File: ordered01.f90

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,696 kB
  • sloc: cpp: 7,438,781; ansic: 1,393,871; asm: 1,012,926; python: 241,771; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 8,596; ml: 5,082; perl: 4,730; makefile: 3,591; awk: 3,523; javascript: 2,251; xml: 892; fortran: 672
file content (79 lines) | stat: -rw-r--r-- 2,767 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
! RUN: %python %S/../test_errors.py %s %flang -fopenmp
! OpenMP Version 5.1
! Check OpenMP construct validity for the following directives:
! 2.19.9 Ordered Construct

program main
  integer :: i, N = 10
  real :: a, arrayA(10), arrayB(10), arrayC(10)
  real, external :: foo, bar, baz

  !$omp do ordered
  do i = 1, N
    !ERROR: At most one THREADS clause can appear on the ORDERED directive
    !$omp ordered threads threads
    arrayA(i) = i
    !$omp end ordered
  end do
  !$omp end do

  !$omp simd
  do i = 1, N
    !ERROR: At most one SIMD clause can appear on the ORDERED directive
    !$omp ordered simd simd
    arrayA(i) = i
    !$omp end ordered
  end do
  !$omp end simd

  !$omp do simd ordered
  do i = 1, N
    !ERROR: At most one SIMD clause can appear on the ORDERED directive
    !$omp ordered simd simd
    arrayA(i) = i
    !$omp end ordered
  end do
  !$omp end do simd

  !$omp do ordered(1)
  do i = 2, N
    !ERROR: Only SINK or SOURCE dependence types are allowed when ORDERED construct is a standalone construct with no ORDERED region
    !ERROR: At most one SOURCE dependence type can appear on the ORDERED directive
    !$omp ordered depend(source) depend(inout: arrayA) depend(source)
    arrayA(i) = foo(i)
    !ERROR: The SINK and SOURCE dependence types are mutually exclusive
    !ERROR: At most one SOURCE dependence type can appear on the ORDERED directive
    !$omp ordered depend(sink: i - 1) depend(source) depend(source)
    arrayB(i) = bar(arrayA(i), arrayB(i-1))
    !ERROR: Only SINK or SOURCE dependence types are allowed when ORDERED construct is a standalone construct with no ORDERED region
    !ERROR: Only SINK or SOURCE dependence types are allowed when ORDERED construct is a standalone construct with no ORDERED region
    !$omp ordered depend(out: arrayC) depend(in: arrayB)
    arrayC(i) = baz(arrayB(i-1))
  end do
  !$omp end do

  !$omp do ordered(1)
  do i = 2, N
    !ERROR: DEPEND clauses are not allowed when ORDERED construct is a block construct with an ORDERED region
    !$omp ordered depend(source)
    arrayA(i) = foo(i)
    !$omp end ordered
    !ERROR: DEPEND clauses are not allowed when ORDERED construct is a block construct with an ORDERED region
    !$omp ordered depend(sink: i - 1)
    arrayB(i) = bar(arrayA(i), arrayB(i-1))
    !$omp end ordered
  end do
  !$omp end do

contains
  subroutine work1()
    !ERROR: THREADS and SIMD clauses are not allowed when ORDERED construct is a standalone construct with no ORDERED region
    !$omp ordered simd
  end subroutine work1

  subroutine work2()
    !ERROR: THREADS and SIMD clauses are not allowed when ORDERED construct is a standalone construct with no ORDERED region
    !$omp ordered threads
  end subroutine work2

end program main