1 ! Copyright (C
) 2005-2021 Free Software Foundation
, Inc
.
2 ! Contributed by Jakub Jelinek
<jakub@redhat
.com
>.
4 ! This file is part of the GNU Offloading
and Multi Processing Library
7 ! Libgomp is free software
; you can redistribute it
and/or modify it
8 ! under the terms of the GNU General Public License as published by
9 ! the Free Software Foundation
; either version
3, or (at your option
)
12 ! Libgomp is distributed in the hope that it will be useful
, but WITHOUT ANY
13 ! WARRANTY
; without even the implied warranty of MERCHANTABILITY
or FITNESS
14 ! FOR A PARTICULAR PURPOSE
. See the GNU General Public License
for
17 ! Under Section
7 of GPL version
3, you are granted additional
18 ! permissions described in the GCC Runtime Library Exception
, version
19 ! 3.1, as published by the Free Software Foundation
.
21 ! You should have received a copy of the GNU General Public License
and
22 ! a copy of the GCC Runtime Library Exception along with
this program
;
23 ! see the files COPYING3
and COPYING
.RUNTIME respectively
. If
not, see
24 ! <http
://www.gnu.org/licenses/>.
26 integer omp_lock_kind
, omp_nest_lock_kind
, openmp_version
27 parameter (omp_lock_kind
= @OMP_LOCK_KIND@
)
28 parameter (omp_nest_lock_kind
= @OMP_NEST_LOCK_KIND@
)
29 integer omp_depend_kind
30 parameter (omp_depend_kind
= @OMP_DEPEND_KIND@
)
31 integer omp_sched_kind
32 parameter (omp_sched_kind
= 4)
33 integer (omp_sched_kind
) omp_sched_static
, omp_sched_dynamic
34 integer (omp_sched_kind
) omp_sched_guided
, omp_sched_auto
35 parameter (omp_sched_static
= 1)
36 parameter (omp_sched_dynamic
= 2)
37 parameter (omp_sched_guided
= 3)
38 parameter (omp_sched_auto
= 4)
39 integer omp_proc_bind_kind
40 parameter (omp_proc_bind_kind
= 4)
41 integer (omp_proc_bind_kind
) omp_proc_bind_false
42 integer (omp_proc_bind_kind
) omp_proc_bind_true
43 integer (omp_proc_bind_kind
) omp_proc_bind_primary
44 integer (omp_proc_bind_kind
) omp_proc_bind_master
45 integer (omp_proc_bind_kind
) omp_proc_bind_close
46 integer (omp_proc_bind_kind
) omp_proc_bind_spread
47 parameter (omp_proc_bind_false
= 0)
48 parameter (omp_proc_bind_true
= 1)
49 parameter (omp_proc_bind_primary
= 2)
50 parameter (omp_proc_bind_master
= 2)
51 parameter (omp_proc_bind_close
= 3)
52 parameter (omp_proc_bind_spread
= 4)
53 integer omp_sync_hint_kind
54 integer omp_lock_hint_kind
55 parameter (omp_sync_hint_kind
= 4)
56 parameter (omp_lock_hint_kind
= omp_sync_hint_kind
)
57 integer (omp_sync_hint_kind
) omp_sync_hint_none
58 integer (omp_lock_hint_kind
) omp_lock_hint_none
59 integer (omp_sync_hint_kind
) omp_sync_hint_uncontended
60 integer (omp_lock_hint_kind
) omp_lock_hint_uncontended
61 integer (omp_sync_hint_kind
) omp_sync_hint_contended
62 integer (omp_sync_hint_kind
) omp_lock_hint_contended
63 integer (omp_lock_hint_kind
) omp_sync_hint_nonspeculative
64 integer (omp_lock_hint_kind
) omp_lock_hint_nonspeculative
65 integer (omp_sync_hint_kind
) omp_sync_hint_speculative
66 integer (omp_lock_hint_kind
) omp_lock_hint_speculative
67 parameter (omp_sync_hint_none
= 0)
68 parameter (omp_lock_hint_none
= 0)
69 parameter (omp_sync_hint_uncontended
= 1)
70 parameter (omp_lock_hint_uncontended
= 1)
71 parameter (omp_sync_hint_contended
= 2)
72 parameter (omp_lock_hint_contended
= 2)
73 parameter (omp_sync_hint_nonspeculative
= 4)
74 parameter (omp_lock_hint_nonspeculative
= 4)
75 parameter (omp_sync_hint_speculative
= 8)
76 parameter (omp_lock_hint_speculative
= 8)
77 parameter (openmp_version
= 201511)
78 integer omp_pause_resource_kind
79 parameter (omp_pause_resource_kind
= 4)
80 integer (omp_pause_resource_kind
) omp_pause_soft
81 integer (omp_pause_resource_kind
) omp_pause_hard
82 parameter (omp_pause_soft
= 1)
83 parameter (omp_pause_hard
= 2)
85 integer omp_allocator_handle_kind
, omp_alloctrait_key_kind
86 integer omp_alloctrait_val_kind
, omp_memspace_handle_kind
87 integer omp_event_handle_kind
88 parameter (omp_allocator_handle_kind
= @INTPTR_T_KIND@
)
89 parameter (omp_alloctrait_key_kind
= 4)
90 parameter (omp_alloctrait_val_kind
= @INTPTR_T_KIND@
)
91 parameter (omp_memspace_handle_kind
= @INTPTR_T_KIND@
)
92 parameter (omp_event_handle_kind
= @INTPTR_T_KIND@
)
93 integer (omp_alloctrait_key_kind
) omp_atk_sync_hint
94 integer (omp_alloctrait_key_kind
) omp_atk_alignment
95 integer (omp_alloctrait_key_kind
) omp_atk_access
96 integer (omp_alloctrait_key_kind
) omp_atk_pool_size
97 integer (omp_alloctrait_key_kind
) omp_atk_fallback
98 integer (omp_alloctrait_key_kind
) omp_atk_fb_data
99 integer (omp_alloctrait_key_kind
) omp_atk_pinned
100 integer (omp_alloctrait_key_kind
) omp_atk_partition
101 parameter (omp_atk_sync_hint
= 1)
102 parameter (omp_atk_alignment
= 2)
103 parameter (omp_atk_access
= 3)
104 parameter (omp_atk_pool_size
= 4)
105 parameter (omp_atk_fallback
= 5)
106 parameter (omp_atk_fb_data
= 6)
107 parameter (omp_atk_pinned
= 7)
108 parameter (omp_atk_partition
= 8)
109 integer (omp_alloctrait_val_kind
) omp_atv_false
110 integer (omp_alloctrait_val_kind
) omp_atv_true
111 integer (omp_alloctrait_val_kind
) omp_atv_default
112 integer (omp_alloctrait_val_kind
) omp_atv_contended
113 integer (omp_alloctrait_val_kind
) omp_atv_uncontended
114 integer (omp_alloctrait_val_kind
) omp_atv_serialized
115 integer (omp_alloctrait_val_kind
) omp_atv_sequential
116 integer (omp_alloctrait_val_kind
) omp_atv_private
117 integer (omp_alloctrait_val_kind
) omp_atv_all
118 integer (omp_alloctrait_val_kind
) omp_atv_thread
119 integer (omp_alloctrait_val_kind
) omp_atv_pteam
120 integer (omp_alloctrait_val_kind
) omp_atv_cgroup
121 integer (omp_alloctrait_val_kind
) omp_atv_default_mem_fb
122 integer (omp_alloctrait_val_kind
) omp_atv_null_fb
123 integer (omp_alloctrait_val_kind
) omp_atv_abort_fb
124 integer (omp_alloctrait_val_kind
) omp_atv_allocator_fb
125 integer (omp_alloctrait_val_kind
) omp_atv_environment
126 integer (omp_alloctrait_val_kind
) omp_atv_nearest
127 integer (omp_alloctrait_val_kind
) omp_atv_blocked
128 integer (omp_alloctrait_val_kind
) omp_atv_interleaved
129 parameter (omp_atv_default
= -1)
130 parameter (omp_atv_false
= 0)
131 parameter (omp_atv_true
= 1)
132 parameter (omp_atv_contended
= 3)
133 parameter (omp_atv_uncontended
= 4)
134 parameter (omp_atv_serialized
= 5)
135 parameter (omp_atv_sequential
= omp_atv_serialized
)
136 parameter (omp_atv_private
= 6)
137 parameter (omp_atv_all
= 7)
138 parameter (omp_atv_thread
= 8)
139 parameter (omp_atv_pteam
= 9)
140 parameter (omp_atv_cgroup
= 10)
141 parameter (omp_atv_default_mem_fb
= 11)
142 parameter (omp_atv_null_fb
= 12)
143 parameter (omp_atv_abort_fb
= 13)
144 parameter (omp_atv_allocator_fb
= 14)
145 parameter (omp_atv_environment
= 15)
146 parameter (omp_atv_nearest
= 16)
147 parameter (omp_atv_blocked
= 17)
148 parameter (omp_atv_interleaved
= 18)
149 integer (omp_allocator_handle_kind
) omp_null_allocator
150 integer (omp_allocator_handle_kind
) omp_default_mem_alloc
151 integer (omp_allocator_handle_kind
) omp_large_cap_mem_alloc
152 integer (omp_allocator_handle_kind
) omp_const_mem_alloc
153 integer (omp_allocator_handle_kind
) omp_high_bw_mem_alloc
154 integer (omp_allocator_handle_kind
) omp_low_lat_mem_alloc
155 integer (omp_allocator_handle_kind
) omp_cgroup_mem_alloc
156 integer (omp_allocator_handle_kind
) omp_pteam_mem_alloc
157 integer (omp_allocator_handle_kind
) omp_thread_mem_alloc
158 parameter (omp_null_allocator
= 0)
159 parameter (omp_default_mem_alloc
= 1)
160 parameter (omp_large_cap_mem_alloc
= 2)
161 parameter (omp_const_mem_alloc
= 3)
162 parameter (omp_high_bw_mem_alloc
= 4)
163 parameter (omp_low_lat_mem_alloc
= 5)
164 parameter (omp_cgroup_mem_alloc
= 6)
165 parameter (omp_pteam_mem_alloc
= 7)
166 parameter (omp_thread_mem_alloc
= 8)
167 integer (omp_memspace_handle_kind
) omp_default_mem_space
168 integer (omp_memspace_handle_kind
) omp_large_cap_mem_space
169 integer (omp_memspace_handle_kind
) omp_const_mem_space
170 integer (omp_memspace_handle_kind
) omp_high_bw_mem_space
171 integer (omp_memspace_handle_kind
) omp_low_lat_mem_space
172 parameter (omp_default_mem_space
= 0)
173 parameter (omp_large_cap_mem_space
= 1)
174 parameter (omp_const_mem_space
= 2)
175 parameter (omp_high_bw_mem_space
= 3)
176 parameter (omp_low_lat_mem_space
= 4)
179 integer (omp_alloctrait_key_kind
) key
180 integer (omp_alloctrait_val_kind
) value
181 end type omp_alloctrait
183 external omp_init_lock
, omp_init_nest_lock
184 external omp_init_lock_with_hint
185 external omp_init_nest_lock_with_hint
186 external omp_destroy_lock
, omp_destroy_nest_lock
187 external omp_set_lock
, omp_set_nest_lock
188 external omp_unset_lock
, omp_unset_nest_lock
189 external omp_set_dynamic
, omp_set_nested
190 external omp_set_num_threads
192 external omp_get_dynamic
, omp_get_nested
193 logical(4) omp_get_dynamic
, omp_get_nested
194 external omp_test_lock
, omp_in_parallel
195 logical(4) omp_test_lock
, omp_in_parallel
197 external omp_get_max_threads
, omp_get_num_procs
198 integer(4) omp_get_max_threads
, omp_get_num_procs
199 external omp_get_num_threads
, omp_get_thread_num
200 integer(4) omp_get_num_threads
, omp_get_thread_num
201 external omp_test_nest_lock
202 integer(4) omp_test_nest_lock
204 external omp_get_wtick
, omp_get_wtime
205 double precision omp_get_wtick
, omp_get_wtime
207 external omp_set_schedule
, omp_get_schedule
208 external omp_get_thread_limit
, omp_set_max_active_levels
209 external omp_get_max_active_levels
, omp_get_level
210 external omp_get_ancestor_thread_num
, omp_get_team_size
211 external omp_get_active_level
212 external omp_get_supported_active_levels
213 integer(4) omp_get_thread_limit
, omp_get_max_active_levels
214 integer(4) omp_get_level
, omp_get_ancestor_thread_num
215 integer(4) omp_get_team_size
, omp_get_active_level
216 integer(4) omp_get_supported_active_levels
218 external omp_in_final
219 logical(4) omp_in_final
221 external omp_get_cancellation
222 logical(4) omp_get_cancellation
224 external omp_get_proc_bind
225 integer(omp_proc_bind_kind
) omp_get_proc_bind
227 integer(4) omp_get_num_places
228 external omp_get_num_places
229 integer(4) omp_get_place_num_procs
230 external omp_get_place_num_procs
231 external omp_get_place_proc_ids
232 integer(4) omp_get_place_num
233 external omp_get_place_num
234 integer(4) omp_get_partition_num_places
235 external omp_get_partition_num_places
236 external omp_get_partition_place_nums
238 external omp_set_default_device
, omp_get_default_device
239 external omp_get_num_devices
, omp_get_num_teams
240 external omp_get_team_num
241 integer(4) omp_get_default_device
, omp_get_num_devices
242 integer(4) omp_get_num_teams
, omp_get_team_num
244 external omp_is_initial_device
245 logical(4) omp_is_initial_device
246 external omp_get_initial_device
247 integer(4) omp_get_initial_device
249 external omp_get_device_num
250 integer(4) omp_get_device_num
252 external omp_get_max_task_priority
253 integer(4) omp_get_max_task_priority
255 external omp_fulfill_event
257 external omp_set_affinity_format
, omp_get_affinity_format
258 external omp_display_affinity
, omp_capture_affinity
259 integer(4) omp_get_affinity_format
260 integer(4) omp_capture_affinity
262 external omp_pause_resource
, omp_pause_resource_all
263 integer(4) omp_pause_resource
264 integer(4) omp_pause_resource_all
266 external omp_init_allocator
267 integer (omp_allocator_handle_kind
) omp_init_allocator
268 external omp_destroy_allocator
269 external omp_set_default_allocator
270 external omp_get_default_allocator
271 integer (omp_allocator_handle_kind
) omp_get_default_allocator
273 external omp_display_env
276 function
omp_alloc (size
, allocator
) bind(c
)
277 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_size_t
278 use
, intrinsic :: omp_lib_kinds
279 type(c_ptr
) :: omp_alloc
280 integer(c_size_t
), value :: size
281 integer(omp_allocator_handle_kind
), value :: allocator
282 end function omp_alloc
286 subroutine
omp_free(ptr
, allocator
) bind(c
)
287 use
, intrinsic :: iso_c_binding
, only
: c_ptr
288 use
, intrinsic :: omp_lib_kinds
289 type(c_ptr
), value :: ptr
290 integer(omp_allocator_handle_kind
), value :: allocator
295 function
omp_target_alloc (size
, device_num
) bind(c
)
296 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_size_t
, c_int
297 type(c_ptr
) :: omp_target_alloc
298 integer(c_size_t
), value :: size
299 integer(c_int
), value :: device_num
300 end function omp_target_alloc
304 subroutine
omp_target_free (device_ptr
, device_num
) bind(c
)
305 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_int
306 type(c_ptr
), value :: device_ptr
307 integer(c_int
), value :: device_num
308 end subroutine omp_target_free
312 function
omp_target_is_present (ptr
, device_num
) bind(c
)
313 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_int
314 integer(c_int
) :: omp_target_is_present
315 type(c_ptr
), value :: ptr
316 integer(c_int
), value :: device_num
317 end function omp_target_is_present
321 function
omp_target_memcpy (dst
, src
, length
, dst_offset
, &
322 & src_offset
, dst_device_num
, &
323 & src_device_num
) bind(c
)
324 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_int
, c_size_t
325 integer(c_int
) :: omp_target_memcpy
326 type(c_ptr
), value :: dst
, src
327 integer(c_size_t
), value :: length
, dst_offset
, src_offset
328 integer(c_int
), value :: dst_device_num
, src_device_num
329 end function omp_target_memcpy
333 function
omp_target_memcpy_rect (dst
,src
,element_size
, num_dims
, &
334 & volume
, dst_offsets
, &
335 & src_offsets
, dst_dimensions
, &
336 & src_dimensions
, dst_device_num
, &
337 & src_device_num
) bind(c
)
338 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_int
, c_size_t
339 integer(c_int
) :: omp_target_memcpy_rect
340 type(c_ptr
), value :: dst
, src
341 integer(c_size_t
), value :: element_size
342 integer(c_int
), value :: num_dims
343 integer(c_int
), value :: dst_device_num
, src_device_num
344 integer(c_size_t
), intent(in
) :: volume(*), dst_offsets(*)
345 integer(c_size_t
), intent(in
) :: src_offsets(*)
346 integer(c_size_t
), intent(in
) :: dst_dimensions(*)
347 integer(c_size_t
), intent(in
) :: src_dimensions(*)
348 end function omp_target_memcpy_rect
352 function
omp_target_associate_ptr (host_ptr
, device_ptr
, size
, &
353 & device_offset
, device_num
) &
355 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_size_t
, c_int
356 integer(c_int
) :: omp_target_associate_ptr
357 type(c_ptr
), value :: host_ptr
, device_ptr
358 integer(c_size_t
), value :: size
, device_offset
359 integer(c_int
), value :: device_num
360 end function omp_target_associate_ptr
364 function
omp_target_disassociate_ptr (ptr
, device_num
) bind(c
)
365 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_int
366 integer(c_int
) :: omp_target_disassociate_ptr
367 type(c_ptr
), value :: ptr
368 integer(c_int
), value :: device_num
369 end function omp_target_disassociate_ptr