aix: revert TLS common change
[official-gcc.git] / libgomp / omp_lib.f90.in
blob851f85f531623156d21153cb124214f75b1a54a5
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
5 ! (libgomp).
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)
10 ! any later version.
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
15 ! more details.
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 module omp_lib_kinds
27 use iso_c_binding, only: c_int, c_intptr_t
28 implicit none
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
170 type omp_alloctrait
171 integer (kind=omp_alloctrait_key_kind) key
172 integer (kind=omp_alloctrait_val_kind) value
173 end type omp_alloctrait
174 end module
176 module omp_lib
177 use omp_lib_kinds
178 implicit none
179 integer, parameter :: openmp_version = 201511
181 interface
182 subroutine omp_init_lock (svar)
183 use omp_lib_kinds
184 integer (omp_lock_kind), intent (out) :: svar
185 end subroutine omp_init_lock
186 end interface
188 interface
189 subroutine omp_init_lock_with_hint (svar, hint)
190 use omp_lib_kinds
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
194 end interface
196 interface
197 subroutine omp_init_nest_lock (nvar)
198 use omp_lib_kinds
199 integer (omp_nest_lock_kind), intent (out) :: nvar
200 end subroutine omp_init_nest_lock
201 end interface
203 interface
204 subroutine omp_init_nest_lock_with_hint (nvar, hint)
205 use omp_lib_kinds
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
209 end interface
211 interface
212 subroutine omp_destroy_lock (svar)
213 use omp_lib_kinds
214 integer (omp_lock_kind), intent (inout) :: svar
215 end subroutine omp_destroy_lock
216 end interface
218 interface
219 subroutine omp_destroy_nest_lock (nvar)
220 use omp_lib_kinds
221 integer (omp_nest_lock_kind), intent (inout) :: nvar
222 end subroutine omp_destroy_nest_lock
223 end interface
225 interface
226 subroutine omp_set_lock (svar)
227 use omp_lib_kinds
228 integer (omp_lock_kind), intent (inout) :: svar
229 end subroutine omp_set_lock
230 end interface
232 interface
233 subroutine omp_set_nest_lock (nvar)
234 use omp_lib_kinds
235 integer (omp_nest_lock_kind), intent (inout) :: nvar
236 end subroutine omp_set_nest_lock
237 end interface
239 interface
240 subroutine omp_unset_lock (svar)
241 use omp_lib_kinds
242 integer (omp_lock_kind), intent (inout) :: svar
243 end subroutine omp_unset_lock
244 end interface
246 interface
247 subroutine omp_unset_nest_lock (nvar)
248 use omp_lib_kinds
249 integer (omp_nest_lock_kind), intent (inout) :: nvar
250 end subroutine omp_unset_nest_lock
251 end interface
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
260 end interface
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
269 end interface
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
278 end interface
280 interface
281 function omp_get_dynamic ()
282 logical (4) :: omp_get_dynamic
283 end function omp_get_dynamic
284 end interface
286 interface
287 function omp_get_nested ()
288 logical (4) :: omp_get_nested
289 end function omp_get_nested
290 end interface
292 interface
293 function omp_in_parallel ()
294 logical (4) :: omp_in_parallel
295 end function omp_in_parallel
296 end interface
298 interface
299 function omp_test_lock (svar)
300 use omp_lib_kinds
301 logical (4) :: omp_test_lock
302 integer (omp_lock_kind), intent (inout) :: svar
303 end function omp_test_lock
304 end interface
306 interface
307 function omp_get_max_threads ()
308 integer (4) :: omp_get_max_threads
309 end function omp_get_max_threads
310 end interface
312 interface
313 function omp_get_num_procs ()
314 integer (4) :: omp_get_num_procs
315 end function omp_get_num_procs
316 end interface
318 interface
319 function omp_get_num_threads ()
320 integer (4) :: omp_get_num_threads
321 end function omp_get_num_threads
322 end interface
324 interface
325 function omp_get_thread_num ()
326 integer (4) :: omp_get_thread_num
327 end function omp_get_thread_num
328 end interface
330 interface
331 function omp_test_nest_lock (nvar)
332 use omp_lib_kinds
333 integer (4) :: omp_test_nest_lock
334 integer (omp_nest_lock_kind), intent (inout) :: nvar
335 end function omp_test_nest_lock
336 end interface
338 interface
339 function omp_get_wtick ()
340 double precision :: omp_get_wtick
341 end function omp_get_wtick
342 end interface
344 interface
345 function omp_get_wtime ()
346 double precision :: omp_get_wtime
347 end function omp_get_wtime
348 end interface
350 interface omp_set_schedule
351 subroutine omp_set_schedule (kind, chunk_size)
352 use omp_lib_kinds
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)
357 use omp_lib_kinds
358 integer (omp_sched_kind), intent (in) :: kind
359 integer (8), intent (in) :: chunk_size
360 end subroutine omp_set_schedule_8
361 end interface
363 interface omp_get_schedule
364 subroutine omp_get_schedule (kind, chunk_size)
365 use omp_lib_kinds
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)
370 use omp_lib_kinds
371 integer (omp_sched_kind), intent (out) :: kind
372 integer (8), intent (out) :: chunk_size
373 end subroutine omp_get_schedule_8
374 end interface
376 interface
377 function omp_get_thread_limit ()
378 integer (4) :: omp_get_thread_limit
379 end function omp_get_thread_limit
380 end interface
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
389 end interface
391 interface
392 function omp_get_max_active_levels ()
393 integer (4) :: omp_get_max_active_levels
394 end function omp_get_max_active_levels
395 end interface
397 interface
398 function omp_get_supported_active_levels ()
399 integer (4) :: omp_get_supported_active_levels
400 end function omp_get_supported_active_levels
401 end interface
403 interface
404 function omp_get_level ()
405 integer (4) :: omp_get_level
406 end function omp_get_level
407 end interface
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
418 end interface
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
429 end interface
431 interface
432 function omp_get_active_level ()
433 integer (4) :: omp_get_active_level
434 end function omp_get_active_level
435 end interface
437 interface
438 function omp_in_final ()
439 logical (4) :: omp_in_final
440 end function omp_in_final
441 end interface
443 interface
444 function omp_get_cancellation ()
445 logical (4) :: omp_get_cancellation
446 end function omp_get_cancellation
447 end interface
449 interface
450 function omp_get_proc_bind ()
451 use omp_lib_kinds
452 integer (omp_proc_bind_kind) :: omp_get_proc_bind
453 end function omp_get_proc_bind
454 end interface
456 interface
457 function omp_get_num_places ()
458 integer (4) :: omp_get_num_places
459 end function omp_get_num_places
460 end interface
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
472 end interface
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
484 end interface
486 interface
487 function omp_get_place_num ()
488 integer (4) :: omp_get_place_num
489 end function omp_get_place_num
490 end interface
492 interface
493 function omp_get_partition_num_places ()
494 integer (4) :: omp_get_partition_num_places
495 end function omp_get_partition_num_places
496 end interface
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
506 end interface
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
515 end interface
517 interface
518 function omp_get_default_device ()
519 integer (4) :: omp_get_default_device
520 end function omp_get_default_device
521 end interface
523 interface
524 function omp_get_num_devices ()
525 integer (4) :: omp_get_num_devices
526 end function omp_get_num_devices
527 end interface
529 interface
530 function omp_get_num_teams ()
531 integer (4) :: omp_get_num_teams
532 end function omp_get_num_teams
533 end interface
535 interface
536 function omp_get_team_num ()
537 integer (4) :: omp_get_team_num
538 end function omp_get_team_num
539 end interface
541 interface
542 function omp_is_initial_device ()
543 logical (4) :: omp_is_initial_device
544 end function omp_is_initial_device
545 end interface
547 interface
548 function omp_get_initial_device ()
549 integer (4) :: omp_get_initial_device
550 end function omp_get_initial_device
551 end interface
553 interface
554 function omp_get_max_task_priority ()
555 integer (4) :: omp_get_max_task_priority
556 end function omp_get_max_task_priority
557 end interface
559 interface
560 subroutine omp_fulfill_event (event)
561 use omp_lib_kinds
562 integer (kind=omp_event_handle_kind), &
563 value, intent(in) :: event
564 end subroutine omp_fulfill_event
565 end interface
567 interface
568 subroutine omp_set_affinity_format (format)
569 character(len=*), intent(in) :: format
570 end subroutine omp_set_affinity_format
571 end interface
573 interface
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
578 end interface
580 interface
581 subroutine omp_display_affinity (format)
582 character(len=*), intent(in) :: format
583 end subroutine omp_display_affinity
584 end interface
586 interface
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
592 end interface
594 interface
595 function omp_pause_resource (kind, device_num)
596 use omp_lib_kinds
597 integer (4) :: omp_pause_resource
598 integer (kind=omp_pause_resource_kind), &
599 intent(in) :: kind
600 integer (4) :: device_num
601 end function
602 end interface
604 interface
605 function omp_pause_resource_all (kind)
606 use omp_lib_kinds
607 integer (4) :: omp_pause_resource_all
608 integer (kind=omp_pause_resource_kind), &
609 intent(in) :: kind
610 end function
611 end interface
613 interface omp_init_allocator
614 function omp_init_allocator (memspace, ntraits, traits)
615 use omp_lib_kinds
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(*)
621 end function
622 function omp_init_allocator_8 (memspace, ntraits, traits)
623 use omp_lib_kinds
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(*)
629 end function
630 end interface
632 interface
633 subroutine omp_destroy_allocator (allocator)
634 use omp_lib_kinds
635 integer (kind=omp_allocator_handle_kind), &
636 intent(in) :: allocator
637 end subroutine
638 end interface
640 interface
641 subroutine omp_set_default_allocator (allocator)
642 use omp_lib_kinds
643 integer (kind=omp_allocator_handle_kind), &
644 intent(in) :: allocator
645 end subroutine
646 end interface
648 interface
649 function omp_get_default_allocator ()
650 use omp_lib_kinds
651 integer (kind=omp_allocator_handle_kind) &
652 omp_get_default_allocator
653 end function
654 end interface
656 #if _OPENMP >= 201811
657 !GCC$ ATTRIBUTES DEPRECATED :: omp_get_nested, omp_set_nested
658 #endif
660 end module omp_lib