File: depend02.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 (49 lines) | stat: -rw-r--r-- 1,165 bytes parent folder | download | duplicates (11)
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
! RUN: %python %S/../test_errors.py %s %flang -fopenmp
! OpenMP Version 4.5
! 2.13.9 Depend Clause
! A variable that is part of another variable
! (such as an element of a structure) but is not an array element or
! an array section cannot appear in a DEPEND clause

subroutine vec_mult(N)
  implicit none
  integer :: i, N
  real, allocatable :: p(:), v1(:), v2(:)

  type my_type
    integer :: a(10)
  end type my_type

  type(my_type) :: my_var
  allocate( p(N), v1(N), v2(N) )

  !$omp parallel num_threads(2)
  !$omp single

  !$omp task depend(out:v1)
  call init(v1, N)
  !$omp end task

  !$omp task depend(out:v2)
  call init(v2, N)
  !$omp end task

  !ERROR: A variable that is part of another variable (such as an element of a structure) but is not an array element or an array section cannot appear in a DEPEND clause
  !$omp target nowait depend(in:v1,v2, my_var%a) depend(out:p) &
  !$omp& map(to:v1,v2) map(from: p)
  !$omp parallel do
  do i=1,N
    p(i) = v1(i) * v2(i)
  end do
  !$omp end target

  !$omp task depend(in:p)
  call output(p, N)
  !$omp end task

  !$omp end single
  !$omp end parallel

  deallocate( p, v1, v2 )

end subroutine