OpenMP_DeclareTargetPrivateVar.f90 1.36 KB
Newer Older
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
module comm
  implicit none
  real, dimension ( : ), allocatable :: &
     cmaxa, cmaxb
  !$OMP declare target ( cmaxa, cmaxb )
end module comm

module gpuomp
  implicit none
contains
  subroutine gpuomp_routine ( d1, d2, d3 )
    use comm, only: cmaxa, cmaxb
    real, intent ( inout ) :: &
      d1, d2, d3
    
    integer :: &
      iV
    
    !$OMP target teams distribute parallel do &
    !$OMP private ( cmaxa, cmaxb )
    do iV = 1, 3200
      call gpuomp_routine2 ( d1, d2, d3, cmaxa, cmaxb, 3200 )
    end do
    !$OMP end target teams distribute parallel do
    
  end subroutine gpuomp_routine
  
  
  subroutine gpuomp_routine2 ( d1, d2, d3, cmaxa, cmaxb, nsize )
    
    real, intent ( inout ) :: &
      d1, d2, d3
    integer, intent ( in ) :: &
      nsize
    real, dimension ( : ) :: &
      cmaxa ( nsize ), cmaxb ( nsize )
    
    !$OMP declare target
    
    call ext_routine ( d1, d2, d3, cmaxa, cmaxb, nsize )
  
  end subroutine gpuomp_routine2

end module gpuomp


module ext_module
  implicit none
contains
  subroutine ext_routine ( d1, d2, d3, cmaxa, cmaxb, nsize )
    real, intent ( inout ) :: &
      d1, d2, d3
    integer, intent ( in ) :: &
      nsize
    real, dimension ( : ) :: &
      cmaxa ( nsize ), cmaxb ( nsize )
    !$OMP declare target
  end subroutine ext_routine
end module ext_module


program test
!-- dummy program
end program test