1 /* 2 * include/50/omp.h.var 3 */ 4 5 6 //===----------------------------------------------------------------------===// 7 // 8 // The LLVM Compiler Infrastructure 9 // 10 // This file is dual licensed under the MIT and the University of Illinois Open 11 // Source Licenses. See LICENSE.txt for details. 12 // 13 //===----------------------------------------------------------------------===// 14 15 16 #ifndef __OMP_H 17 # define __OMP_H 18 19 # define KMP_VERSION_MAJOR 5 20 # define KMP_VERSION_MINOR 0 21 # define KMP_VERSION_BUILD 20140926 22 # define KMP_BUILD_DATE "No_Timestamp" 23 24 # ifdef __cplusplus 25 extern "C" { 26 # endif 27 28 # if defined(_WIN32) 29 # define __KAI_KMPC_CONVENTION __cdecl 30 # else 31 # define __KAI_KMPC_CONVENTION 32 # endif 33 34 /* schedule kind constants */ 35 typedef enum omp_sched_t { 36 omp_sched_static = 1, 37 omp_sched_dynamic = 2, 38 omp_sched_guided = 3, 39 omp_sched_auto = 4 40 } omp_sched_t; 41 42 /* set API functions */ 43 extern void __KAI_KMPC_CONVENTION omp_set_num_threads (int); 44 extern void __KAI_KMPC_CONVENTION omp_set_dynamic (int); 45 extern void __KAI_KMPC_CONVENTION omp_set_nested (int); 46 extern void __KAI_KMPC_CONVENTION omp_set_max_active_levels (int); 47 extern void __KAI_KMPC_CONVENTION omp_set_schedule (omp_sched_t, int); 48 49 /* query API functions */ 50 extern int __KAI_KMPC_CONVENTION omp_get_num_threads (void); 51 extern int __KAI_KMPC_CONVENTION omp_get_dynamic (void); 52 extern int __KAI_KMPC_CONVENTION omp_get_nested (void); 53 extern int __KAI_KMPC_CONVENTION omp_get_max_threads (void); 54 extern int __KAI_KMPC_CONVENTION omp_get_thread_num (void); 55 extern int __KAI_KMPC_CONVENTION omp_get_num_procs (void); 56 extern int __KAI_KMPC_CONVENTION omp_in_parallel (void); 57 extern int __KAI_KMPC_CONVENTION omp_in_final (void); 58 extern int __KAI_KMPC_CONVENTION omp_get_active_level (void); 59 extern int __KAI_KMPC_CONVENTION omp_get_level (void); 60 extern int __KAI_KMPC_CONVENTION omp_get_ancestor_thread_num (int); 61 extern int __KAI_KMPC_CONVENTION omp_get_team_size (int); 62 extern int __KAI_KMPC_CONVENTION omp_get_thread_limit (void); 63 extern int __KAI_KMPC_CONVENTION omp_get_max_active_levels (void); 64 extern void __KAI_KMPC_CONVENTION omp_get_schedule (omp_sched_t *, int *); 65 extern int __KAI_KMPC_CONVENTION omp_get_max_task_priority (void); 66 67 /* lock API functions */ 68 typedef struct omp_lock_t { 69 void * _lk; 70 } omp_lock_t; 71 72 extern void __KAI_KMPC_CONVENTION omp_init_lock (omp_lock_t *); 73 extern void __KAI_KMPC_CONVENTION omp_set_lock (omp_lock_t *); 74 extern void __KAI_KMPC_CONVENTION omp_unset_lock (omp_lock_t *); 75 extern void __KAI_KMPC_CONVENTION omp_destroy_lock (omp_lock_t *); 76 extern int __KAI_KMPC_CONVENTION omp_test_lock (omp_lock_t *); 77 78 /* nested lock API functions */ 79 typedef struct omp_nest_lock_t { 80 void * _lk; 81 } omp_nest_lock_t; 82 83 extern void __KAI_KMPC_CONVENTION omp_init_nest_lock (omp_nest_lock_t *); 84 extern void __KAI_KMPC_CONVENTION omp_set_nest_lock (omp_nest_lock_t *); 85 extern void __KAI_KMPC_CONVENTION omp_unset_nest_lock (omp_nest_lock_t *); 86 extern void __KAI_KMPC_CONVENTION omp_destroy_nest_lock (omp_nest_lock_t *); 87 extern int __KAI_KMPC_CONVENTION omp_test_nest_lock (omp_nest_lock_t *); 88 89 /* lock hint type for dynamic user lock */ 90 typedef enum omp_lock_hint_t { 91 omp_lock_hint_none = 0, 92 omp_lock_hint_uncontended = 1, 93 omp_lock_hint_contended = (1<<1 ), 94 omp_lock_hint_nonspeculative = (1<<2 ), 95 omp_lock_hint_speculative = (1<<3 ), 96 kmp_lock_hint_hle = (1<<16), 97 kmp_lock_hint_rtm = (1<<17), 98 kmp_lock_hint_adaptive = (1<<18) 99 } omp_lock_hint_t; 100 101 /* hinted lock initializers */ 102 extern void __KAI_KMPC_CONVENTION omp_init_lock_with_hint(omp_lock_t *, omp_lock_hint_t); 103 extern void __KAI_KMPC_CONVENTION omp_init_nest_lock_with_hint(omp_nest_lock_t *, omp_lock_hint_t); 104 105 /* time API functions */ 106 extern double __KAI_KMPC_CONVENTION omp_get_wtime (void); 107 extern double __KAI_KMPC_CONVENTION omp_get_wtick (void); 108 109 /* OpenMP 4.0 */ 110 extern int __KAI_KMPC_CONVENTION omp_get_default_device (void); 111 extern void __KAI_KMPC_CONVENTION omp_set_default_device (int); 112 extern int __KAI_KMPC_CONVENTION omp_is_initial_device (void); 113 extern int __KAI_KMPC_CONVENTION omp_get_num_devices (void); 114 extern int __KAI_KMPC_CONVENTION omp_get_num_teams (void); 115 extern int __KAI_KMPC_CONVENTION omp_get_team_num (void); 116 extern int __KAI_KMPC_CONVENTION omp_get_cancellation (void); 117 118 # include <stdlib.h> 119 /* OpenMP 4.5 */ 120 extern int __KAI_KMPC_CONVENTION omp_get_initial_device (void); 121 extern void* __KAI_KMPC_CONVENTION omp_target_alloc(size_t, int); 122 extern void __KAI_KMPC_CONVENTION omp_target_free(void *, int); 123 extern int __KAI_KMPC_CONVENTION omp_target_is_present(void *, int); 124 extern int __KAI_KMPC_CONVENTION omp_target_memcpy(void *, void *, size_t, size_t, size_t, int, int); 125 extern int __KAI_KMPC_CONVENTION omp_target_memcpy_rect(void *, void *, size_t, int, const size_t *, 126 const size_t *, const size_t *, const size_t *, const size_t *, int, int); 127 extern int __KAI_KMPC_CONVENTION omp_target_associate_ptr(void *, void *, size_t, size_t, int); 128 extern int __KAI_KMPC_CONVENTION omp_target_disassociate_ptr(void *, int); 129 130 /* kmp API functions */ 131 extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void); 132 extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int); 133 extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void); 134 extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t); 135 extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void); 136 extern int __KAI_KMPC_CONVENTION kmp_get_library (void); 137 extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int); 138 extern void __KAI_KMPC_CONVENTION kmp_set_library (int); 139 extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void); 140 extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void); 141 extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void); 142 extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *); 143 extern void __KAI_KMPC_CONVENTION kmp_set_disp_num_buffers (int); 144 145 /* Intel affinity API */ 146 typedef void * kmp_affinity_mask_t; 147 148 extern int __KAI_KMPC_CONVENTION kmp_set_affinity (kmp_affinity_mask_t *); 149 extern int __KAI_KMPC_CONVENTION kmp_get_affinity (kmp_affinity_mask_t *); 150 extern int __KAI_KMPC_CONVENTION kmp_get_affinity_max_proc (void); 151 extern void __KAI_KMPC_CONVENTION kmp_create_affinity_mask (kmp_affinity_mask_t *); 152 extern void __KAI_KMPC_CONVENTION kmp_destroy_affinity_mask (kmp_affinity_mask_t *); 153 extern int __KAI_KMPC_CONVENTION kmp_set_affinity_mask_proc (int, kmp_affinity_mask_t *); 154 extern int __KAI_KMPC_CONVENTION kmp_unset_affinity_mask_proc (int, kmp_affinity_mask_t *); 155 extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *); 156 157 /* OpenMP 4.0 affinity API */ 158 typedef enum omp_proc_bind_t { 159 omp_proc_bind_false = 0, 160 omp_proc_bind_true = 1, 161 omp_proc_bind_master = 2, 162 omp_proc_bind_close = 3, 163 omp_proc_bind_spread = 4 164 } omp_proc_bind_t; 165 166 extern omp_proc_bind_t __KAI_KMPC_CONVENTION omp_get_proc_bind (void); 167 168 /* OpenMP 4.5 affinity API */ 169 extern int __KAI_KMPC_CONVENTION omp_get_num_places (void); 170 extern int __KAI_KMPC_CONVENTION omp_get_place_num_procs (int); 171 extern void __KAI_KMPC_CONVENTION omp_get_place_proc_ids (int, int *); 172 extern int __KAI_KMPC_CONVENTION omp_get_place_num (void); 173 extern int __KAI_KMPC_CONVENTION omp_get_partition_num_places (void); 174 extern void __KAI_KMPC_CONVENTION omp_get_partition_place_nums (int *); 175 176 extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t); 177 extern void * __KAI_KMPC_CONVENTION kmp_aligned_malloc (size_t, size_t); 178 extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t); 179 extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t); 180 extern void __KAI_KMPC_CONVENTION kmp_free (void *); 181 182 extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void); 183 extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void); 184 185 # undef __KAI_KMPC_CONVENTION 186 187 /* Warning: 188 The following typedefs are not standard, deprecated and will be removed in a future release. 189 */ 190 typedef int omp_int_t; 191 typedef double omp_wtime_t; 192 193 # ifdef __cplusplus 194 } 195 # endif 196 197 #endif /* __OMP_H */ 198 199