1 /* Copyright (C) 2005-2015 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 /* This file contains Fortran wrapper routines. */
29 #include "libgomp_f.h"
33 #ifdef HAVE_ATTRIBUTE_ALIAS
34 /* Use internal aliases if possible. */
35 # ifndef LIBGOMP_GNU_SYMBOL_VERSIONING
36 ialias_redirect (omp_init_lock
)
37 ialias_redirect (omp_init_nest_lock
)
38 ialias_redirect (omp_destroy_lock
)
39 ialias_redirect (omp_destroy_nest_lock
)
40 ialias_redirect (omp_set_lock
)
41 ialias_redirect (omp_set_nest_lock
)
42 ialias_redirect (omp_unset_lock
)
43 ialias_redirect (omp_unset_nest_lock
)
44 ialias_redirect (omp_test_lock
)
45 ialias_redirect (omp_test_nest_lock
)
47 ialias_redirect (omp_set_dynamic
)
48 ialias_redirect (omp_set_nested
)
49 ialias_redirect (omp_set_num_threads
)
50 ialias_redirect (omp_get_dynamic
)
51 ialias_redirect (omp_get_nested
)
52 ialias_redirect (omp_in_parallel
)
53 ialias_redirect (omp_get_max_threads
)
54 ialias_redirect (omp_get_num_procs
)
55 ialias_redirect (omp_get_num_threads
)
56 ialias_redirect (omp_get_thread_num
)
57 ialias_redirect (omp_get_wtick
)
58 ialias_redirect (omp_get_wtime
)
59 ialias_redirect (omp_set_schedule
)
60 ialias_redirect (omp_get_schedule
)
61 ialias_redirect (omp_get_thread_limit
)
62 ialias_redirect (omp_set_max_active_levels
)
63 ialias_redirect (omp_get_max_active_levels
)
64 ialias_redirect (omp_get_level
)
65 ialias_redirect (omp_get_ancestor_thread_num
)
66 ialias_redirect (omp_get_team_size
)
67 ialias_redirect (omp_get_active_level
)
68 ialias_redirect (omp_in_final
)
69 ialias_redirect (omp_get_cancellation
)
70 ialias_redirect (omp_get_proc_bind
)
71 ialias_redirect (omp_set_default_device
)
72 ialias_redirect (omp_get_default_device
)
73 ialias_redirect (omp_get_num_devices
)
74 ialias_redirect (omp_get_num_teams
)
75 ialias_redirect (omp_get_team_num
)
76 ialias_redirect (omp_is_initial_device
)
79 #ifndef LIBGOMP_GNU_SYMBOL_VERSIONING
80 # define gomp_init_lock__30 omp_init_lock_
81 # define gomp_destroy_lock__30 omp_destroy_lock_
82 # define gomp_set_lock__30 omp_set_lock_
83 # define gomp_unset_lock__30 omp_unset_lock_
84 # define gomp_test_lock__30 omp_test_lock_
85 # define gomp_init_nest_lock__30 omp_init_nest_lock_
86 # define gomp_destroy_nest_lock__30 omp_destroy_nest_lock_
87 # define gomp_set_nest_lock__30 omp_set_nest_lock_
88 # define gomp_unset_nest_lock__30 omp_unset_nest_lock_
89 # define gomp_test_nest_lock__30 omp_test_nest_lock_
93 gomp_init_lock__30 (omp_lock_arg_t lock
)
95 #ifndef OMP_LOCK_DIRECT
96 omp_lock_arg (lock
) = malloc (sizeof (omp_lock_t
));
98 gomp_init_lock_30 (omp_lock_arg (lock
));
102 gomp_init_nest_lock__30 (omp_nest_lock_arg_t lock
)
104 #ifndef OMP_NEST_LOCK_DIRECT
105 omp_nest_lock_arg (lock
) = malloc (sizeof (omp_nest_lock_t
));
107 gomp_init_nest_lock_30 (omp_nest_lock_arg (lock
));
111 gomp_destroy_lock__30 (omp_lock_arg_t lock
)
113 gomp_destroy_lock_30 (omp_lock_arg (lock
));
114 #ifndef OMP_LOCK_DIRECT
115 free (omp_lock_arg (lock
));
116 omp_lock_arg (lock
) = NULL
;
121 gomp_destroy_nest_lock__30 (omp_nest_lock_arg_t lock
)
123 gomp_destroy_nest_lock_30 (omp_nest_lock_arg (lock
));
124 #ifndef OMP_NEST_LOCK_DIRECT
125 free (omp_nest_lock_arg (lock
));
126 omp_nest_lock_arg (lock
) = NULL
;
131 gomp_set_lock__30 (omp_lock_arg_t lock
)
133 gomp_set_lock_30 (omp_lock_arg (lock
));
137 gomp_set_nest_lock__30 (omp_nest_lock_arg_t lock
)
139 gomp_set_nest_lock_30 (omp_nest_lock_arg (lock
));
143 gomp_unset_lock__30 (omp_lock_arg_t lock
)
145 gomp_unset_lock_30 (omp_lock_arg (lock
));
149 gomp_unset_nest_lock__30 (omp_nest_lock_arg_t lock
)
151 gomp_unset_nest_lock_30 (omp_nest_lock_arg (lock
));
155 gomp_test_lock__30 (omp_lock_arg_t lock
)
157 return gomp_test_lock_30 (omp_lock_arg (lock
));
161 gomp_test_nest_lock__30 (omp_nest_lock_arg_t lock
)
163 return gomp_test_nest_lock_30 (omp_nest_lock_arg (lock
));
166 #ifdef LIBGOMP_GNU_SYMBOL_VERSIONING
168 gomp_init_lock__25 (omp_lock_25_arg_t lock
)
170 #ifndef OMP_LOCK_25_DIRECT
171 omp_lock_25_arg (lock
) = malloc (sizeof (omp_lock_25_t
));
173 gomp_init_lock_25 (omp_lock_25_arg (lock
));
177 gomp_init_nest_lock__25 (omp_nest_lock_25_arg_t lock
)
179 #ifndef OMP_NEST_LOCK_25_DIRECT
180 omp_nest_lock_25_arg (lock
) = malloc (sizeof (omp_nest_lock_25_t
));
182 gomp_init_nest_lock_25 (omp_nest_lock_25_arg (lock
));
186 gomp_destroy_lock__25 (omp_lock_25_arg_t lock
)
188 gomp_destroy_lock_25 (omp_lock_25_arg (lock
));
189 #ifndef OMP_LOCK_25_DIRECT
190 free (omp_lock_25_arg (lock
));
191 omp_lock_25_arg (lock
) = NULL
;
196 gomp_destroy_nest_lock__25 (omp_nest_lock_25_arg_t lock
)
198 gomp_destroy_nest_lock_25 (omp_nest_lock_25_arg (lock
));
199 #ifndef OMP_NEST_LOCK_25_DIRECT
200 free (omp_nest_lock_25_arg (lock
));
201 omp_nest_lock_25_arg (lock
) = NULL
;
206 gomp_set_lock__25 (omp_lock_25_arg_t lock
)
208 gomp_set_lock_25 (omp_lock_25_arg (lock
));
212 gomp_set_nest_lock__25 (omp_nest_lock_25_arg_t lock
)
214 gomp_set_nest_lock_25 (omp_nest_lock_25_arg (lock
));
218 gomp_unset_lock__25 (omp_lock_25_arg_t lock
)
220 gomp_unset_lock_25 (omp_lock_25_arg (lock
));
224 gomp_unset_nest_lock__25 (omp_nest_lock_25_arg_t lock
)
226 gomp_unset_nest_lock_25 (omp_nest_lock_25_arg (lock
));
230 gomp_test_lock__25 (omp_lock_25_arg_t lock
)
232 return gomp_test_lock_25 (omp_lock_25_arg (lock
));
236 gomp_test_nest_lock__25 (omp_nest_lock_25_arg_t lock
)
238 return gomp_test_nest_lock_25 (omp_nest_lock_25_arg (lock
));
241 omp_lock_symver (omp_init_lock_
)
242 omp_lock_symver (omp_destroy_lock_
)
243 omp_lock_symver (omp_set_lock_
)
244 omp_lock_symver (omp_unset_lock_
)
245 omp_lock_symver (omp_test_lock_
)
246 omp_lock_symver (omp_init_nest_lock_
)
247 omp_lock_symver (omp_destroy_nest_lock_
)
248 omp_lock_symver (omp_set_nest_lock_
)
249 omp_lock_symver (omp_unset_nest_lock_
)
250 omp_lock_symver (omp_test_nest_lock_
)
253 #define TO_INT(x) ((x) > INT_MIN ? (x) < INT_MAX ? (x) : INT_MAX : INT_MIN)
256 omp_set_dynamic_ (const int32_t *set
)
258 omp_set_dynamic (*set
);
262 omp_set_dynamic_8_ (const int64_t *set
)
264 omp_set_dynamic (!!*set
);
268 omp_set_nested_ (const int32_t *set
)
270 omp_set_nested (*set
);
274 omp_set_nested_8_ (const int64_t *set
)
276 omp_set_nested (!!*set
);
280 omp_set_num_threads_ (const int32_t *set
)
282 omp_set_num_threads (*set
);
286 omp_set_num_threads_8_ (const int64_t *set
)
288 omp_set_num_threads (TO_INT (*set
));
292 omp_get_dynamic_ (void)
294 return omp_get_dynamic ();
298 omp_get_nested_ (void)
300 return omp_get_nested ();
304 omp_in_parallel_ (void)
306 return omp_in_parallel ();
310 omp_get_max_threads_ (void)
312 return omp_get_max_threads ();
316 omp_get_num_procs_ (void)
318 return omp_get_num_procs ();
322 omp_get_num_threads_ (void)
324 return omp_get_num_threads ();
328 omp_get_thread_num_ (void)
330 return omp_get_thread_num ();
334 omp_get_wtick_ (void)
336 return omp_get_wtick ();
340 omp_get_wtime_ (void)
342 return omp_get_wtime ();
346 omp_set_schedule_ (const int32_t *kind
, const int32_t *modifier
)
348 omp_set_schedule (*kind
, *modifier
);
352 omp_set_schedule_8_ (const int32_t *kind
, const int64_t *modifier
)
354 omp_set_schedule (*kind
, TO_INT (*modifier
));
358 omp_get_schedule_ (int32_t *kind
, int32_t *modifier
)
362 omp_get_schedule (&k
, &m
);
368 omp_get_schedule_8_ (int32_t *kind
, int64_t *modifier
)
372 omp_get_schedule (&k
, &m
);
378 omp_get_thread_limit_ (void)
380 return omp_get_thread_limit ();
384 omp_set_max_active_levels_ (const int32_t *levels
)
386 omp_set_max_active_levels (*levels
);
390 omp_set_max_active_levels_8_ (const int64_t *levels
)
392 omp_set_max_active_levels (TO_INT (*levels
));
396 omp_get_max_active_levels_ (void)
398 return omp_get_max_active_levels ();
402 omp_get_level_ (void)
404 return omp_get_level ();
408 omp_get_ancestor_thread_num_ (const int32_t *level
)
410 return omp_get_ancestor_thread_num (*level
);
414 omp_get_ancestor_thread_num_8_ (const int64_t *level
)
416 return omp_get_ancestor_thread_num (TO_INT (*level
));
420 omp_get_team_size_ (const int32_t *level
)
422 return omp_get_team_size (*level
);
426 omp_get_team_size_8_ (const int64_t *level
)
428 return omp_get_team_size (TO_INT (*level
));
432 omp_get_active_level_ (void)
434 return omp_get_active_level ();
440 return omp_in_final ();
444 omp_get_cancellation_ (void)
446 return omp_get_cancellation ();
450 omp_get_proc_bind_ (void)
452 return omp_get_proc_bind ();
456 omp_set_default_device_ (const int32_t *device_num
)
458 return omp_set_default_device (*device_num
);
462 omp_set_default_device_8_ (const int64_t *device_num
)
464 return omp_set_default_device (TO_INT (*device_num
));
468 omp_get_default_device_ (void)
470 return omp_get_default_device ();
474 omp_get_num_devices_ (void)
476 return omp_get_num_devices ();
480 omp_get_num_teams_ (void)
482 return omp_get_num_teams ();
486 omp_get_team_num_ (void)
488 return omp_get_team_num ();
492 omp_is_initial_device_ (void)
494 return omp_is_initial_device ();