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/>.
27 use iso_c_binding
, only
: c_int
, c_intptr_t
29 private
:: c_int
, c_intptr_t
30 integer, parameter :: omp_lock_kind
= @OMP_LOCK_KIND@
31 integer, parameter :: omp_nest_lock_kind
= @OMP_NEST_LOCK_KIND@
32 integer, parameter :: omp_sched_kind
= 4
33 integer, parameter :: omp_proc_bind_kind
= 4
34 integer, parameter :: omp_sync_hint_kind
= 4
35 integer, parameter :: omp_lock_hint_kind
= omp_sync_hint_kind
36 integer, parameter :: omp_pause_resource_kind
= 4
37 integer, parameter :: omp_allocator_handle_kind
= c_intptr_t
38 integer, parameter :: omp_alloctrait_key_kind
= c_int
39 integer, parameter :: omp_alloctrait_val_kind
= c_intptr_t
40 integer, parameter :: omp_memspace_handle_kind
= c_intptr_t
41 integer, parameter :: omp_depend_kind
= @OMP_DEPEND_KIND@
42 integer, parameter :: omp_event_handle_kind
= c_intptr_t
43 integer (omp_sched_kind
), parameter :: omp_sched_static
= 1
44 integer (omp_sched_kind
), parameter :: omp_sched_dynamic
= 2
45 integer (omp_sched_kind
), parameter :: omp_sched_guided
= 3
46 integer (omp_sched_kind
), parameter :: omp_sched_auto
= 4
47 integer (omp_proc_bind_kind
), &
48 parameter :: omp_proc_bind_false
= 0
49 integer (omp_proc_bind_kind
), &
50 parameter :: omp_proc_bind_true
= 1
51 integer (omp_proc_bind_kind
), &
52 parameter :: omp_proc_bind_master
= 2
53 integer (omp_proc_bind_kind
), &
54 parameter :: omp_proc_bind_close
= 3
55 integer (omp_proc_bind_kind
), &
56 parameter :: omp_proc_bind_spread
= 4
57 integer (omp_lock_hint_kind
), &
58 parameter :: omp_sync_hint_none
= 0
59 integer (omp_lock_hint_kind
), &
60 parameter :: omp_lock_hint_none
= omp_sync_hint_none
61 integer (omp_lock_hint_kind
), &
62 parameter :: omp_sync_hint_uncontended
= 1
63 integer (omp_lock_hint_kind
), &
64 parameter :: omp_lock_hint_uncontended
&
65 = omp_sync_hint_uncontended
66 integer (omp_lock_hint_kind
), &
67 parameter :: omp_sync_hint_contended
= 2
68 integer (omp_lock_hint_kind
), &
69 parameter :: omp_lock_hint_contended
&
70 = omp_sync_hint_contended
71 integer (omp_lock_hint_kind
), &
72 parameter :: omp_sync_hint_nonspeculative
= 4
73 integer (omp_lock_hint_kind
), &
74 parameter :: omp_lock_hint_nonspeculative
&
75 = omp_sync_hint_nonspeculative
76 integer (omp_lock_hint_kind
), &
77 parameter :: omp_sync_hint_speculative
= 8
78 integer (omp_lock_hint_kind
), &
79 parameter :: omp_lock_hint_speculative
&
80 = omp_sync_hint_speculative
81 integer (kind
=omp_pause_resource_kind
), &
82 parameter :: omp_pause_soft
= 1
83 integer (kind
=omp_pause_resource_kind
), &
84 parameter :: omp_pause_hard
= 2
85 integer (kind
=omp_alloctrait_key_kind
), &
86 parameter :: omp_atk_sync_hint
= 1
87 integer (kind
=omp_alloctrait_key_kind
), &
88 parameter :: omp_atk_alignment
= 2
89 integer (kind
=omp_alloctrait_key_kind
), &
90 parameter :: omp_atk_access
= 3
91 integer (kind
=omp_alloctrait_key_kind
), &
92 parameter :: omp_atk_pool_size
= 4
93 integer (kind
=omp_alloctrait_key_kind
), &
94 parameter :: omp_atk_fallback
= 5
95 integer (kind
=omp_alloctrait_key_kind
), &
96 parameter :: omp_atk_fb_data
= 6
97 integer (kind
=omp_alloctrait_key_kind
), &
98 parameter :: omp_atk_pinned
= 7
99 integer (kind
=omp_alloctrait_key_kind
), &
100 parameter :: omp_atk_partition
= 8
101 integer (kind
=omp_alloctrait_val_kind
), &
102 parameter :: omp_atv_default
= -1
103 integer (kind
=omp_alloctrait_val_kind
), &
104 parameter :: omp_atv_false
= 0
105 integer (kind
=omp_alloctrait_val_kind
), &
106 parameter :: omp_atv_true
= 1
107 integer (kind
=omp_alloctrait_val_kind
), &
108 parameter :: omp_atv_contended
= 3
109 integer (kind
=omp_alloctrait_val_kind
), &
110 parameter :: omp_atv_uncontended
= 4
111 integer (kind
=omp_alloctrait_val_kind
), &
112 parameter :: omp_atv_serialized
= 5
113 integer (kind
=omp_alloctrait_val_kind
), &
114 parameter :: omp_atv_sequential
= omp_atv_serialized
115 integer (kind
=omp_alloctrait_val_kind
), &
116 parameter :: omp_atv_private
= 6
117 integer (kind
=omp_alloctrait_val_kind
), &
118 parameter :: omp_atv_all
= 7
119 integer (kind
=omp_alloctrait_val_kind
), &
120 parameter :: omp_atv_thread
= 8
121 integer (kind
=omp_alloctrait_val_kind
), &
122 parameter :: omp_atv_pteam
= 9
123 integer (kind
=omp_alloctrait_val_kind
), &
124 parameter :: omp_atv_cgroup
= 10
125 integer (kind
=omp_alloctrait_val_kind
), &
126 parameter :: omp_atv_default_mem_fb
= 11
127 integer (kind
=omp_alloctrait_val_kind
), &
128 parameter :: omp_atv_null_fb
= 12
129 integer (kind
=omp_alloctrait_val_kind
), &
130 parameter :: omp_atv_abort_fb
= 13
131 integer (kind
=omp_alloctrait_val_kind
), &
132 parameter :: omp_atv_allocator_fb
= 14
133 integer (kind
=omp_alloctrait_val_kind
), &
134 parameter :: omp_atv_environment
= 15
135 integer (kind
=omp_alloctrait_val_kind
), &
136 parameter :: omp_atv_nearest
= 16
137 integer (kind
=omp_alloctrait_val_kind
), &
138 parameter :: omp_atv_blocked
= 17
139 integer (kind
=omp_alloctrait_val_kind
), &
140 parameter :: omp_atv_interleaved
= 18
141 integer (kind
=omp_allocator_handle_kind
), &
142 parameter :: omp_null_allocator
= 0
143 integer (kind
=omp_allocator_handle_kind
), &
144 parameter :: omp_default_mem_alloc
= 1
145 integer (kind
=omp_allocator_handle_kind
), &
146 parameter :: omp_large_cap_mem_alloc
= 2
147 integer (kind
=omp_allocator_handle_kind
), &
148 parameter :: omp_const_mem_alloc
= 3
149 integer (kind
=omp_allocator_handle_kind
), &
150 parameter :: omp_high_bw_mem_alloc
= 4
151 integer (kind
=omp_allocator_handle_kind
), &
152 parameter :: omp_low_lat_mem_alloc
= 5
153 integer (kind
=omp_allocator_handle_kind
), &
154 parameter :: omp_cgroup_mem_alloc
= 6
155 integer (kind
=omp_allocator_handle_kind
), &
156 parameter :: omp_pteam_mem_alloc
= 7
157 integer (kind
=omp_allocator_handle_kind
), &
158 parameter :: omp_thread_mem_alloc
= 8
159 integer (omp_memspace_handle_kind
), &
160 parameter :: omp_default_mem_space
= 0
161 integer (omp_memspace_handle_kind
), &
162 parameter :: omp_large_cap_mem_space
= 1
163 integer (omp_memspace_handle_kind
), &
164 parameter :: omp_const_mem_space
= 2
165 integer (omp_memspace_handle_kind
), &
166 parameter :: omp_high_bw_mem_space
= 3
167 integer (omp_memspace_handle_kind
), &
168 parameter :: omp_low_lat_mem_space
= 4
171 integer (kind
=omp_alloctrait_key_kind
) key
172 integer (kind
=omp_alloctrait_val_kind
) value
173 end type omp_alloctrait
179 integer, parameter :: openmp_version
= 201511
182 subroutine omp_init_lock (svar
)
184 integer (omp_lock_kind
), intent (out
) :: svar
185 end subroutine omp_init_lock
189 subroutine omp_init_lock_with_hint (svar
, hint
)
191 integer (omp_lock_kind
), intent (out
) :: svar
192 integer (omp_lock_hint_kind
), intent (in
) :: hint
193 end subroutine omp_init_lock_with_hint
197 subroutine omp_init_nest_lock (nvar
)
199 integer (omp_nest_lock_kind
), intent (out
) :: nvar
200 end subroutine omp_init_nest_lock
204 subroutine omp_init_nest_lock_with_hint (nvar
, hint
)
206 integer (omp_nest_lock_kind
), intent (out
) :: nvar
207 integer (omp_lock_hint_kind
), intent (in
) :: hint
208 end subroutine omp_init_nest_lock_with_hint
212 subroutine omp_destroy_lock (svar
)
214 integer (omp_lock_kind
), intent (inout
) :: svar
215 end subroutine omp_destroy_lock
219 subroutine omp_destroy_nest_lock (nvar
)
221 integer (omp_nest_lock_kind
), intent (inout
) :: nvar
222 end subroutine omp_destroy_nest_lock
226 subroutine omp_set_lock (svar
)
228 integer (omp_lock_kind
), intent (inout
) :: svar
229 end subroutine omp_set_lock
233 subroutine omp_set_nest_lock (nvar
)
235 integer (omp_nest_lock_kind
), intent (inout
) :: nvar
236 end subroutine omp_set_nest_lock
240 subroutine omp_unset_lock (svar
)
242 integer (omp_lock_kind
), intent (inout
) :: svar
243 end subroutine omp_unset_lock
247 subroutine omp_unset_nest_lock (nvar
)
249 integer (omp_nest_lock_kind
), intent (inout
) :: nvar
250 end subroutine omp_unset_nest_lock
253 interface omp_set_dynamic
254 subroutine omp_set_dynamic (dynamic_threads
)
255 logical (4), intent (in
) :: dynamic_threads
256 end subroutine omp_set_dynamic
257 subroutine omp_set_dynamic_8 (dynamic_threads
)
258 logical (8), intent (in
) :: dynamic_threads
259 end subroutine omp_set_dynamic_8
262 interface omp_set_nested
263 subroutine omp_set_nested (nested
)
264 logical (4), intent (in
) :: nested
265 end subroutine omp_set_nested
266 subroutine omp_set_nested_8 (nested
)
267 logical (8), intent (in
) :: nested
268 end subroutine omp_set_nested_8
271 interface omp_set_num_threads
272 subroutine omp_set_num_threads (num_threads
)
273 integer (4), intent (in
) :: num_threads
274 end subroutine omp_set_num_threads
275 subroutine omp_set_num_threads_8 (num_threads
)
276 integer (8), intent (in
) :: num_threads
277 end subroutine omp_set_num_threads_8
281 function omp_get_dynamic ()
282 logical (4) :: omp_get_dynamic
283 end function omp_get_dynamic
287 function omp_get_nested ()
288 logical (4) :: omp_get_nested
289 end function omp_get_nested
293 function omp_in_parallel ()
294 logical (4) :: omp_in_parallel
295 end function omp_in_parallel
299 function omp_test_lock (svar
)
301 logical (4) :: omp_test_lock
302 integer (omp_lock_kind
), intent (inout
) :: svar
303 end function omp_test_lock
307 function omp_get_max_threads ()
308 integer (4) :: omp_get_max_threads
309 end function omp_get_max_threads
313 function omp_get_num_procs ()
314 integer (4) :: omp_get_num_procs
315 end function omp_get_num_procs
319 function omp_get_num_threads ()
320 integer (4) :: omp_get_num_threads
321 end function omp_get_num_threads
325 function omp_get_thread_num ()
326 integer (4) :: omp_get_thread_num
327 end function omp_get_thread_num
331 function omp_test_nest_lock (nvar
)
333 integer (4) :: omp_test_nest_lock
334 integer (omp_nest_lock_kind
), intent (inout
) :: nvar
335 end function omp_test_nest_lock
339 function omp_get_wtick ()
340 double precision :: omp_get_wtick
341 end function omp_get_wtick
345 function omp_get_wtime ()
346 double precision :: omp_get_wtime
347 end function omp_get_wtime
350 interface omp_set_schedule
351 subroutine omp_set_schedule (kind
, chunk_size
)
353 integer (omp_sched_kind
), intent (in
) :: kind
354 integer (4), intent (in
) :: chunk_size
355 end subroutine omp_set_schedule
356 subroutine omp_set_schedule_8 (kind
, chunk_size
)
358 integer (omp_sched_kind
), intent (in
) :: kind
359 integer (8), intent (in
) :: chunk_size
360 end subroutine omp_set_schedule_8
363 interface omp_get_schedule
364 subroutine omp_get_schedule (kind
, chunk_size
)
366 integer (omp_sched_kind
), intent (out
) :: kind
367 integer (4), intent (out
) :: chunk_size
368 end subroutine omp_get_schedule
369 subroutine omp_get_schedule_8 (kind
, chunk_size
)
371 integer (omp_sched_kind
), intent (out
) :: kind
372 integer (8), intent (out
) :: chunk_size
373 end subroutine omp_get_schedule_8
377 function omp_get_thread_limit ()
378 integer (4) :: omp_get_thread_limit
379 end function omp_get_thread_limit
382 interface omp_set_max_active_levels
383 subroutine omp_set_max_active_levels (max_levels
)
384 integer (4), intent (in
) :: max_levels
385 end subroutine omp_set_max_active_levels
386 subroutine omp_set_max_active_levels_8 (max_levels
)
387 integer (8), intent (in
) :: max_levels
388 end subroutine omp_set_max_active_levels_8
392 function omp_get_max_active_levels ()
393 integer (4) :: omp_get_max_active_levels
394 end function omp_get_max_active_levels
398 function omp_get_supported_active_levels ()
399 integer (4) :: omp_get_supported_active_levels
400 end function omp_get_supported_active_levels
404 function omp_get_level ()
405 integer (4) :: omp_get_level
406 end function omp_get_level
409 interface omp_get_ancestor_thread_num
410 function omp_get_ancestor_thread_num (level
)
411 integer (4), intent (in
) :: level
412 integer (4) :: omp_get_ancestor_thread_num
413 end function omp_get_ancestor_thread_num
414 function omp_get_ancestor_thread_num_8 (level
)
415 integer (8), intent (in
) :: level
416 integer (4) :: omp_get_ancestor_thread_num_8
417 end function omp_get_ancestor_thread_num_8
420 interface omp_get_team_size
421 function omp_get_team_size (level
)
422 integer (4), intent (in
) :: level
423 integer (4) :: omp_get_team_size
424 end function omp_get_team_size
425 function omp_get_team_size_8 (level
)
426 integer (8), intent (in
) :: level
427 integer (4) :: omp_get_team_size_8
428 end function omp_get_team_size_8
432 function omp_get_active_level ()
433 integer (4) :: omp_get_active_level
434 end function omp_get_active_level
438 function omp_in_final ()
439 logical (4) :: omp_in_final
440 end function omp_in_final
444 function omp_get_cancellation ()
445 logical (4) :: omp_get_cancellation
446 end function omp_get_cancellation
450 function omp_get_proc_bind ()
452 integer (omp_proc_bind_kind
) :: omp_get_proc_bind
453 end function omp_get_proc_bind
457 function omp_get_num_places ()
458 integer (4) :: omp_get_num_places
459 end function omp_get_num_places
462 interface omp_get_place_num_procs
463 function omp_get_place_num_procs (place_num
)
464 integer (4), intent(in
) :: place_num
465 integer (4) :: omp_get_place_num_procs
466 end function omp_get_place_num_procs
468 function omp_get_place_num_procs_8 (place_num
)
469 integer (8), intent(in
) :: place_num
470 integer (4) :: omp_get_place_num_procs_8
471 end function omp_get_place_num_procs_8
474 interface omp_get_place_proc_ids
475 subroutine omp_get_place_proc_ids (place_num
, ids
)
476 integer (4), intent(in
) :: place_num
477 integer (4), intent(out
) :: ids(*)
478 end subroutine omp_get_place_proc_ids
480 subroutine omp_get_place_proc_ids_8 (place_num
, ids
)
481 integer (8), intent(in
) :: place_num
482 integer (8), intent(out
) :: ids(*)
483 end subroutine omp_get_place_proc_ids_8
487 function omp_get_place_num ()
488 integer (4) :: omp_get_place_num
489 end function omp_get_place_num
493 function omp_get_partition_num_places ()
494 integer (4) :: omp_get_partition_num_places
495 end function omp_get_partition_num_places
498 interface omp_get_partition_place_nums
499 subroutine omp_get_partition_place_nums (place_nums
)
500 integer (4), intent(out
) :: place_nums(*)
501 end subroutine omp_get_partition_place_nums
503 subroutine omp_get_partition_place_nums_8 (place_nums
)
504 integer (8), intent(out
) :: place_nums(*)
505 end subroutine omp_get_partition_place_nums_8
508 interface omp_set_default_device
509 subroutine omp_set_default_device (device_num
)
510 integer (4), intent (in
) :: device_num
511 end subroutine omp_set_default_device
512 subroutine omp_set_default_device_8 (device_num
)
513 integer (8), intent (in
) :: device_num
514 end subroutine omp_set_default_device_8
518 function omp_get_default_device ()
519 integer (4) :: omp_get_default_device
520 end function omp_get_default_device
524 function omp_get_num_devices ()
525 integer (4) :: omp_get_num_devices
526 end function omp_get_num_devices
530 function omp_get_num_teams ()
531 integer (4) :: omp_get_num_teams
532 end function omp_get_num_teams
536 function omp_get_team_num ()
537 integer (4) :: omp_get_team_num
538 end function omp_get_team_num
542 function omp_is_initial_device ()
543 logical (4) :: omp_is_initial_device
544 end function omp_is_initial_device
548 function omp_get_initial_device ()
549 integer (4) :: omp_get_initial_device
550 end function omp_get_initial_device
554 function omp_get_max_task_priority ()
555 integer (4) :: omp_get_max_task_priority
556 end function omp_get_max_task_priority
560 subroutine omp_fulfill_event (event
)
562 integer (kind
=omp_event_handle_kind
), &
563 value
, intent(in
) :: event
564 end subroutine omp_fulfill_event
568 subroutine omp_set_affinity_format (format)
569 character(len
=*), intent(in
) :: format
570 end subroutine omp_set_affinity_format
574 function omp_get_affinity_format (buffer
)
575 integer (4) :: omp_get_affinity_format
576 character(len
=*), intent(out
) :: buffer
577 end function omp_get_affinity_format
581 subroutine omp_display_affinity (format)
582 character(len
=*), intent(in
) :: format
583 end subroutine omp_display_affinity
587 function omp_capture_affinity (buffer
, format)
588 integer (4) :: omp_capture_affinity
589 character(len
=*), intent(out
) :: buffer
590 character(len
=*), intent(in
) :: format
591 end function omp_capture_affinity
595 function omp_pause_resource (kind
, device_num
)
597 integer (4) :: omp_pause_resource
598 integer (kind
=omp_pause_resource_kind
), &
600 integer (4) :: device_num
605 function omp_pause_resource_all (kind
)
607 integer (4) :: omp_pause_resource_all
608 integer (kind
=omp_pause_resource_kind
), &
613 interface omp_init_allocator
614 function omp_init_allocator (memspace
, ntraits
, traits
)
616 integer (kind
=omp_allocator_handle_kind
) omp_init_allocator
617 integer (kind
=omp_memspace_handle_kind
), &
618 intent(in
) :: memspace
619 integer (4), intent(in
) :: ntraits
620 type (omp_alloctrait
), intent(in
) :: traits(*)
622 function omp_init_allocator_8 (memspace
, ntraits
, traits
)
624 integer (kind
=omp_allocator_handle_kind
) omp_init_allocator_8
625 integer (kind
=omp_memspace_handle_kind
), &
626 intent(in
) :: memspace
627 integer (8), intent(in
) :: ntraits
628 type (omp_alloctrait
), intent(in
) :: traits(*)
633 subroutine omp_destroy_allocator (allocator
)
635 integer (kind
=omp_allocator_handle_kind
), &
636 intent(in
) :: allocator
641 subroutine omp_set_default_allocator (allocator
)
643 integer (kind
=omp_allocator_handle_kind
), &
644 intent(in
) :: allocator
649 function omp_get_default_allocator ()
651 integer (kind
=omp_allocator_handle_kind
) &
652 omp_get_default_allocator
656 #
if _OPENMP
>= 201811
657 !GCC$ ATTRIBUTES DEPRECATED :: omp_get_nested, omp_set_nested