File: allocate-1.f90

package info (click to toggle)
gcc-arm-none-eabi 15%3A14.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,099,328 kB
  • sloc: cpp: 3,627,108; ansic: 2,571,498; ada: 834,230; f90: 235,082; makefile: 79,231; asm: 74,984; xml: 51,692; exp: 39,736; sh: 33,298; objc: 15,629; python: 15,069; fortran: 14,429; pascal: 7,003; awk: 5,070; perl: 3,106; ml: 285; lisp: 253; lex: 204; haskell: 135
file content (137 lines) | stat: -rw-r--r-- 3,552 bytes parent folder | download | duplicates (2)
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
! { dg-do compile }

module omp_lib_kinds
  use iso_c_binding, only: c_int, c_intptr_t
  implicit none
  private :: c_int, c_intptr_t
  integer, parameter :: omp_allocator_handle_kind = c_intptr_t

  integer (kind=omp_allocator_handle_kind), &
     parameter :: omp_null_allocator = 0
  integer (kind=omp_allocator_handle_kind), &
     parameter :: omp_default_mem_alloc = 1
  integer (kind=omp_allocator_handle_kind), &
     parameter :: omp_large_cap_mem_alloc = 2
  integer (kind=omp_allocator_handle_kind), &
     parameter :: omp_const_mem_alloc = 3
  integer (kind=omp_allocator_handle_kind), &
     parameter :: omp_high_bw_mem_alloc = 4
  integer (kind=omp_allocator_handle_kind), &
     parameter :: omp_low_lat_mem_alloc = 5
  integer (kind=omp_allocator_handle_kind), &
     parameter :: omp_cgroup_mem_alloc = 6
  integer (kind=omp_allocator_handle_kind), &
     parameter :: omp_pteam_mem_alloc = 7
  integer (kind=omp_allocator_handle_kind), &
     parameter :: omp_thread_mem_alloc = 8
end module

subroutine bar (a, b, c)
  implicit none
  integer  :: a
  integer  :: b
  integer  :: c
  c = a + b
end

subroutine bar2 (a, b, c)
  implicit none
  integer  :: a
  integer  :: b(15)
  integer  :: c
  c = a + b(1)
end

subroutine foo(x, y)
  use omp_lib_kinds
  implicit none
  integer  :: x
  integer  :: z

  integer, dimension(15) :: y
  integer  :: r
  integer  :: i
  integer  c1, c2, c3, c4
  integer (kind=omp_allocator_handle_kind) :: h
  common /B1/ c1, c2
  common /B2/ c3, c4

  r = 0
  h = omp_default_mem_alloc;


  !$omp parallel private(/B1/, c3, c4) allocate(/B1/, /B2/)
  !$omp end parallel

  !$omp parallel private(/B1/, /B2/) allocate(h:/B1/, /B2/)
  !$omp end parallel
  
  !$omp parallel private(/B1/, /B2/) allocate(omp_large_cap_mem_alloc:/B1/, c3, c4)
  !$omp end parallel

  !$omp parallel allocate (x) allocate (h : y) &
  !$omp  allocate (omp_large_cap_mem_alloc:z) firstprivate (x, y, z)
  call bar2 (x, y, z);
  !$omp end parallel

  !$omp task private (x) firstprivate (z) allocate (omp_low_lat_mem_alloc:x,z)
  call bar (0, x, z);
  !$omp end task
  
  !$omp target teams distribute parallel do private (x) firstprivate (y) &
  !$omp allocate ((omp_default_mem_alloc + 0):z) allocate &
  !$omp (omp_default_mem_alloc: x, y) allocate (h: r) lastprivate (z) reduction(+:r)
  do i = 1, 10
    call bar (0, x, z);
    call bar2 (1, y, r);
  end do
  !$omp end target teams distribute parallel do

  !$omp single private (x) allocate (omp_low_lat_mem_alloc:x)
  x=1
  !$omp end single

  !$omp single allocate (omp_low_lat_mem_alloc:x) private (x)
  !$omp end single

  !$omp parallel
  !$omp do allocate (x) private (x)
  do i = 1, 64
    x = 1;
  end do
  !$omp end parallel

  !$omp sections private (x) allocate (omp_low_lat_mem_alloc: x)
    x = 1;
    !$omp section
    x = 2;
    !$omp section
    x = 3;
  !$omp end sections

  !$omp taskgroup task_reduction(+:r) allocate (omp_default_mem_alloc : r)
  call bar (r, r, r);
  !$omp end taskgroup

  !$omp teams private (x) firstprivate (y) allocate (h : x, y)
  call bar2 (x, y, r);
  !$omp end teams

  !$omp taskloop lastprivate (x) reduction (+:r) allocate (h : x, r)
  do i = 1, 16
    call bar (0, r, r);
    x = i;
  end do
  !$omp end taskloop

  !$omp taskgroup task_reduction(+:r) allocate (omp_default_mem_alloc : r)
  !$omp taskloop firstprivate (x) in_reduction (+:r) &
  !$omp allocate (omp_default_mem_alloc : x, r)
  do i = 1, 16
    call bar (x, r, r);
  end do
  !$omp end taskloop
  !$omp end taskgroup
  !$omp taskwait
end subroutine