File: omp-device-constructs.f90

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (101 lines) | stat: -rw-r--r-- 2,980 bytes parent folder | download | duplicates (18)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
! REQUIRES: plugins, examples, shell

!RUN: %flang_fc1 -load %llvmshlibdir/flangOmpReport.so -plugin flang-omp-report -fopenmp %s -o - | FileCheck %s

! Check OpenMP clause validity for the following directives:
!     2.10 Device constructs
program main

  real(8) :: arrayA(256), arrayB(256)
  integer :: N

  arrayA = 1.414
  arrayB = 3.14
  N = 256

  !$omp target map(arrayA)
  do i = 1, N
     a = 3.14
  enddo
  !$omp end target

  !$omp target device(0)
  do i = 1, N
     a = 3.14
  enddo
  !$omp end target

  !$omp target defaultmap(tofrom:scalar)
  do i = 1, N
     a = 3.14
  enddo
  !$omp end target

  !$omp teams num_teams(3) thread_limit(10) default(shared) private(i) shared(a)
  do i = 1, N
     a = 3.14
  enddo
  !$omp end teams

  !$omp target map(tofrom:a)
  do i = 1, N
     a = 3.14
  enddo
  !$omp end target

  !$omp target data device(0) map(to:a)
  do i = 1, N
    a = 3.14
  enddo
  !$omp end target data

end program main

! CHECK: ---
! CHECK-NEXT: - file:            '{{[^"]*}}omp-device-constructs.f90'
! CHECK-NEXT:   line:            16
! CHECK-NEXT:   construct:       target
! CHECK-NEXT:   clauses:
! CHECK-NEXT:     - clause:          map
! CHECK-NEXT:       details:         arraya
! CHECK-NEXT: - file:            '{{[^"]*}}omp-device-constructs.f90'
! CHECK-NEXT:   line:            22
! CHECK-NEXT:   construct:       target
! CHECK-NEXT:   clauses:
! CHECK-NEXT:     - clause:          device
! CHECK-NEXT:       details:         '0'
! CHECK-NEXT: - file:            '{{[^"]*}}omp-device-constructs.f90'
! CHECK-NEXT:   line:            28
! CHECK-NEXT:   construct:       target
! CHECK-NEXT:   clauses:
! CHECK-NEXT:     - clause:          defaultmap
! CHECK-NEXT:       details:         'tofrom:scalar'
! CHECK-NEXT: - file:            '{{[^"]*}}omp-device-constructs.f90'
! CHECK-NEXT:   line:            34
! CHECK-NEXT:   construct:       teams
! CHECK-NEXT:   clauses:
! CHECK-NEXT:     - clause:          default
! CHECK-NEXT:       details:         shared
! CHECK-NEXT:     - clause:          num_teams
! CHECK-NEXT:       details:         '3'
! CHECK-NEXT:     - clause:          private
! CHECK-NEXT:       details:         i
! CHECK-NEXT:     - clause:          shared
! CHECK-NEXT:       details:         a
! CHECK-NEXT:     - clause:          thread_limit
! CHECK-NEXT:       details:         '10'
! CHECK-NEXT: - file:            '{{[^"]*}}omp-device-constructs.f90'
! CHECK-NEXT:   line:            40
! CHECK-NEXT:   construct:       target
! CHECK-NEXT:   clauses:
! CHECK-NEXT:     - clause:          map
! CHECK-NEXT:       details:         'tofrom:a'
! CHECK-NEXT: - file:            '{{[^"]*}}omp-device-constructs.f90'
! CHECK-NEXT:   line:            46
! CHECK-NEXT:   construct:       target data
! CHECK-NEXT:   clauses:
! CHECK-NEXT:     - clause:          device
! CHECK-NEXT:       details:         '0'
! CHECK-NEXT:     - clause:          map
! CHECK-NEXT:       details:         'to:a'
! CHECK-NEXT: ...