1 ! Copyright (C) 2005-2020 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 (omp_sched_kind
), parameter :: omp_sched_static
= 1
43 integer (omp_sched_kind
), parameter :: omp_sched_dynamic
= 2
44 integer (omp_sched_kind
), parameter :: omp_sched_guided
= 3
45 integer (omp_sched_kind
), parameter :: omp_sched_auto
= 4
46 integer (omp_proc_bind_kind
), &
47 parameter :: omp_proc_bind_false
= 0
48 integer (omp_proc_bind_kind
), &
49 parameter :: omp_proc_bind_true
= 1
50 integer (omp_proc_bind_kind
), &
51 parameter :: omp_proc_bind_master
= 2
52 integer (omp_proc_bind_kind
), &
53 parameter :: omp_proc_bind_close
= 3
54 integer (omp_proc_bind_kind
), &
55 parameter :: omp_proc_bind_spread
= 4
56 integer (omp_lock_hint_kind
), &
57 parameter :: omp_sync_hint_none
= 0
58 integer (omp_lock_hint_kind
), &
59 parameter :: omp_lock_hint_none
= omp_sync_hint_none
60 integer (omp_lock_hint_kind
), &
61 parameter :: omp_sync_hint_uncontended
= 1
62 integer (omp_lock_hint_kind
), &
63 parameter :: omp_lock_hint_uncontended
&
64 = omp_sync_hint_uncontended
65 integer (omp_lock_hint_kind
), &
66 parameter :: omp_sync_hint_contended
= 2
67 integer (omp_lock_hint_kind
), &
68 parameter :: omp_lock_hint_contended
&
69 = omp_sync_hint_contended
70 integer (omp_lock_hint_kind
), &
71 parameter :: omp_sync_hint_nonspeculative
= 4
72 integer (omp_lock_hint_kind
), &
73 parameter :: omp_lock_hint_nonspeculative
&
74 = omp_sync_hint_nonspeculative
75 integer (omp_lock_hint_kind
), &
76 parameter :: omp_sync_hint_speculative
= 8
77 integer (omp_lock_hint_kind
), &
78 parameter :: omp_lock_hint_speculative
&
79 = omp_sync_hint_speculative
80 integer (kind
=omp_pause_resource_kind
), &
81 parameter :: omp_pause_soft
= 1
82 integer (kind
=omp_pause_resource_kind
), &
83 parameter :: omp_pause_hard
= 2
84 integer (kind
=omp_alloctrait_key_kind
), &
85 parameter :: omp_atk_sync_hint
= 1
86 integer (kind
=omp_alloctrait_key_kind
), &
87 parameter :: omp_atk_alignment
= 2
88 integer (kind
=omp_alloctrait_key_kind
), &
89 parameter :: omp_atk_access
= 3
90 integer (kind
=omp_alloctrait_key_kind
), &
91 parameter :: omp_atk_pool_size
= 4
92 integer (kind
=omp_alloctrait_key_kind
), &
93 parameter :: omp_atk_fallback
= 5
94 integer (kind
=omp_alloctrait_key_kind
), &
95 parameter :: omp_atk_fb_data
= 6
96 integer (kind
=omp_alloctrait_key_kind
), &
97 parameter :: omp_atk_pinned
= 7
98 integer (kind
=omp_alloctrait_key_kind
), &
99 parameter :: omp_atk_partition
= 8
100 integer (kind
=omp_alloctrait_val_kind
), &
101 parameter :: omp_atv_default
= -1
102 integer (kind
=omp_alloctrait_val_kind
), &
103 parameter :: omp_atv_false
= 0
104 integer (kind
=omp_alloctrait_val_kind
), &
105 parameter :: omp_atv_true
= 1
106 integer (kind
=omp_alloctrait_val_kind
), &
107 parameter :: omp_atv_contended
= 3
108 integer (kind
=omp_alloctrait_val_kind
), &
109 parameter :: omp_atv_uncontended
= 4
110 integer (kind
=omp_alloctrait_val_kind
), &
111 parameter :: omp_atv_serialized
= 5
112 integer (kind
=omp_alloctrait_val_kind
), &
113 parameter :: omp_atv_sequential
= omp_atv_serialized
114 integer (kind
=omp_alloctrait_val_kind
), &
115 parameter :: omp_atv_private
= 6
116 integer (kind
=omp_alloctrait_val_kind
), &
117 parameter :: omp_atv_all
= 7
118 integer (kind
=omp_alloctrait_val_kind
), &
119 parameter :: omp_atv_thread
= 8
120 integer (kind
=omp_alloctrait_val_kind
), &
121 parameter :: omp_atv_pteam
= 9
122 integer (kind
=omp_alloctrait_val_kind
), &
123 parameter :: omp_atv_cgroup
= 10
124 integer (kind
=omp_alloctrait_val_kind
), &
125 parameter :: omp_atv_default_mem_fb
= 11
126 integer (kind
=omp_alloctrait_val_kind
), &
127 parameter :: omp_atv_null_fb
= 12
128 integer (kind
=omp_alloctrait_val_kind
), &
129 parameter :: omp_atv_abort_fb
= 13
130 integer (kind
=omp_alloctrait_val_kind
), &
131 parameter :: omp_atv_allocator_fb
= 14
132 integer (kind
=omp_alloctrait_val_kind
), &
133 parameter :: omp_atv_environment
= 15
134 integer (kind
=omp_alloctrait_val_kind
), &
135 parameter :: omp_atv_nearest
= 16
136 integer (kind
=omp_alloctrait_val_kind
), &
137 parameter :: omp_atv_blocked
= 17
138 integer (kind
=omp_alloctrait_val_kind
), &
139 parameter :: omp_atv_interleaved
= 18
140 integer (kind
=omp_allocator_handle_kind
), &
141 parameter :: omp_null_allocator
= 0
142 integer (kind
=omp_allocator_handle_kind
), &
143 parameter :: omp_default_mem_alloc
= 1
144 integer (kind
=omp_allocator_handle_kind
), &
145 parameter :: omp_large_cap_mem_alloc
= 2
146 integer (kind
=omp_allocator_handle_kind
), &
147 parameter :: omp_const_mem_alloc
= 3
148 integer (kind
=omp_allocator_handle_kind
), &
149 parameter :: omp_high_bw_mem_alloc
= 4
150 integer (kind
=omp_allocator_handle_kind
), &
151 parameter :: omp_low_lat_mem_alloc
= 5
152 integer (kind
=omp_allocator_handle_kind
), &
153 parameter :: omp_cgroup_mem_alloc
= 6
154 integer (kind
=omp_allocator_handle_kind
), &
155 parameter :: omp_pteam_mem_alloc
= 7
156 integer (kind
=omp_allocator_handle_kind
), &
157 parameter :: omp_thread_mem_alloc
= 8
158 integer (omp_memspace_handle_kind
), &
159 parameter :: omp_default_mem_space
= 0
160 integer (omp_memspace_handle_kind
), &
161 parameter :: omp_large_cap_mem_space
= 1
162 integer (omp_memspace_handle_kind
), &
163 parameter :: omp_const_mem_space
= 2
164 integer (omp_memspace_handle_kind
), &
165 parameter :: omp_high_bw_mem_space
= 3
166 integer (omp_memspace_handle_kind
), &
167 parameter :: omp_low_lat_mem_space
= 4
170 integer (kind
=omp_alloctrait_key_kind
) key
171 integer (kind
=omp_alloctrait_val_kind
) value
172 end type omp_alloctrait
178 integer, parameter :: openmp_version
= 201511
181 subroutine omp_init_lock (svar
)
183 integer (omp_lock_kind
), intent (out
) :: svar
184 end subroutine omp_init_lock
188 subroutine omp_init_lock_with_hint (svar
, hint
)
190 integer (omp_lock_kind
), intent (out
) :: svar
191 integer (omp_lock_hint_kind
), intent (in
) :: hint
192 end subroutine omp_init_lock_with_hint
196 subroutine omp_init_nest_lock (nvar
)
198 integer (omp_nest_lock_kind
), intent (out
) :: nvar
199 end subroutine omp_init_nest_lock
203 subroutine omp_init_nest_lock_with_hint (nvar
, hint
)
205 integer (omp_nest_lock_kind
), intent (out
) :: nvar
206 integer (omp_lock_hint_kind
), intent (in
) :: hint
207 end subroutine omp_init_nest_lock_with_hint
211 subroutine omp_destroy_lock (svar
)
213 integer (omp_lock_kind
), intent (inout
) :: svar
214 end subroutine omp_destroy_lock
218 subroutine omp_destroy_nest_lock (nvar
)
220 integer (omp_nest_lock_kind
), intent (inout
) :: nvar
221 end subroutine omp_destroy_nest_lock
225 subroutine omp_set_lock (svar
)
227 integer (omp_lock_kind
), intent (inout
) :: svar
228 end subroutine omp_set_lock
232 subroutine omp_set_nest_lock (nvar
)
234 integer (omp_nest_lock_kind
), intent (inout
) :: nvar
235 end subroutine omp_set_nest_lock
239 subroutine omp_unset_lock (svar
)
241 integer (omp_lock_kind
), intent (inout
) :: svar
242 end subroutine omp_unset_lock
246 subroutine omp_unset_nest_lock (nvar
)
248 integer (omp_nest_lock_kind
), intent (inout
) :: nvar
249 end subroutine omp_unset_nest_lock
252 interface omp_set_dynamic
253 subroutine omp_set_dynamic (dynamic_threads
)
254 logical (4), intent (in
) :: dynamic_threads
255 end subroutine omp_set_dynamic
256 subroutine omp_set_dynamic_8 (dynamic_threads
)
257 logical (8), intent (in
) :: dynamic_threads
258 end subroutine omp_set_dynamic_8
261 interface omp_set_nested
262 subroutine omp_set_nested (nested
)
263 logical (4), intent (in
) :: nested
264 end subroutine omp_set_nested
265 subroutine omp_set_nested_8 (nested
)
266 logical (8), intent (in
) :: nested
267 end subroutine omp_set_nested_8
270 interface omp_set_num_threads
271 subroutine omp_set_num_threads (num_threads
)
272 integer (4), intent (in
) :: num_threads
273 end subroutine omp_set_num_threads
274 subroutine omp_set_num_threads_8 (num_threads
)
275 integer (8), intent (in
) :: num_threads
276 end subroutine omp_set_num_threads_8
280 function omp_get_dynamic ()
281 logical (4) :: omp_get_dynamic
282 end function omp_get_dynamic
286 function omp_get_nested ()
287 logical (4) :: omp_get_nested
288 end function omp_get_nested
292 function omp_in_parallel ()
293 logical (4) :: omp_in_parallel
294 end function omp_in_parallel
298 function omp_test_lock (svar
)
300 logical (4) :: omp_test_lock
301 integer (omp_lock_kind
), intent (inout
) :: svar
302 end function omp_test_lock
306 function omp_get_max_threads ()
307 integer (4) :: omp_get_max_threads
308 end function omp_get_max_threads
312 function omp_get_num_procs ()
313 integer (4) :: omp_get_num_procs
314 end function omp_get_num_procs
318 function omp_get_num_threads ()
319 integer (4) :: omp_get_num_threads
320 end function omp_get_num_threads
324 function omp_get_thread_num ()
325 integer (4) :: omp_get_thread_num
326 end function omp_get_thread_num
330 function omp_test_nest_lock (nvar
)
332 integer (4) :: omp_test_nest_lock
333 integer (omp_nest_lock_kind
), intent (inout
) :: nvar
334 end function omp_test_nest_lock
338 function omp_get_wtick ()
339 double precision :: omp_get_wtick
340 end function omp_get_wtick
344 function omp_get_wtime ()
345 double precision :: omp_get_wtime
346 end function omp_get_wtime
349 interface omp_set_schedule
350 subroutine omp_set_schedule (kind
, chunk_size
)
352 integer (omp_sched_kind
), intent (in
) :: kind
353 integer (4), intent (in
) :: chunk_size
354 end subroutine omp_set_schedule
355 subroutine omp_set_schedule_8 (kind
, chunk_size
)
357 integer (omp_sched_kind
), intent (in
) :: kind
358 integer (8), intent (in
) :: chunk_size
359 end subroutine omp_set_schedule_8
362 interface omp_get_schedule
363 subroutine omp_get_schedule (kind
, chunk_size
)
365 integer (omp_sched_kind
), intent (out
) :: kind
366 integer (4), intent (out
) :: chunk_size
367 end subroutine omp_get_schedule
368 subroutine omp_get_schedule_8 (kind
, chunk_size
)
370 integer (omp_sched_kind
), intent (out
) :: kind
371 integer (8), intent (out
) :: chunk_size
372 end subroutine omp_get_schedule_8
376 function omp_get_thread_limit ()
377 integer (4) :: omp_get_thread_limit
378 end function omp_get_thread_limit
381 interface omp_set_max_active_levels
382 subroutine omp_set_max_active_levels (max_levels
)
383 integer (4), intent (in
) :: max_levels
384 end subroutine omp_set_max_active_levels
385 subroutine omp_set_max_active_levels_8 (max_levels
)
386 integer (8), intent (in
) :: max_levels
387 end subroutine omp_set_max_active_levels_8
391 function omp_get_max_active_levels ()
392 integer (4) :: omp_get_max_active_levels
393 end function omp_get_max_active_levels
397 function omp_get_supported_active_levels ()
398 integer (4) :: omp_get_supported_active_levels
399 end function omp_get_supported_active_levels
403 function omp_get_level ()
404 integer (4) :: omp_get_level
405 end function omp_get_level
408 interface omp_get_ancestor_thread_num
409 function omp_get_ancestor_thread_num (level
)
410 integer (4), intent (in
) :: level
411 integer (4) :: omp_get_ancestor_thread_num
412 end function omp_get_ancestor_thread_num
413 function omp_get_ancestor_thread_num_8 (level
)
414 integer (8), intent (in
) :: level
415 integer (4) :: omp_get_ancestor_thread_num_8
416 end function omp_get_ancestor_thread_num_8
419 interface omp_get_team_size
420 function omp_get_team_size (level
)
421 integer (4), intent (in
) :: level
422 integer (4) :: omp_get_team_size
423 end function omp_get_team_size
424 function omp_get_team_size_8 (level
)
425 integer (8), intent (in
) :: level
426 integer (4) :: omp_get_team_size_8
427 end function omp_get_team_size_8
431 function omp_get_active_level ()
432 integer (4) :: omp_get_active_level
433 end function omp_get_active_level
437 function omp_in_final ()
438 logical (4) :: omp_in_final
439 end function omp_in_final
443 function omp_get_cancellation ()
444 logical (4) :: omp_get_cancellation
445 end function omp_get_cancellation
449 function omp_get_proc_bind ()
451 integer (omp_proc_bind_kind
) :: omp_get_proc_bind
452 end function omp_get_proc_bind
456 function omp_get_num_places ()
457 integer (4) :: omp_get_num_places
458 end function omp_get_num_places
461 interface omp_get_place_num_procs
462 function omp_get_place_num_procs (place_num
)
463 integer (4), intent(in
) :: place_num
464 integer (4) :: omp_get_place_num_procs
465 end function omp_get_place_num_procs
467 function omp_get_place_num_procs_8 (place_num
)
468 integer (8), intent(in
) :: place_num
469 integer (4) :: omp_get_place_num_procs_8
470 end function omp_get_place_num_procs_8
473 interface omp_get_place_proc_ids
474 subroutine omp_get_place_proc_ids (place_num
, ids
)
475 integer (4), intent(in
) :: place_num
476 integer (4), intent(out
) :: ids(*)
477 end subroutine omp_get_place_proc_ids
479 subroutine omp_get_place_proc_ids_8 (place_num
, ids
)
480 integer (8), intent(in
) :: place_num
481 integer (8), intent(out
) :: ids(*)
482 end subroutine omp_get_place_proc_ids_8
486 function omp_get_place_num ()
487 integer (4) :: omp_get_place_num
488 end function omp_get_place_num
492 function omp_get_partition_num_places ()
493 integer (4) :: omp_get_partition_num_places
494 end function omp_get_partition_num_places
497 interface omp_get_partition_place_nums
498 subroutine omp_get_partition_place_nums (place_nums
)
499 integer (4), intent(out
) :: place_nums(*)
500 end subroutine omp_get_partition_place_nums
502 subroutine omp_get_partition_place_nums_8 (place_nums
)
503 integer (8), intent(out
) :: place_nums(*)
504 end subroutine omp_get_partition_place_nums_8
507 interface omp_set_default_device
508 subroutine omp_set_default_device (device_num
)
509 integer (4), intent (in
) :: device_num
510 end subroutine omp_set_default_device
511 subroutine omp_set_default_device_8 (device_num
)
512 integer (8), intent (in
) :: device_num
513 end subroutine omp_set_default_device_8
517 function omp_get_default_device ()
518 integer (4) :: omp_get_default_device
519 end function omp_get_default_device
523 function omp_get_num_devices ()
524 integer (4) :: omp_get_num_devices
525 end function omp_get_num_devices
529 function omp_get_num_teams ()
530 integer (4) :: omp_get_num_teams
531 end function omp_get_num_teams
535 function omp_get_team_num ()
536 integer (4) :: omp_get_team_num
537 end function omp_get_team_num
541 function omp_is_initial_device ()
542 logical (4) :: omp_is_initial_device
543 end function omp_is_initial_device
547 function omp_get_initial_device ()
548 integer (4) :: omp_get_initial_device
549 end function omp_get_initial_device
553 function omp_get_max_task_priority ()
554 integer (4) :: omp_get_max_task_priority
555 end function omp_get_max_task_priority
559 subroutine omp_set_affinity_format (format)
560 character(len
=*), intent(in
) :: format
561 end subroutine omp_set_affinity_format
565 function omp_get_affinity_format (buffer
)
566 integer (4) :: omp_get_affinity_format
567 character(len
=*), intent(out
) :: buffer
568 end function omp_get_affinity_format
572 subroutine omp_display_affinity (format)
573 character(len
=*), intent(in
) :: format
574 end subroutine omp_display_affinity
578 function omp_capture_affinity (buffer
, format)
579 integer (4) :: omp_capture_affinity
580 character(len
=*), intent(out
) :: buffer
581 character(len
=*), intent(in
) :: format
582 end function omp_capture_affinity
586 function omp_pause_resource (kind
, device_num
)
588 integer (4) :: omp_pause_resource
589 integer (kind
=omp_pause_resource_kind
), &
591 integer (4) :: device_num
596 function omp_pause_resource_all (kind
)
598 integer (4) :: omp_pause_resource_all
599 integer (kind
=omp_pause_resource_kind
), &
604 interface omp_init_allocator
605 function omp_init_allocator (memspace
, ntraits
, traits
)
607 integer (kind
=omp_allocator_handle_kind
) omp_init_allocator
608 integer (kind
=omp_memspace_handle_kind
), &
609 intent(in
) :: memspace
610 integer (4), intent(in
) :: ntraits
611 type (omp_alloctrait
), intent(in
) :: traits(*)
613 function omp_init_allocator_8 (memspace
, ntraits
, traits
)
615 integer (kind
=omp_allocator_handle_kind
) omp_init_allocator_8
616 integer (kind
=omp_memspace_handle_kind
), &
617 intent(in
) :: memspace
618 integer (8), intent(in
) :: ntraits
619 type (omp_alloctrait
), intent(in
) :: traits(*)
624 subroutine omp_destroy_allocator (allocator
)
626 integer (kind
=omp_allocator_handle_kind
), &
627 intent(in
) :: allocator
632 subroutine omp_set_default_allocator (allocator
)
634 integer (kind
=omp_allocator_handle_kind
), &
635 intent(in
) :: allocator
640 function omp_get_default_allocator ()
642 integer (kind
=omp_allocator_handle_kind
) &
643 omp_get_default_allocator