1 // $FreeBSD$ 2 /* 3 * include/50/omp.h.var 4 */ 5 6 7 //===----------------------------------------------------------------------===// 8 // 9 // The LLVM Compiler Infrastructure 10 // 11 // This file is dual licensed under the MIT and the University of Illinois Open 12 // Source Licenses. See LICENSE.txt for details. 13 // 14 //===----------------------------------------------------------------------===// 15 16 17 #ifndef __OMP_H 18 # define __OMP_H 19 20 # define KMP_VERSION_MAJOR 5 21 # define KMP_VERSION_MINOR 0 22 # define KMP_VERSION_BUILD 20140926 23 # define KMP_BUILD_DATE "No_Timestamp" 24 25 # ifdef __cplusplus 26 extern "C" { 27 # endif 28 29 # define omp_set_affinity_format ompc_set_affinity_format 30 # define omp_get_affinity_format ompc_get_affinity_format 31 # define omp_display_affinity ompc_display_affinity 32 # define omp_capture_affinity ompc_capture_affinity 33 34 # if defined(_WIN32) 35 # define __KAI_KMPC_CONVENTION __cdecl 36 # ifndef __KMP_IMP 37 # define __KMP_IMP __declspec(dllimport) 38 # endif 39 # else 40 # define __KAI_KMPC_CONVENTION 41 # ifndef __KMP_IMP 42 # define __KMP_IMP 43 # endif 44 # endif 45 46 /* schedule kind constants */ 47 typedef enum omp_sched_t { 48 omp_sched_static = 1, 49 omp_sched_dynamic = 2, 50 omp_sched_guided = 3, 51 omp_sched_auto = 4 52 } omp_sched_t; 53 54 /* set API functions */ 55 extern void __KAI_KMPC_CONVENTION omp_set_num_threads (int); 56 extern void __KAI_KMPC_CONVENTION omp_set_dynamic (int); 57 extern void __KAI_KMPC_CONVENTION omp_set_nested (int); 58 extern void __KAI_KMPC_CONVENTION omp_set_max_active_levels (int); 59 extern void __KAI_KMPC_CONVENTION omp_set_schedule (omp_sched_t, int); 60 61 /* query API functions */ 62 extern int __KAI_KMPC_CONVENTION omp_get_num_threads (void); 63 extern int __KAI_KMPC_CONVENTION omp_get_dynamic (void); 64 extern int __KAI_KMPC_CONVENTION omp_get_nested (void); 65 extern int __KAI_KMPC_CONVENTION omp_get_max_threads (void); 66 extern int __KAI_KMPC_CONVENTION omp_get_thread_num (void); 67 extern int __KAI_KMPC_CONVENTION omp_get_num_procs (void); 68 extern int __KAI_KMPC_CONVENTION omp_in_parallel (void); 69 extern int __KAI_KMPC_CONVENTION omp_in_final (void); 70 extern int __KAI_KMPC_CONVENTION omp_get_active_level (void); 71 extern int __KAI_KMPC_CONVENTION omp_get_level (void); 72 extern int __KAI_KMPC_CONVENTION omp_get_ancestor_thread_num (int); 73 extern int __KAI_KMPC_CONVENTION omp_get_team_size (int); 74 extern int __KAI_KMPC_CONVENTION omp_get_thread_limit (void); 75 extern int __KAI_KMPC_CONVENTION omp_get_max_active_levels (void); 76 extern void __KAI_KMPC_CONVENTION omp_get_schedule (omp_sched_t *, int *); 77 extern int __KAI_KMPC_CONVENTION omp_get_max_task_priority (void); 78 79 /* lock API functions */ 80 typedef struct omp_lock_t { 81 void * _lk; 82 } omp_lock_t; 83 84 extern void __KAI_KMPC_CONVENTION omp_init_lock (omp_lock_t *); 85 extern void __KAI_KMPC_CONVENTION omp_set_lock (omp_lock_t *); 86 extern void __KAI_KMPC_CONVENTION omp_unset_lock (omp_lock_t *); 87 extern void __KAI_KMPC_CONVENTION omp_destroy_lock (omp_lock_t *); 88 extern int __KAI_KMPC_CONVENTION omp_test_lock (omp_lock_t *); 89 90 /* nested lock API functions */ 91 typedef struct omp_nest_lock_t { 92 void * _lk; 93 } omp_nest_lock_t; 94 95 extern void __KAI_KMPC_CONVENTION omp_init_nest_lock (omp_nest_lock_t *); 96 extern void __KAI_KMPC_CONVENTION omp_set_nest_lock (omp_nest_lock_t *); 97 extern void __KAI_KMPC_CONVENTION omp_unset_nest_lock (omp_nest_lock_t *); 98 extern void __KAI_KMPC_CONVENTION omp_destroy_nest_lock (omp_nest_lock_t *); 99 extern int __KAI_KMPC_CONVENTION omp_test_nest_lock (omp_nest_lock_t *); 100 101 /* OpenMP 5.0 Synchronization hints*/ 102 typedef enum omp_sync_hint_t { 103 omp_sync_hint_none = 0, 104 omp_lock_hint_none = omp_sync_hint_none, 105 omp_sync_hint_uncontended = 1, 106 omp_lock_hint_uncontended = omp_sync_hint_uncontended, 107 omp_sync_hint_contended = (1<<1), 108 omp_lock_hint_contended = omp_sync_hint_contended, 109 omp_sync_hint_nonspeculative = (1<<2), 110 omp_lock_hint_nonspeculative = omp_sync_hint_nonspeculative, 111 omp_sync_hint_speculative = (1<<3), 112 omp_lock_hint_speculative = omp_sync_hint_speculative, 113 kmp_lock_hint_hle = (1<<16), 114 kmp_lock_hint_rtm = (1<<17), 115 kmp_lock_hint_adaptive = (1<<18) 116 } omp_sync_hint_t; 117 118 /* lock hint type for dynamic user lock */ 119 typedef omp_sync_hint_t omp_lock_hint_t; 120 121 /* hinted lock initializers */ 122 extern void __KAI_KMPC_CONVENTION omp_init_lock_with_hint(omp_lock_t *, omp_lock_hint_t); 123 extern void __KAI_KMPC_CONVENTION omp_init_nest_lock_with_hint(omp_nest_lock_t *, omp_lock_hint_t); 124 125 /* time API functions */ 126 extern double __KAI_KMPC_CONVENTION omp_get_wtime (void); 127 extern double __KAI_KMPC_CONVENTION omp_get_wtick (void); 128 129 /* OpenMP 4.0 */ 130 extern int __KAI_KMPC_CONVENTION omp_get_default_device (void); 131 extern void __KAI_KMPC_CONVENTION omp_set_default_device (int); 132 extern int __KAI_KMPC_CONVENTION omp_is_initial_device (void); 133 extern int __KAI_KMPC_CONVENTION omp_get_num_devices (void); 134 extern int __KAI_KMPC_CONVENTION omp_get_num_teams (void); 135 extern int __KAI_KMPC_CONVENTION omp_get_team_num (void); 136 extern int __KAI_KMPC_CONVENTION omp_get_cancellation (void); 137 138 # include <stdlib.h> 139 /* OpenMP 4.5 */ 140 extern int __KAI_KMPC_CONVENTION omp_get_initial_device (void); 141 extern void* __KAI_KMPC_CONVENTION omp_target_alloc(size_t, int); 142 extern void __KAI_KMPC_CONVENTION omp_target_free(void *, int); 143 extern int __KAI_KMPC_CONVENTION omp_target_is_present(void *, int); 144 extern int __KAI_KMPC_CONVENTION omp_target_memcpy(void *, void *, size_t, size_t, size_t, int, int); 145 extern int __KAI_KMPC_CONVENTION omp_target_memcpy_rect(void *, void *, size_t, int, const size_t *, 146 const size_t *, const size_t *, const size_t *, const size_t *, int, int); 147 extern int __KAI_KMPC_CONVENTION omp_target_associate_ptr(void *, void *, size_t, size_t, int); 148 extern int __KAI_KMPC_CONVENTION omp_target_disassociate_ptr(void *, int); 149 150 /* OpenMP 5.0 */ 151 extern int __KAI_KMPC_CONVENTION omp_get_device_num (void); 152 153 /* kmp API functions */ 154 extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void); 155 extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int); 156 extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void); 157 extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t); 158 extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void); 159 extern int __KAI_KMPC_CONVENTION kmp_get_library (void); 160 extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int); 161 extern void __KAI_KMPC_CONVENTION kmp_set_library (int); 162 extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void); 163 extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void); 164 extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void); 165 extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *); 166 extern void __KAI_KMPC_CONVENTION kmp_set_disp_num_buffers (int); 167 168 /* Intel affinity API */ 169 typedef void * kmp_affinity_mask_t; 170 171 extern int __KAI_KMPC_CONVENTION kmp_set_affinity (kmp_affinity_mask_t *); 172 extern int __KAI_KMPC_CONVENTION kmp_get_affinity (kmp_affinity_mask_t *); 173 extern int __KAI_KMPC_CONVENTION kmp_get_affinity_max_proc (void); 174 extern void __KAI_KMPC_CONVENTION kmp_create_affinity_mask (kmp_affinity_mask_t *); 175 extern void __KAI_KMPC_CONVENTION kmp_destroy_affinity_mask (kmp_affinity_mask_t *); 176 extern int __KAI_KMPC_CONVENTION kmp_set_affinity_mask_proc (int, kmp_affinity_mask_t *); 177 extern int __KAI_KMPC_CONVENTION kmp_unset_affinity_mask_proc (int, kmp_affinity_mask_t *); 178 extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *); 179 180 /* OpenMP 4.0 affinity API */ 181 typedef enum omp_proc_bind_t { 182 omp_proc_bind_false = 0, 183 omp_proc_bind_true = 1, 184 omp_proc_bind_master = 2, 185 omp_proc_bind_close = 3, 186 omp_proc_bind_spread = 4 187 } omp_proc_bind_t; 188 189 extern omp_proc_bind_t __KAI_KMPC_CONVENTION omp_get_proc_bind (void); 190 191 /* OpenMP 4.5 affinity API */ 192 extern int __KAI_KMPC_CONVENTION omp_get_num_places (void); 193 extern int __KAI_KMPC_CONVENTION omp_get_place_num_procs (int); 194 extern void __KAI_KMPC_CONVENTION omp_get_place_proc_ids (int, int *); 195 extern int __KAI_KMPC_CONVENTION omp_get_place_num (void); 196 extern int __KAI_KMPC_CONVENTION omp_get_partition_num_places (void); 197 extern void __KAI_KMPC_CONVENTION omp_get_partition_place_nums (int *); 198 199 extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t); 200 extern void * __KAI_KMPC_CONVENTION kmp_aligned_malloc (size_t, size_t); 201 extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t); 202 extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t); 203 extern void __KAI_KMPC_CONVENTION kmp_free (void *); 204 205 extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void); 206 extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void); 207 208 /* OpenMP 5.0 Tool Control */ 209 typedef enum omp_control_tool_result_t { 210 omp_control_tool_notool = -2, 211 omp_control_tool_nocallback = -1, 212 omp_control_tool_success = 0, 213 omp_control_tool_ignored = 1 214 } omp_control_tool_result_t; 215 216 typedef enum omp_control_tool_t { 217 omp_control_tool_start = 1, 218 omp_control_tool_pause = 2, 219 omp_control_tool_flush = 3, 220 omp_control_tool_end = 4 221 } omp_control_tool_t; 222 223 extern int __KAI_KMPC_CONVENTION omp_control_tool(int, int, void*); 224 225 /* OpenMP 5.0 Memory Management */ 226 typedef void *omp_allocator_t; 227 extern __KMP_IMP const omp_allocator_t *OMP_NULL_ALLOCATOR; 228 extern __KMP_IMP const omp_allocator_t *omp_default_mem_alloc; 229 extern __KMP_IMP const omp_allocator_t *omp_large_cap_mem_alloc; 230 extern __KMP_IMP const omp_allocator_t *omp_const_mem_alloc; 231 extern __KMP_IMP const omp_allocator_t *omp_high_bw_mem_alloc; 232 extern __KMP_IMP const omp_allocator_t *omp_low_lat_mem_alloc; 233 extern __KMP_IMP const omp_allocator_t *omp_cgroup_mem_alloc; 234 extern __KMP_IMP const omp_allocator_t *omp_pteam_mem_alloc; 235 extern __KMP_IMP const omp_allocator_t *omp_thread_mem_alloc; 236 237 extern void __KAI_KMPC_CONVENTION omp_set_default_allocator(const omp_allocator_t *); 238 extern const omp_allocator_t * __KAI_KMPC_CONVENTION omp_get_default_allocator(void); 239 #ifdef __cplusplus 240 extern void *__KAI_KMPC_CONVENTION omp_alloc(size_t size, const omp_allocator_t *allocator = OMP_NULL_ALLOCATOR); 241 extern void __KAI_KMPC_CONVENTION omp_free(void * ptr, const omp_allocator_t *allocator = OMP_NULL_ALLOCATOR); 242 #else 243 extern void *__KAI_KMPC_CONVENTION omp_alloc(size_t size, const omp_allocator_t *allocator); 244 extern void __KAI_KMPC_CONVENTION omp_free(void *ptr, const omp_allocator_t *allocator); 245 #endif 246 247 /* OpenMP 5.0 Affinity Format */ 248 extern void __KAI_KMPC_CONVENTION omp_set_affinity_format(char const *); 249 extern size_t __KAI_KMPC_CONVENTION omp_get_affinity_format(char *, size_t); 250 extern void __KAI_KMPC_CONVENTION omp_display_affinity(char const *); 251 extern size_t __KAI_KMPC_CONVENTION omp_capture_affinity(char *, size_t, char const *); 252 253 # undef __KAI_KMPC_CONVENTION 254 # undef __KMP_IMP 255 256 /* Warning: 257 The following typedefs are not standard, deprecated and will be removed in a future release. 258 */ 259 typedef int omp_int_t; 260 typedef double omp_wtime_t; 261 262 # ifdef __cplusplus 263 } 264 # endif 265 266 #endif /* __OMP_H */ 267