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_lock_hint_kind
= 4
35 integer, parameter :: omp_pause_resource_kind
= 4
36 integer, parameter :: omp_allocator_handle_kind
= c_intptr_t
37 integer, parameter :: omp_alloctrait_key_kind
= c_int
38 integer, parameter :: omp_alloctrait_val_kind
= c_intptr_t
39 integer, parameter :: omp_memspace_handle_kind
= c_intptr_t
40 integer (omp_sched_kind
), parameter :: omp_sched_static
= 1
41 integer (omp_sched_kind
), parameter :: omp_sched_dynamic
= 2
42 integer (omp_sched_kind
), parameter :: omp_sched_guided
= 3
43 integer (omp_sched_kind
), parameter :: omp_sched_auto
= 4
44 integer (omp_proc_bind_kind
), &
45 parameter :: omp_proc_bind_false
= 0
46 integer (omp_proc_bind_kind
), &
47 parameter :: omp_proc_bind_true
= 1
48 integer (omp_proc_bind_kind
), &
49 parameter :: omp_proc_bind_master
= 2
50 integer (omp_proc_bind_kind
), &
51 parameter :: omp_proc_bind_close
= 3
52 integer (omp_proc_bind_kind
), &
53 parameter :: omp_proc_bind_spread
= 4
54 integer (omp_lock_hint_kind
), &
55 parameter :: omp_lock_hint_none
= 0
56 integer (omp_lock_hint_kind
), &
57 parameter :: omp_lock_hint_uncontended
= 1
58 integer (omp_lock_hint_kind
), &
59 parameter :: omp_lock_hint_contended
= 2
60 integer (omp_lock_hint_kind
), &
61 parameter :: omp_lock_hint_nonspeculative
= 4
62 integer (omp_lock_hint_kind
), &
63 parameter :: omp_lock_hint_speculative
= 8
64 integer (kind
=omp_pause_resource_kind
), &
65 parameter :: omp_pause_soft
= 1
66 integer (kind
=omp_pause_resource_kind
), &
67 parameter :: omp_pause_hard
= 2
68 integer (kind
=omp_alloctrait_key_kind
), &
69 parameter :: omp_atk_sync_hint
= 1
70 integer (kind
=omp_alloctrait_key_kind
), &
71 parameter :: omp_atk_alignment
= 2
72 integer (kind
=omp_alloctrait_key_kind
), &
73 parameter :: omp_atk_access
= 3
74 integer (kind
=omp_alloctrait_key_kind
), &
75 parameter :: omp_atk_pool_size
= 4
76 integer (kind
=omp_alloctrait_key_kind
), &
77 parameter :: omp_atk_fallback
= 5
78 integer (kind
=omp_alloctrait_key_kind
), &
79 parameter :: omp_atk_fb_data
= 6
80 integer (kind
=omp_alloctrait_key_kind
), &
81 parameter :: omp_atk_pinned
= 7
82 integer (kind
=omp_alloctrait_key_kind
), &
83 parameter :: omp_atk_partition
= 8
84 integer (kind
=omp_alloctrait_val_kind
), &
85 parameter :: omp_atv_default
= -1
86 integer (kind
=omp_alloctrait_val_kind
), &
87 parameter :: omp_atv_false
= 0
88 integer (kind
=omp_alloctrait_val_kind
), &
89 parameter :: omp_atv_true
= 1
90 integer (kind
=omp_alloctrait_val_kind
), &
91 parameter :: omp_atv_contended
= 3
92 integer (kind
=omp_alloctrait_val_kind
), &
93 parameter :: omp_atv_uncontended
= 4
94 integer (kind
=omp_alloctrait_val_kind
), &
95 parameter :: omp_atv_serialized
= 5
96 integer (kind
=omp_alloctrait_val_kind
), &
97 parameter :: omp_atv_sequential
= omp_atv_serialized
98 integer (kind
=omp_alloctrait_val_kind
), &
99 parameter :: omp_atv_private
= 6
100 integer (kind
=omp_alloctrait_val_kind
), &
101 parameter :: omp_atv_all
= 7
102 integer (kind
=omp_alloctrait_val_kind
), &
103 parameter :: omp_atv_thread
= 8
104 integer (kind
=omp_alloctrait_val_kind
), &
105 parameter :: omp_atv_pteam
= 9
106 integer (kind
=omp_alloctrait_val_kind
), &
107 parameter :: omp_atv_cgroup
= 10
108 integer (kind
=omp_alloctrait_val_kind
), &
109 parameter :: omp_atv_default_mem_fb
= 11
110 integer (kind
=omp_alloctrait_val_kind
), &
111 parameter :: omp_atv_null_fb
= 12
112 integer (kind
=omp_alloctrait_val_kind
), &
113 parameter :: omp_atv_abort_fb
= 13
114 integer (kind
=omp_alloctrait_val_kind
), &
115 parameter :: omp_atv_allocator_fb
= 14
116 integer (kind
=omp_alloctrait_val_kind
), &
117 parameter :: omp_atv_environment
= 15
118 integer (kind
=omp_alloctrait_val_kind
), &
119 parameter :: omp_atv_nearest
= 16
120 integer (kind
=omp_alloctrait_val_kind
), &
121 parameter :: omp_atv_blocked
= 17
122 integer (kind
=omp_alloctrait_val_kind
), &
123 parameter :: omp_atv_interleaved
= 18
124 integer (kind
=omp_allocator_handle_kind
), &
125 parameter :: omp_null_allocator
= 0
126 integer (kind
=omp_allocator_handle_kind
), &
127 parameter :: omp_default_mem_alloc
= 1
128 integer (kind
=omp_allocator_handle_kind
), &
129 parameter :: omp_large_cap_mem_alloc
= 2
130 integer (kind
=omp_allocator_handle_kind
), &
131 parameter :: omp_const_mem_alloc
= 3
132 integer (kind
=omp_allocator_handle_kind
), &
133 parameter :: omp_high_bw_mem_alloc
= 4
134 integer (kind
=omp_allocator_handle_kind
), &
135 parameter :: omp_low_lat_mem_alloc
= 5
136 integer (kind
=omp_allocator_handle_kind
), &
137 parameter :: omp_cgroup_mem_alloc
= 6
138 integer (kind
=omp_allocator_handle_kind
), &
139 parameter :: omp_pteam_mem_alloc
= 7
140 integer (kind
=omp_allocator_handle_kind
), &
141 parameter :: omp_thread_mem_alloc
= 8
142 integer (omp_memspace_handle_kind
), &
143 parameter :: omp_default_mem_space
= 0
144 integer (omp_memspace_handle_kind
), &
145 parameter :: omp_large_cap_mem_space
= 1
146 integer (omp_memspace_handle_kind
), &
147 parameter :: omp_const_mem_space
= 2
148 integer (omp_memspace_handle_kind
), &
149 parameter :: omp_high_bw_mem_space
= 3
150 integer (omp_memspace_handle_kind
), &
151 parameter :: omp_low_lat_mem_space
= 4
154 integer (kind
=omp_alloctrait_key_kind
) key
155 integer (kind
=omp_alloctrait_val_kind
) value
156 end type omp_alloctrait
162 integer, parameter :: openmp_version
= 201511
165 subroutine omp_init_lock (svar
)
167 integer (omp_lock_kind
), intent (out
) :: svar
168 end subroutine omp_init_lock
172 subroutine omp_init_lock_with_hint (svar
, hint
)
174 integer (omp_lock_kind
), intent (out
) :: svar
175 integer (omp_lock_hint_kind
), intent (in
) :: hint
176 end subroutine omp_init_lock_with_hint
180 subroutine omp_init_nest_lock (nvar
)
182 integer (omp_nest_lock_kind
), intent (out
) :: nvar
183 end subroutine omp_init_nest_lock
187 subroutine omp_init_nest_lock_with_hint (nvar
, hint
)
189 integer (omp_nest_lock_kind
), intent (out
) :: nvar
190 integer (omp_lock_hint_kind
), intent (in
) :: hint
191 end subroutine omp_init_nest_lock_with_hint
195 subroutine omp_destroy_lock (svar
)
197 integer (omp_lock_kind
), intent (inout
) :: svar
198 end subroutine omp_destroy_lock
202 subroutine omp_destroy_nest_lock (nvar
)
204 integer (omp_nest_lock_kind
), intent (inout
) :: nvar
205 end subroutine omp_destroy_nest_lock
209 subroutine omp_set_lock (svar
)
211 integer (omp_lock_kind
), intent (inout
) :: svar
212 end subroutine omp_set_lock
216 subroutine omp_set_nest_lock (nvar
)
218 integer (omp_nest_lock_kind
), intent (inout
) :: nvar
219 end subroutine omp_set_nest_lock
223 subroutine omp_unset_lock (svar
)
225 integer (omp_lock_kind
), intent (inout
) :: svar
226 end subroutine omp_unset_lock
230 subroutine omp_unset_nest_lock (nvar
)
232 integer (omp_nest_lock_kind
), intent (inout
) :: nvar
233 end subroutine omp_unset_nest_lock
236 interface omp_set_dynamic
237 subroutine omp_set_dynamic (dynamic_threads
)
238 logical (4), intent (in
) :: dynamic_threads
239 end subroutine omp_set_dynamic
240 subroutine omp_set_dynamic_8 (dynamic_threads
)
241 logical (8), intent (in
) :: dynamic_threads
242 end subroutine omp_set_dynamic_8
245 interface omp_set_nested
246 subroutine omp_set_nested (nested
)
247 logical (4), intent (in
) :: nested
248 end subroutine omp_set_nested
249 subroutine omp_set_nested_8 (nested
)
250 logical (8), intent (in
) :: nested
251 end subroutine omp_set_nested_8
254 interface omp_set_num_threads
255 subroutine omp_set_num_threads (num_threads
)
256 integer (4), intent (in
) :: num_threads
257 end subroutine omp_set_num_threads
258 subroutine omp_set_num_threads_8 (num_threads
)
259 integer (8), intent (in
) :: num_threads
260 end subroutine omp_set_num_threads_8
264 function omp_get_dynamic ()
265 logical (4) :: omp_get_dynamic
266 end function omp_get_dynamic
270 function omp_get_nested ()
271 logical (4) :: omp_get_nested
272 end function omp_get_nested
276 function omp_in_parallel ()
277 logical (4) :: omp_in_parallel
278 end function omp_in_parallel
282 function omp_test_lock (svar
)
284 logical (4) :: omp_test_lock
285 integer (omp_lock_kind
), intent (inout
) :: svar
286 end function omp_test_lock
290 function omp_get_max_threads ()
291 integer (4) :: omp_get_max_threads
292 end function omp_get_max_threads
296 function omp_get_num_procs ()
297 integer (4) :: omp_get_num_procs
298 end function omp_get_num_procs
302 function omp_get_num_threads ()
303 integer (4) :: omp_get_num_threads
304 end function omp_get_num_threads
308 function omp_get_thread_num ()
309 integer (4) :: omp_get_thread_num
310 end function omp_get_thread_num
314 function omp_test_nest_lock (nvar
)
316 integer (4) :: omp_test_nest_lock
317 integer (omp_nest_lock_kind
), intent (inout
) :: nvar
318 end function omp_test_nest_lock
322 function omp_get_wtick ()
323 double precision :: omp_get_wtick
324 end function omp_get_wtick
328 function omp_get_wtime ()
329 double precision :: omp_get_wtime
330 end function omp_get_wtime
333 interface omp_set_schedule
334 subroutine omp_set_schedule (kind
, chunk_size
)
336 integer (omp_sched_kind
), intent (in
) :: kind
337 integer (4), intent (in
) :: chunk_size
338 end subroutine omp_set_schedule
339 subroutine omp_set_schedule_8 (kind
, chunk_size
)
341 integer (omp_sched_kind
), intent (in
) :: kind
342 integer (8), intent (in
) :: chunk_size
343 end subroutine omp_set_schedule_8
346 interface omp_get_schedule
347 subroutine omp_get_schedule (kind
, chunk_size
)
349 integer (omp_sched_kind
), intent (out
) :: kind
350 integer (4), intent (out
) :: chunk_size
351 end subroutine omp_get_schedule
352 subroutine omp_get_schedule_8 (kind
, chunk_size
)
354 integer (omp_sched_kind
), intent (out
) :: kind
355 integer (8), intent (out
) :: chunk_size
356 end subroutine omp_get_schedule_8
360 function omp_get_thread_limit ()
361 integer (4) :: omp_get_thread_limit
362 end function omp_get_thread_limit
365 interface omp_set_max_active_levels
366 subroutine omp_set_max_active_levels (max_levels
)
367 integer (4), intent (in
) :: max_levels
368 end subroutine omp_set_max_active_levels
369 subroutine omp_set_max_active_levels_8 (max_levels
)
370 integer (8), intent (in
) :: max_levels
371 end subroutine omp_set_max_active_levels_8
375 function omp_get_max_active_levels ()
376 integer (4) :: omp_get_max_active_levels
377 end function omp_get_max_active_levels
381 function omp_get_level ()
382 integer (4) :: omp_get_level
383 end function omp_get_level
386 interface omp_get_ancestor_thread_num
387 function omp_get_ancestor_thread_num (level
)
388 integer (4), intent (in
) :: level
389 integer (4) :: omp_get_ancestor_thread_num
390 end function omp_get_ancestor_thread_num
391 function omp_get_ancestor_thread_num_8 (level
)
392 integer (8), intent (in
) :: level
393 integer (4) :: omp_get_ancestor_thread_num_8
394 end function omp_get_ancestor_thread_num_8
397 interface omp_get_team_size
398 function omp_get_team_size (level
)
399 integer (4), intent (in
) :: level
400 integer (4) :: omp_get_team_size
401 end function omp_get_team_size
402 function omp_get_team_size_8 (level
)
403 integer (8), intent (in
) :: level
404 integer (4) :: omp_get_team_size_8
405 end function omp_get_team_size_8
409 function omp_get_active_level ()
410 integer (4) :: omp_get_active_level
411 end function omp_get_active_level
415 function omp_in_final ()
416 logical (4) :: omp_in_final
417 end function omp_in_final
421 function omp_get_cancellation ()
422 logical (4) :: omp_get_cancellation
423 end function omp_get_cancellation
427 function omp_get_proc_bind ()
429 integer (omp_proc_bind_kind
) :: omp_get_proc_bind
430 end function omp_get_proc_bind
434 function omp_get_num_places ()
435 integer (4) :: omp_get_num_places
436 end function omp_get_num_places
439 interface omp_get_place_num_procs
440 function omp_get_place_num_procs (place_num
)
441 integer (4), intent(in
) :: place_num
442 integer (4) :: omp_get_place_num_procs
443 end function omp_get_place_num_procs
445 function omp_get_place_num_procs_8 (place_num
)
446 integer (8), intent(in
) :: place_num
447 integer (4) :: omp_get_place_num_procs_8
448 end function omp_get_place_num_procs_8
451 interface omp_get_place_proc_ids
452 subroutine omp_get_place_proc_ids (place_num
, ids
)
453 integer (4), intent(in
) :: place_num
454 integer (4), intent(out
) :: ids(*)
455 end subroutine omp_get_place_proc_ids
457 subroutine omp_get_place_proc_ids_8 (place_num
, ids
)
458 integer (8), intent(in
) :: place_num
459 integer (8), intent(out
) :: ids(*)
460 end subroutine omp_get_place_proc_ids_8
464 function omp_get_place_num ()
465 integer (4) :: omp_get_place_num
466 end function omp_get_place_num
470 function omp_get_partition_num_places ()
471 integer (4) :: omp_get_partition_num_places
472 end function omp_get_partition_num_places
475 interface omp_get_partition_place_nums
476 subroutine omp_get_partition_place_nums (place_nums
)
477 integer (4), intent(out
) :: place_nums(*)
478 end subroutine omp_get_partition_place_nums
480 subroutine omp_get_partition_place_nums_8 (place_nums
)
481 integer (8), intent(out
) :: place_nums(*)
482 end subroutine omp_get_partition_place_nums_8
485 interface omp_set_default_device
486 subroutine omp_set_default_device (device_num
)
487 integer (4), intent (in
) :: device_num
488 end subroutine omp_set_default_device
489 subroutine omp_set_default_device_8 (device_num
)
490 integer (8), intent (in
) :: device_num
491 end subroutine omp_set_default_device_8
495 function omp_get_default_device ()
496 integer (4) :: omp_get_default_device
497 end function omp_get_default_device
501 function omp_get_num_devices ()
502 integer (4) :: omp_get_num_devices
503 end function omp_get_num_devices
507 function omp_get_num_teams ()
508 integer (4) :: omp_get_num_teams
509 end function omp_get_num_teams
513 function omp_get_team_num ()
514 integer (4) :: omp_get_team_num
515 end function omp_get_team_num
519 function omp_is_initial_device ()
520 logical (4) :: omp_is_initial_device
521 end function omp_is_initial_device
525 function omp_get_initial_device ()
526 integer (4) :: omp_get_initial_device
527 end function omp_get_initial_device
531 function omp_get_max_task_priority ()
532 integer (4) :: omp_get_max_task_priority
533 end function omp_get_max_task_priority
537 subroutine omp_set_affinity_format (format)
538 character(len
=*), intent(in
) :: format
539 end subroutine omp_set_affinity_format
543 function omp_get_affinity_format (buffer
)
544 integer (4) :: omp_get_affinity_format
545 character(len
=*), intent(out
) :: buffer
546 end function omp_get_affinity_format
550 subroutine omp_display_affinity (format)
551 character(len
=*), intent(in
) :: format
552 end subroutine omp_display_affinity
556 function omp_capture_affinity (buffer
, format)
557 integer (4) :: omp_capture_affinity
558 character(len
=*), intent(out
) :: buffer
559 character(len
=*), intent(in
) :: format
560 end function omp_capture_affinity
564 function omp_pause_resource (kind
, device_num
)
566 integer (4) :: omp_pause_resource
567 integer (kind
=omp_pause_resource_kind
), &
569 integer (4) :: device_num
574 function omp_pause_resource_all (kind
)
576 integer (4) :: omp_pause_resource_all
577 integer (kind
=omp_pause_resource_kind
), &
582 interface omp_init_allocator
583 function omp_init_allocator (memspace
, ntraits
, traits
)
585 integer (kind
=omp_allocator_handle_kind
) omp_init_allocator
586 integer (kind
=omp_memspace_handle_kind
), &
587 intent(in
) :: memspace
588 integer (4), intent(in
) :: ntraits
589 type (omp_alloctrait
), intent(in
) :: traits(*)
591 function omp_init_allocator_8 (memspace
, ntraits
, traits
)
593 integer (kind
=omp_allocator_handle_kind
) omp_init_allocator_8
594 integer (kind
=omp_memspace_handle_kind
), &
595 intent(in
) :: memspace
596 integer (8), intent(in
) :: ntraits
597 type (omp_alloctrait
), intent(in
) :: traits(*)
602 subroutine omp_destroy_allocator (allocator
)
604 integer (kind
=omp_allocator_handle_kind
), &
605 intent(in
) :: allocator
610 subroutine omp_set_default_allocator (allocator
)
612 integer (kind
=omp_allocator_handle_kind
), &
613 intent(in
) :: allocator
618 function omp_get_default_allocator ()
620 integer (kind
=omp_allocator_handle_kind
) &
621 omp_get_default_allocator