123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496 |
- /* Copyright (C) 2005-2015 Free Software Foundation, Inc.
- Contributed by Jakub Jelinek <jakub@redhat.com>.
- This file is part of the GNU Offloading and Multi Processing Library
- (libgomp).
- Libgomp is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
- Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
- Under Section 7 of GPL version 3, you are granted additional
- permissions described in the GCC Runtime Library Exception, version
- 3.1, as published by the Free Software Foundation.
- You should have received a copy of the GNU General Public License and
- a copy of the GCC Runtime Library Exception along with this program;
- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
- <http://www.gnu.org/licenses/>. */
- /* This file contains Fortran wrapper routines. */
- #include "libgomp.h"
- #include "libgomp_f.h"
- #include <stdlib.h>
- #include <limits.h>
- #ifdef HAVE_ATTRIBUTE_ALIAS
- /* Use internal aliases if possible. */
- # ifndef LIBGOMP_GNU_SYMBOL_VERSIONING
- ialias_redirect (omp_init_lock)
- ialias_redirect (omp_init_nest_lock)
- ialias_redirect (omp_destroy_lock)
- ialias_redirect (omp_destroy_nest_lock)
- ialias_redirect (omp_set_lock)
- ialias_redirect (omp_set_nest_lock)
- ialias_redirect (omp_unset_lock)
- ialias_redirect (omp_unset_nest_lock)
- ialias_redirect (omp_test_lock)
- ialias_redirect (omp_test_nest_lock)
- # endif
- ialias_redirect (omp_set_dynamic)
- ialias_redirect (omp_set_nested)
- ialias_redirect (omp_set_num_threads)
- ialias_redirect (omp_get_dynamic)
- ialias_redirect (omp_get_nested)
- ialias_redirect (omp_in_parallel)
- ialias_redirect (omp_get_max_threads)
- ialias_redirect (omp_get_num_procs)
- ialias_redirect (omp_get_num_threads)
- ialias_redirect (omp_get_thread_num)
- ialias_redirect (omp_get_wtick)
- ialias_redirect (omp_get_wtime)
- ialias_redirect (omp_set_schedule)
- ialias_redirect (omp_get_schedule)
- ialias_redirect (omp_get_thread_limit)
- ialias_redirect (omp_set_max_active_levels)
- ialias_redirect (omp_get_max_active_levels)
- ialias_redirect (omp_get_level)
- ialias_redirect (omp_get_ancestor_thread_num)
- ialias_redirect (omp_get_team_size)
- ialias_redirect (omp_get_active_level)
- ialias_redirect (omp_in_final)
- ialias_redirect (omp_get_cancellation)
- ialias_redirect (omp_get_proc_bind)
- ialias_redirect (omp_set_default_device)
- ialias_redirect (omp_get_default_device)
- ialias_redirect (omp_get_num_devices)
- ialias_redirect (omp_get_num_teams)
- ialias_redirect (omp_get_team_num)
- ialias_redirect (omp_is_initial_device)
- #endif
- #ifndef LIBGOMP_GNU_SYMBOL_VERSIONING
- # define gomp_init_lock__30 omp_init_lock_
- # define gomp_destroy_lock__30 omp_destroy_lock_
- # define gomp_set_lock__30 omp_set_lock_
- # define gomp_unset_lock__30 omp_unset_lock_
- # define gomp_test_lock__30 omp_test_lock_
- # define gomp_init_nest_lock__30 omp_init_nest_lock_
- # define gomp_destroy_nest_lock__30 omp_destroy_nest_lock_
- # define gomp_set_nest_lock__30 omp_set_nest_lock_
- # define gomp_unset_nest_lock__30 omp_unset_nest_lock_
- # define gomp_test_nest_lock__30 omp_test_nest_lock_
- #endif
- void
- gomp_init_lock__30 (omp_lock_arg_t lock)
- {
- #ifndef OMP_LOCK_DIRECT
- omp_lock_arg (lock) = malloc (sizeof (omp_lock_t));
- #endif
- gomp_init_lock_30 (omp_lock_arg (lock));
- }
- void
- gomp_init_nest_lock__30 (omp_nest_lock_arg_t lock)
- {
- #ifndef OMP_NEST_LOCK_DIRECT
- omp_nest_lock_arg (lock) = malloc (sizeof (omp_nest_lock_t));
- #endif
- gomp_init_nest_lock_30 (omp_nest_lock_arg (lock));
- }
- void
- gomp_destroy_lock__30 (omp_lock_arg_t lock)
- {
- gomp_destroy_lock_30 (omp_lock_arg (lock));
- #ifndef OMP_LOCK_DIRECT
- free (omp_lock_arg (lock));
- omp_lock_arg (lock) = NULL;
- #endif
- }
- void
- gomp_destroy_nest_lock__30 (omp_nest_lock_arg_t lock)
- {
- gomp_destroy_nest_lock_30 (omp_nest_lock_arg (lock));
- #ifndef OMP_NEST_LOCK_DIRECT
- free (omp_nest_lock_arg (lock));
- omp_nest_lock_arg (lock) = NULL;
- #endif
- }
- void
- gomp_set_lock__30 (omp_lock_arg_t lock)
- {
- gomp_set_lock_30 (omp_lock_arg (lock));
- }
- void
- gomp_set_nest_lock__30 (omp_nest_lock_arg_t lock)
- {
- gomp_set_nest_lock_30 (omp_nest_lock_arg (lock));
- }
- void
- gomp_unset_lock__30 (omp_lock_arg_t lock)
- {
- gomp_unset_lock_30 (omp_lock_arg (lock));
- }
- void
- gomp_unset_nest_lock__30 (omp_nest_lock_arg_t lock)
- {
- gomp_unset_nest_lock_30 (omp_nest_lock_arg (lock));
- }
- int32_t
- gomp_test_lock__30 (omp_lock_arg_t lock)
- {
- return gomp_test_lock_30 (omp_lock_arg (lock));
- }
- int32_t
- gomp_test_nest_lock__30 (omp_nest_lock_arg_t lock)
- {
- return gomp_test_nest_lock_30 (omp_nest_lock_arg (lock));
- }
- #ifdef LIBGOMP_GNU_SYMBOL_VERSIONING
- void
- gomp_init_lock__25 (omp_lock_25_arg_t lock)
- {
- #ifndef OMP_LOCK_25_DIRECT
- omp_lock_25_arg (lock) = malloc (sizeof (omp_lock_25_t));
- #endif
- gomp_init_lock_25 (omp_lock_25_arg (lock));
- }
- void
- gomp_init_nest_lock__25 (omp_nest_lock_25_arg_t lock)
- {
- #ifndef OMP_NEST_LOCK_25_DIRECT
- omp_nest_lock_25_arg (lock) = malloc (sizeof (omp_nest_lock_25_t));
- #endif
- gomp_init_nest_lock_25 (omp_nest_lock_25_arg (lock));
- }
- void
- gomp_destroy_lock__25 (omp_lock_25_arg_t lock)
- {
- gomp_destroy_lock_25 (omp_lock_25_arg (lock));
- #ifndef OMP_LOCK_25_DIRECT
- free (omp_lock_25_arg (lock));
- omp_lock_25_arg (lock) = NULL;
- #endif
- }
- void
- gomp_destroy_nest_lock__25 (omp_nest_lock_25_arg_t lock)
- {
- gomp_destroy_nest_lock_25 (omp_nest_lock_25_arg (lock));
- #ifndef OMP_NEST_LOCK_25_DIRECT
- free (omp_nest_lock_25_arg (lock));
- omp_nest_lock_25_arg (lock) = NULL;
- #endif
- }
- void
- gomp_set_lock__25 (omp_lock_25_arg_t lock)
- {
- gomp_set_lock_25 (omp_lock_25_arg (lock));
- }
- void
- gomp_set_nest_lock__25 (omp_nest_lock_25_arg_t lock)
- {
- gomp_set_nest_lock_25 (omp_nest_lock_25_arg (lock));
- }
- void
- gomp_unset_lock__25 (omp_lock_25_arg_t lock)
- {
- gomp_unset_lock_25 (omp_lock_25_arg (lock));
- }
- void
- gomp_unset_nest_lock__25 (omp_nest_lock_25_arg_t lock)
- {
- gomp_unset_nest_lock_25 (omp_nest_lock_25_arg (lock));
- }
- int32_t
- gomp_test_lock__25 (omp_lock_25_arg_t lock)
- {
- return gomp_test_lock_25 (omp_lock_25_arg (lock));
- }
- int32_t
- gomp_test_nest_lock__25 (omp_nest_lock_25_arg_t lock)
- {
- return gomp_test_nest_lock_25 (omp_nest_lock_25_arg (lock));
- }
- omp_lock_symver (omp_init_lock_)
- omp_lock_symver (omp_destroy_lock_)
- omp_lock_symver (omp_set_lock_)
- omp_lock_symver (omp_unset_lock_)
- omp_lock_symver (omp_test_lock_)
- omp_lock_symver (omp_init_nest_lock_)
- omp_lock_symver (omp_destroy_nest_lock_)
- omp_lock_symver (omp_set_nest_lock_)
- omp_lock_symver (omp_unset_nest_lock_)
- omp_lock_symver (omp_test_nest_lock_)
- #endif
- #define TO_INT(x) ((x) > INT_MIN ? (x) < INT_MAX ? (x) : INT_MAX : INT_MIN)
- void
- omp_set_dynamic_ (const int32_t *set)
- {
- omp_set_dynamic (*set);
- }
- void
- omp_set_dynamic_8_ (const int64_t *set)
- {
- omp_set_dynamic (!!*set);
- }
- void
- omp_set_nested_ (const int32_t *set)
- {
- omp_set_nested (*set);
- }
- void
- omp_set_nested_8_ (const int64_t *set)
- {
- omp_set_nested (!!*set);
- }
- void
- omp_set_num_threads_ (const int32_t *set)
- {
- omp_set_num_threads (*set);
- }
- void
- omp_set_num_threads_8_ (const int64_t *set)
- {
- omp_set_num_threads (TO_INT (*set));
- }
- int32_t
- omp_get_dynamic_ (void)
- {
- return omp_get_dynamic ();
- }
- int32_t
- omp_get_nested_ (void)
- {
- return omp_get_nested ();
- }
- int32_t
- omp_in_parallel_ (void)
- {
- return omp_in_parallel ();
- }
- int32_t
- omp_get_max_threads_ (void)
- {
- return omp_get_max_threads ();
- }
- int32_t
- omp_get_num_procs_ (void)
- {
- return omp_get_num_procs ();
- }
- int32_t
- omp_get_num_threads_ (void)
- {
- return omp_get_num_threads ();
- }
- int32_t
- omp_get_thread_num_ (void)
- {
- return omp_get_thread_num ();
- }
- double
- omp_get_wtick_ (void)
- {
- return omp_get_wtick ();
- }
- double
- omp_get_wtime_ (void)
- {
- return omp_get_wtime ();
- }
- void
- omp_set_schedule_ (const int32_t *kind, const int32_t *modifier)
- {
- omp_set_schedule (*kind, *modifier);
- }
- void
- omp_set_schedule_8_ (const int32_t *kind, const int64_t *modifier)
- {
- omp_set_schedule (*kind, TO_INT (*modifier));
- }
- void
- omp_get_schedule_ (int32_t *kind, int32_t *modifier)
- {
- omp_sched_t k;
- int m;
- omp_get_schedule (&k, &m);
- *kind = k;
- *modifier = m;
- }
- void
- omp_get_schedule_8_ (int32_t *kind, int64_t *modifier)
- {
- omp_sched_t k;
- int m;
- omp_get_schedule (&k, &m);
- *kind = k;
- *modifier = m;
- }
- int32_t
- omp_get_thread_limit_ (void)
- {
- return omp_get_thread_limit ();
- }
- void
- omp_set_max_active_levels_ (const int32_t *levels)
- {
- omp_set_max_active_levels (*levels);
- }
- void
- omp_set_max_active_levels_8_ (const int64_t *levels)
- {
- omp_set_max_active_levels (TO_INT (*levels));
- }
- int32_t
- omp_get_max_active_levels_ (void)
- {
- return omp_get_max_active_levels ();
- }
- int32_t
- omp_get_level_ (void)
- {
- return omp_get_level ();
- }
- int32_t
- omp_get_ancestor_thread_num_ (const int32_t *level)
- {
- return omp_get_ancestor_thread_num (*level);
- }
- int32_t
- omp_get_ancestor_thread_num_8_ (const int64_t *level)
- {
- return omp_get_ancestor_thread_num (TO_INT (*level));
- }
- int32_t
- omp_get_team_size_ (const int32_t *level)
- {
- return omp_get_team_size (*level);
- }
- int32_t
- omp_get_team_size_8_ (const int64_t *level)
- {
- return omp_get_team_size (TO_INT (*level));
- }
- int32_t
- omp_get_active_level_ (void)
- {
- return omp_get_active_level ();
- }
- int32_t
- omp_in_final_ (void)
- {
- return omp_in_final ();
- }
- int32_t
- omp_get_cancellation_ (void)
- {
- return omp_get_cancellation ();
- }
- int32_t
- omp_get_proc_bind_ (void)
- {
- return omp_get_proc_bind ();
- }
- void
- omp_set_default_device_ (const int32_t *device_num)
- {
- return omp_set_default_device (*device_num);
- }
- void
- omp_set_default_device_8_ (const int64_t *device_num)
- {
- return omp_set_default_device (TO_INT (*device_num));
- }
- int32_t
- omp_get_default_device_ (void)
- {
- return omp_get_default_device ();
- }
- int32_t
- omp_get_num_devices_ (void)
- {
- return omp_get_num_devices ();
- }
- int32_t
- omp_get_num_teams_ (void)
- {
- return omp_get_num_teams ();
- }
- int32_t
- omp_get_team_num_ (void)
- {
- return omp_get_team_num ();
- }
- int32_t
- omp_is_initial_device_ (void)
- {
- return omp_is_initial_device ();
- }
|