1 ! Copyright (C
) 2005-2023 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)
177 integer omp_initial_device
, omp_invalid_device
178 parameter (omp_initial_device
= -1)
179 parameter (omp_invalid_device
= -4)
182 integer (omp_alloctrait_key_kind
) key
183 integer (omp_alloctrait_val_kind
) value
184 end type omp_alloctrait
186 external omp_init_lock
, omp_init_nest_lock
187 external omp_init_lock_with_hint
188 external omp_init_nest_lock_with_hint
189 external omp_destroy_lock
, omp_destroy_nest_lock
190 external omp_set_lock
, omp_set_nest_lock
191 external omp_unset_lock
, omp_unset_nest_lock
192 external omp_set_dynamic
, omp_set_nested
193 external omp_set_num_threads
195 external omp_get_dynamic
, omp_get_nested
196 logical(4) omp_get_dynamic
, omp_get_nested
197 external omp_test_lock
, omp_in_parallel
198 logical(4) omp_test_lock
, omp_in_parallel
200 external omp_get_max_threads
, omp_get_num_procs
201 integer(4) omp_get_max_threads
, omp_get_num_procs
202 external omp_get_num_threads
, omp_get_thread_num
203 integer(4) omp_get_num_threads
, omp_get_thread_num
204 external omp_test_nest_lock
205 integer(4) omp_test_nest_lock
207 external omp_get_wtick
, omp_get_wtime
208 double precision omp_get_wtick
, omp_get_wtime
210 external omp_set_schedule
, omp_get_schedule
211 external omp_get_thread_limit
, omp_set_max_active_levels
212 external omp_get_max_active_levels
, omp_get_level
213 external omp_get_ancestor_thread_num
, omp_get_team_size
214 external omp_get_active_level
215 external omp_get_supported_active_levels
216 integer(4) omp_get_thread_limit
, omp_get_max_active_levels
217 integer(4) omp_get_level
, omp_get_ancestor_thread_num
218 integer(4) omp_get_team_size
, omp_get_active_level
219 integer(4) omp_get_supported_active_levels
221 external omp_in_final
222 logical(4) omp_in_final
223 external omp_in_explicit_task
224 logical(4) omp_in_explicit_task
226 external omp_get_cancellation
227 logical(4) omp_get_cancellation
229 external omp_get_proc_bind
230 integer(omp_proc_bind_kind
) omp_get_proc_bind
232 integer(4) omp_get_num_places
233 external omp_get_num_places
234 integer(4) omp_get_place_num_procs
235 external omp_get_place_num_procs
236 external omp_get_place_proc_ids
237 integer(4) omp_get_place_num
238 external omp_get_place_num
239 integer(4) omp_get_partition_num_places
240 external omp_get_partition_num_places
241 external omp_get_partition_place_nums
243 external omp_set_default_device
, omp_get_default_device
244 external omp_get_num_devices
, omp_get_num_teams
245 external omp_get_team_num
246 integer(4) omp_get_default_device
, omp_get_num_devices
247 integer(4) omp_get_num_teams
, omp_get_team_num
249 external omp_is_initial_device
250 logical(4) omp_is_initial_device
251 external omp_get_initial_device
252 integer(4) omp_get_initial_device
254 external omp_get_device_num
255 integer(4) omp_get_device_num
257 external omp_get_max_task_priority
258 integer(4) omp_get_max_task_priority
260 external omp_set_num_teams
, omp_set_teams_thread_limit
261 external omp_get_max_teams
, omp_get_teams_thread_limit
262 integer(4) omp_get_max_teams
, omp_get_teams_thread_limit
264 external omp_fulfill_event
266 external omp_set_affinity_format
, omp_get_affinity_format
267 external omp_display_affinity
, omp_capture_affinity
268 integer(4) omp_get_affinity_format
269 integer(4) omp_capture_affinity
271 external omp_pause_resource
, omp_pause_resource_all
272 integer(4) omp_pause_resource
273 integer(4) omp_pause_resource_all
275 external omp_init_allocator
276 integer (omp_allocator_handle_kind
) omp_init_allocator
277 external omp_destroy_allocator
278 external omp_set_default_allocator
279 external omp_get_default_allocator
280 integer (omp_allocator_handle_kind
) omp_get_default_allocator
282 external omp_display_env
285 function
omp_alloc (size
, allocator
) bind(c
)
286 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_size_t
287 use
, intrinsic :: omp_lib_kinds
288 type(c_ptr
) :: omp_alloc
289 integer(c_size_t
), value :: size
290 integer(omp_allocator_handle_kind
), value :: allocator
291 end function omp_alloc
295 function
omp_aligned_alloc (alignment
, size
, allocator
) bind(c
)
296 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_size_t
297 use
, intrinsic :: omp_lib_kinds
298 type(c_ptr
) :: omp_aligned_alloc
299 integer(c_size_t
), value :: alignment
, size
300 integer(omp_allocator_handle_kind
), value :: allocator
301 end function omp_aligned_alloc
305 subroutine
omp_free(ptr
, allocator
) bind(c
)
306 use
, intrinsic :: iso_c_binding
, only
: c_ptr
307 use
, intrinsic :: omp_lib_kinds
308 type(c_ptr
), value :: ptr
309 integer(omp_allocator_handle_kind
), value :: allocator
310 end subroutine omp_free
314 function
omp_calloc (nmemb
, size
, allocator
) bind(c
)
315 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_size_t
316 use
, intrinsic :: omp_lib_kinds
317 type(c_ptr
) :: omp_calloc
318 integer(c_size_t
), value :: nmemb
, size
319 integer(omp_allocator_handle_kind
), value :: allocator
320 end function omp_calloc
324 function
omp_aligned_calloc (alignment
, nmemb
, size
, allocator
) &
326 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_size_t
327 use
, intrinsic :: omp_lib_kinds
328 type(c_ptr
) :: omp_aligned_calloc
329 integer(c_size_t
), value :: alignment
, nmemb
, size
330 integer(omp_allocator_handle_kind
), value :: allocator
331 end function omp_aligned_calloc
335 function
omp_realloc (ptr
, size
, allocator
, free_allocator
) &
337 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_size_t
338 use
, intrinsic :: omp_lib_kinds
339 type(c_ptr
) :: omp_realloc
340 type(c_ptr
), value :: ptr
341 integer(c_size_t
), value :: size
342 integer(omp_allocator_handle_kind
), value :: allocator
343 integer(omp_allocator_handle_kind
), value :: free_allocator
344 end function omp_realloc
348 function
omp_target_alloc (size
, device_num
) bind(c
)
349 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_size_t
, c_int
350 type(c_ptr
) :: omp_target_alloc
351 integer(c_size_t
), value :: size
352 integer(c_int
), value :: device_num
353 end function omp_target_alloc
357 subroutine
omp_target_free (device_ptr
, device_num
) bind(c
)
358 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_int
359 type(c_ptr
), value :: device_ptr
360 integer(c_int
), value :: device_num
361 end subroutine omp_target_free
365 function
omp_target_is_present (ptr
, device_num
) bind(c
)
366 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_int
367 integer(c_int
) :: omp_target_is_present
368 type(c_ptr
), value :: ptr
369 integer(c_int
), value :: device_num
370 end function omp_target_is_present
374 function
omp_target_memcpy (dst
, src
, length
, dst_offset
, &
375 & src_offset
, dst_device_num
, &
376 & src_device_num
) bind(c
)
377 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_int
, c_size_t
378 integer(c_int
) :: omp_target_memcpy
379 type(c_ptr
), value :: dst
, src
380 integer(c_size_t
), value :: length
, dst_offset
, src_offset
381 integer(c_int
), value :: dst_device_num
, src_device_num
382 end function omp_target_memcpy
386 function
omp_target_memcpy_async (dst
, src
, length
, dst_offset
, &
387 & src_offset
, dst_device_num
, &
388 & src_device_num
, depobj_count
, &
389 & depobj_list
) bind(c
)
390 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_int
, c_size_t
391 import :: omp_depend_kind
392 integer(c_int
) :: omp_target_memcpy_async
393 type(c_ptr
), value :: dst
, src
394 integer(c_size_t
), value :: length
, dst_offset
, src_offset
395 integer(c_int
), value :: dst_device_num
, src_device_num
396 integer(c_int
), value :: depobj_count
397 integer(omp_depend_kind
), optional :: depobj_list(*)
398 end function omp_target_memcpy_async
402 function
omp_target_memcpy_rect (dst
,src
,element_size
, num_dims
, &
403 & volume
, dst_offsets
, &
404 & src_offsets
, dst_dimensions
, &
405 & src_dimensions
, dst_device_num
, &
406 & src_device_num
) bind(c
)
407 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_int
, c_size_t
408 integer(c_int
) :: omp_target_memcpy_rect
409 type(c_ptr
), value :: dst
, src
410 integer(c_size_t
), value :: element_size
411 integer(c_int
), value :: num_dims
412 integer(c_int
), value :: dst_device_num
, src_device_num
413 integer(c_size_t
), intent(in
) :: volume(*), dst_offsets(*)
414 integer(c_size_t
), intent(in
) :: src_offsets(*)
415 integer(c_size_t
), intent(in
) :: dst_dimensions(*)
416 integer(c_size_t
), intent(in
) :: src_dimensions(*)
417 end function omp_target_memcpy_rect
421 function
omp_target_memcpy_rect_async (dst
,src
,element_size
, &
422 & num_dims
, volume
, &
423 & dst_offsets
, src_offsets
, &
429 & depobj_list
) bind(c
)
430 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_int
, c_size_t
431 import :: omp_depend_kind
432 integer(c_int
) :: omp_target_memcpy_rect_async
433 type(c_ptr
), value :: dst
, src
434 integer(c_size_t
), value :: element_size
435 integer(c_int
), value :: num_dims
, depobj_count
436 integer(c_int
), value :: dst_device_num
, src_device_num
437 integer(c_size_t
), intent(in
) :: volume(*), dst_offsets(*)
438 integer(c_size_t
), intent(in
) :: src_offsets(*)
439 integer(c_size_t
), intent(in
) :: dst_dimensions(*)
440 integer(c_size_t
), intent(in
) :: src_dimensions(*)
441 integer(omp_depend_kind
), optional :: depobj_list(*)
442 end function omp_target_memcpy_rect_async
446 function
omp_target_associate_ptr (host_ptr
, device_ptr
, size
, &
447 & device_offset
, device_num
) &
449 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_size_t
, c_int
450 integer(c_int
) :: omp_target_associate_ptr
451 type(c_ptr
), value :: host_ptr
, device_ptr
452 integer(c_size_t
), value :: size
, device_offset
453 integer(c_int
), value :: device_num
454 end function omp_target_associate_ptr
458 function
omp_target_disassociate_ptr (ptr
, device_num
) bind(c
)
459 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_int
460 integer(c_int
) :: omp_target_disassociate_ptr
461 type(c_ptr
), value :: ptr
462 integer(c_int
), value :: device_num
463 end function omp_target_disassociate_ptr
467 function
omp_get_mapped_ptr (ptr
, device_num
) bind(c
)
468 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_int
469 type(c_ptr
) :: omp_get_mapped_ptr
470 type(c_ptr
), value :: ptr
471 integer(c_int
), value :: device_num
472 end function omp_get_mapped_ptr
476 function
omp_target_is_accessible (ptr
, size
, device_num
) &
478 use
, intrinsic :: iso_c_binding
, only
: c_ptr
, c_size_t
, c_int
479 integer(c_int
) :: omp_target_is_accessible
480 type(c_ptr
), value :: ptr
481 integer(c_size_t
), value :: size
482 integer(c_int
), value :: device_num
483 end function omp_target_is_accessible