1 /* Copyright (C) 2005 Free Software Foundation, Inc. 2 Contributed by Jakub Jelinek <jakub@redhat.com>. 3 4 This file is part of the GNU OpenMP Library (libgomp). 5 6 Libgomp is free software; you can redistribute it and/or modify it 7 under the terms of the GNU Lesser General Public License as published by 8 the Free Software Foundation; either version 2.1 of the License, or 9 (at your option) any later version. 10 11 Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY 12 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 13 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 14 more details. 15 16 You should have received a copy of the GNU Lesser General Public License 17 along with libgomp; see the file COPYING.LIB. If not, write to the 18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 MA 02110-1301, USA. */ 20 21 /* As a special exception, if you link this library with other files, some 22 of which are compiled with GCC, to produce an executable, this library 23 does not by itself cause the resulting executable to be covered by the 24 GNU General Public License. This exception does not however invalidate 25 any other reasons why the executable file might be covered by the GNU 26 General Public License. */ 27 28 /* This file contains Fortran wrapper routines. */ 29 30 #include "libgomp.h" 31 #include "libgomp_f.h" 32 #include <stdlib.h> 33 34 #ifdef HAVE_ATTRIBUTE_ALIAS 35 /* Use internal aliases if possible. */ 36 #define ULP STR1(__USER_LABEL_PREFIX__) 37 #define STR1(x) STR2(x) 38 #define STR2(x) #x 39 # define ialias_redirect(fn) \ 40 extern __typeof (fn) fn __asm__ (ULP "gomp_ialias_" #fn) attribute_hidden; 41 ialias_redirect (omp_init_lock) 42 ialias_redirect (omp_init_nest_lock) 43 ialias_redirect (omp_destroy_lock) 44 ialias_redirect (omp_destroy_nest_lock) 45 ialias_redirect (omp_set_lock) 46 ialias_redirect (omp_set_nest_lock) 47 ialias_redirect (omp_unset_lock) 48 ialias_redirect (omp_unset_nest_lock) 49 ialias_redirect (omp_test_lock) 50 ialias_redirect (omp_test_nest_lock) 51 ialias_redirect (omp_set_dynamic) 52 ialias_redirect (omp_set_nested) 53 ialias_redirect (omp_set_num_threads) 54 ialias_redirect (omp_get_dynamic) 55 ialias_redirect (omp_get_nested) 56 ialias_redirect (omp_in_parallel) 57 ialias_redirect (omp_get_max_threads) 58 ialias_redirect (omp_get_num_procs) 59 ialias_redirect (omp_get_num_threads) 60 ialias_redirect (omp_get_thread_num) 61 ialias_redirect (omp_get_wtick) 62 ialias_redirect (omp_get_wtime) 63 #endif 64 65 void 66 omp_init_lock_ (omp_lock_arg_t lock) 67 { 68 #ifndef OMP_LOCK_DIRECT 69 omp_lock_arg (lock) = malloc (sizeof (omp_lock_t)); 70 #endif 71 omp_init_lock (omp_lock_arg (lock)); 72 } 73 74 void 75 omp_init_nest_lock_ (omp_nest_lock_arg_t lock) 76 { 77 #ifndef OMP_NEST_LOCK_DIRECT 78 omp_nest_lock_arg (lock) = malloc (sizeof (omp_nest_lock_t)); 79 #endif 80 omp_init_nest_lock (omp_nest_lock_arg (lock)); 81 } 82 83 void 84 omp_destroy_lock_ (omp_lock_arg_t lock) 85 { 86 omp_destroy_lock (omp_lock_arg (lock)); 87 #ifndef OMP_LOCK_DIRECT 88 free (omp_lock_arg (lock)); 89 omp_lock_arg (lock) = NULL; 90 #endif 91 } 92 93 void 94 omp_destroy_nest_lock_ (omp_nest_lock_arg_t lock) 95 { 96 omp_destroy_nest_lock (omp_nest_lock_arg (lock)); 97 #ifndef OMP_NEST_LOCK_DIRECT 98 free (omp_nest_lock_arg (lock)); 99 omp_nest_lock_arg (lock) = NULL; 100 #endif 101 } 102 103 void 104 omp_set_lock_ (omp_lock_arg_t lock) 105 { 106 omp_set_lock (omp_lock_arg (lock)); 107 } 108 109 void 110 omp_set_nest_lock_ (omp_nest_lock_arg_t lock) 111 { 112 omp_set_nest_lock (omp_nest_lock_arg (lock)); 113 } 114 115 void 116 omp_unset_lock_ (omp_lock_arg_t lock) 117 { 118 omp_unset_lock (omp_lock_arg (lock)); 119 } 120 121 void 122 omp_unset_nest_lock_ (omp_nest_lock_arg_t lock) 123 { 124 omp_unset_nest_lock (omp_nest_lock_arg (lock)); 125 } 126 127 void 128 omp_set_dynamic_ (const int32_t *set) 129 { 130 omp_set_dynamic (*set); 131 } 132 133 void 134 omp_set_dynamic_8_ (const int64_t *set) 135 { 136 omp_set_dynamic (*set); 137 } 138 139 void 140 omp_set_nested_ (const int32_t *set) 141 { 142 omp_set_nested (*set); 143 } 144 145 void 146 omp_set_nested_8_ (const int64_t *set) 147 { 148 omp_set_nested (*set); 149 } 150 151 void 152 omp_set_num_threads_ (const int32_t *set) 153 { 154 omp_set_num_threads (*set); 155 } 156 157 void 158 omp_set_num_threads_8_ (const int64_t *set) 159 { 160 omp_set_num_threads (*set); 161 } 162 163 int32_t 164 omp_get_dynamic_ (void) 165 { 166 return omp_get_dynamic (); 167 } 168 169 int32_t 170 omp_get_nested_ (void) 171 { 172 return omp_get_nested (); 173 } 174 175 int32_t 176 omp_in_parallel_ (void) 177 { 178 return omp_in_parallel (); 179 } 180 181 int32_t 182 omp_test_lock_ (omp_lock_arg_t lock) 183 { 184 return omp_test_lock (omp_lock_arg (lock)); 185 } 186 187 int32_t 188 omp_get_max_threads_ (void) 189 { 190 return omp_get_max_threads (); 191 } 192 193 int32_t 194 omp_get_num_procs_ (void) 195 { 196 return omp_get_num_procs (); 197 } 198 199 int32_t 200 omp_get_num_threads_ (void) 201 { 202 return omp_get_num_threads (); 203 } 204 205 int32_t 206 omp_get_thread_num_ (void) 207 { 208 return omp_get_thread_num (); 209 } 210 211 int32_t 212 omp_test_nest_lock_ (omp_nest_lock_arg_t lock) 213 { 214 return omp_test_nest_lock (omp_nest_lock_arg (lock)); 215 } 216 217 double 218 omp_get_wtick_ (void) 219 { 220 return omp_get_wtick (); 221 } 222 223 double 224 omp_get_wtime_ (void) 225 { 226 return omp_get_wtime (); 227 } 228