kmp_global.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #include "kmp.h"
00048
00049 #ifdef KMP_SETVERSION
00050 char __kmp_setversion_string[] = VERSION_STRING;
00051 #endif
00052
00053 kmp_key_t __kmp_gtid_threadprivate_key;
00054
00055 kmp_cpuinfo_t __kmp_cpuinfo = { 0 };
00056 kmp_uint64 __kmp_cpu_frequency = 0;
00057
00058
00059
00060
00061
00062 volatile int __kmp_init_serial = FALSE;
00063 volatile int __kmp_init_gtid = FALSE;
00064 volatile int __kmp_init_common = FALSE;
00065 volatile int __kmp_init_middle = FALSE;
00066 volatile int __kmp_init_parallel = FALSE;
00067 volatile int __kmp_init_monitor = 0;
00068 volatile int __kmp_init_user_locks = FALSE;
00069
00070
00071 kmp_cached_addr_t *__kmp_threadpriv_cache_list = NULL;
00072
00073 int __kmp_init_counter = 0;
00074 int __kmp_root_counter = 0;
00075 int __kmp_version = 0;
00076
00077 volatile kmp_uint32 __kmp_team_counter = 0;
00078 volatile kmp_uint32 __kmp_task_counter = 0;
00079
00080 unsigned int __kmp_init_wait = KMP_DEFAULT_INIT_WAIT;
00081 unsigned int __kmp_next_wait = KMP_DEFAULT_NEXT_WAIT;
00082
00083 size_t __kmp_stksize = KMP_DEFAULT_STKSIZE;
00084 size_t __kmp_monitor_stksize = 0;
00085 size_t __kmp_stkoffset = KMP_DEFAULT_STKOFFSET;
00086
00087 size_t __kmp_malloc_pool_incr = KMP_DEFAULT_MALLOC_POOL_INCR;
00088
00089
00090
00091 #if KMP_ARCH_X86_64
00092 kmp_uint32 __kmp_barrier_gather_bb_dflt = 2;
00093 kmp_uint32 __kmp_barrier_release_bb_dflt = 2;
00094 #else
00095 kmp_uint32 __kmp_barrier_gather_bb_dflt = 2;
00096 kmp_uint32 __kmp_barrier_release_bb_dflt = 2;
00097 #endif // KMP_ARCH_X86_64
00098 #if KMP_ARCH_X86_64
00099 kmp_bar_pat_e __kmp_barrier_gather_pat_dflt = bp_hyper_bar;
00100 kmp_bar_pat_e __kmp_barrier_release_pat_dflt = bp_hyper_bar;
00101 #else
00102 kmp_bar_pat_e __kmp_barrier_gather_pat_dflt = bp_linear_bar;
00103 kmp_bar_pat_e __kmp_barrier_release_pat_dflt = bp_linear_bar;
00104 #endif
00105 kmp_uint32 __kmp_barrier_gather_branch_bits [ bs_last_barrier ] = { 0 };
00106 kmp_uint32 __kmp_barrier_release_branch_bits [ bs_last_barrier ] = { 0 };
00107 kmp_bar_pat_e __kmp_barrier_gather_pattern [ bs_last_barrier ] = { bp_linear_bar };
00108 kmp_bar_pat_e __kmp_barrier_release_pattern [ bs_last_barrier ] = { bp_linear_bar };
00109 char const *__kmp_barrier_branch_bit_env_name [ bs_last_barrier ] =
00110 { "KMP_PLAIN_BARRIER", "KMP_FORKJOIN_BARRIER"
00111 #if KMP_FAST_REDUCTION_BARRIER
00112 , "KMP_REDUCTION_BARRIER"
00113 #endif // KMP_FAST_REDUCTION_BARRIER
00114 };
00115 char const *__kmp_barrier_pattern_env_name [ bs_last_barrier ] =
00116 { "KMP_PLAIN_BARRIER_PATTERN", "KMP_FORKJOIN_BARRIER_PATTERN"
00117 #if KMP_FAST_REDUCTION_BARRIER
00118 , "KMP_REDUCTION_BARRIER_PATTERN"
00119 #endif // KMP_FAST_REDUCTION_BARRIER
00120 };
00121 char const *__kmp_barrier_type_name [ bs_last_barrier ] =
00122 { "plain", "forkjoin"
00123 #if KMP_FAST_REDUCTION_BARRIER
00124 , "reduction"
00125 #endif // KMP_FAST_REDUCTION_BARRIER
00126 };
00127 char const *__kmp_barrier_pattern_name [ bp_last_bar ] = { "linear", "tree", "hyper" };
00128
00129
00130 int __kmp_allThreadsSpecified = 0;
00131 size_t __kmp_align_alloc = CACHE_LINE;
00132
00133
00134 int __kmp_generate_warnings = kmp_warnings_low;
00135 int __kmp_reserve_warn = 0;
00136 int __kmp_xproc = 0;
00137 int __kmp_avail_proc = 0;
00138 int __kmp_sys_min_stksize = KMP_MIN_STKSIZE;
00139 int __kmp_sys_max_nth = KMP_MAX_NTH;
00140 int __kmp_max_nth = 0;
00141 int __kmp_threads_capacity = 0;
00142 int __kmp_dflt_team_nth = 0;
00143 int __kmp_dflt_team_nth_ub = 0;
00144 int __kmp_tp_capacity = 0;
00145 int __kmp_tp_cached = 0;
00146 int __kmp_dflt_nested = FALSE;
00147 #if OMP_30_ENABLED
00148 int __kmp_dflt_max_active_levels = KMP_MAX_ACTIVE_LEVELS_LIMIT;
00149 #endif // OMP_30_ENABLED
00150 enum library_type __kmp_library = library_none;
00151 enum sched_type __kmp_sched = kmp_sch_default;
00152 enum sched_type __kmp_static = kmp_sch_static_greedy;
00153 enum sched_type __kmp_guided = kmp_sch_guided_iterative_chunked;
00154 #if OMP_30_ENABLED
00155 enum sched_type __kmp_auto = kmp_sch_guided_analytical_chunked;
00156 #endif // OMP_30_ENABLED
00157 int __kmp_dflt_blocktime = KMP_DEFAULT_BLOCKTIME;
00158 int __kmp_monitor_wakeups = KMP_MIN_MONITOR_WAKEUPS;
00159 int __kmp_bt_intervals = KMP_INTERVALS_FROM_BLOCKTIME( KMP_DEFAULT_BLOCKTIME, KMP_MIN_MONITOR_WAKEUPS );
00160 #ifdef KMP_ADJUST_BLOCKTIME
00161 int __kmp_zero_bt = FALSE;
00162 #endif
00163 int __kmp_ht_capable = FALSE;
00164 int __kmp_ht_enabled = FALSE;
00165 int __kmp_ht_log_per_phy = 1;
00166 int __kmp_ncores = 0;
00167 int __kmp_chunk = 0;
00168 int __kmp_abort_delay = 0;
00169 #if KMP_OS_LINUX && defined(KMP_TDATA_GTID)
00170 int __kmp_gtid_mode = 3;
00171 int __kmp_adjust_gtid_mode = FALSE;
00172 #elif KMP_OS_WINDOWS
00173 int __kmp_gtid_mode = 2;
00174 int __kmp_adjust_gtid_mode = FALSE;
00175 #else
00176 int __kmp_gtid_mode = 0;
00177 int __kmp_adjust_gtid_mode = TRUE;
00178 #endif
00179 #ifdef KMP_TDATA_GTID
00180 #if KMP_OS_WINDOWS
00181 __declspec(thread) int __kmp_gtid = KMP_GTID_DNE;
00182 #else
00183 __thread int __kmp_gtid = KMP_GTID_DNE;
00184 #endif
00185 #endif
00186 int __kmp_tls_gtid_min = INT_MAX;
00187 int __kmp_foreign_tp = TRUE;
00188 #if KMP_ARCH_X86 || KMP_ARCH_X86_64
00189 int __kmp_inherit_fp_control = TRUE;
00190 kmp_int16 __kmp_init_x87_fpu_control_word = 0;
00191 kmp_uint32 __kmp_init_mxcsr = 0;
00192 #endif
00193
00194 #ifdef USE_LOAD_BALANCE
00195 double __kmp_load_balance_interval = 1.0;
00196 #endif
00197
00198 kmp_nested_nthreads_t __kmp_nested_nth = { NULL, 0, 0 };
00199
00200
00201 enum sched_type __kmp_sch_map[ kmp_sched_upper - kmp_sched_lower_ext + kmp_sched_upper_std - kmp_sched_lower - 2 ] = {
00202 kmp_sch_static_chunked,
00203 kmp_sch_dynamic_chunked,
00204 kmp_sch_guided_chunked,
00205 kmp_sch_auto,
00206 kmp_sch_trapezoidal
00207
00208
00209 };
00210
00211 #if KMP_OS_LINUX
00212 enum clock_function_type __kmp_clock_function;
00213 int __kmp_clock_function_param;
00214 #endif
00215
00216 #if KMP_OS_LINUX || KMP_OS_WINDOWS
00217
00218 # if KMP_OS_WINDOWS && KMP_ARCH_X86_64
00219
00220 int __kmp_num_proc_groups = 1;
00221
00222 kmp_GetActiveProcessorCount_t __kmp_GetActiveProcessorCount = NULL;
00223 kmp_GetActiveProcessorGroupCount_t __kmp_GetActiveProcessorGroupCount = NULL;
00224 kmp_GetThreadGroupAffinity_t __kmp_GetThreadGroupAffinity = NULL;
00225 kmp_SetThreadGroupAffinity_t __kmp_SetThreadGroupAffinity = NULL;
00226
00227 # endif
00228
00229 size_t __kmp_affin_mask_size = 0;
00230 enum affinity_type __kmp_affinity_type = affinity_default;
00231 enum affinity_gran __kmp_affinity_gran = affinity_gran_default;
00232 int __kmp_affinity_gran_levels = -1;
00233 int __kmp_affinity_dups = TRUE;
00234 enum affinity_top_method __kmp_affinity_top_method = affinity_top_method_default;
00235 int __kmp_affinity_compact = 0;
00236 int __kmp_affinity_offset = 0;
00237 int __kmp_affinity_verbose = FALSE;
00238 int __kmp_affinity_warnings = TRUE;
00239 int __kmp_affinity_respect_mask = affinity_respect_mask_default;
00240 char * __kmp_affinity_proclist = NULL;
00241 kmp_affin_mask_t *__kmp_affinity_masks = NULL;
00242 unsigned __kmp_affinity_num_masks = 0;
00243
00244 char const * __kmp_cpuinfo_file = NULL;
00245
00246 #endif
00247
00248 #if OMP_40_ENABLED
00249 kmp_nested_proc_bind_t __kmp_nested_proc_bind = { NULL, 0, 0 };
00250 int __kmp_affinity_num_places = 0;
00251 #endif
00252
00253 #if KMP_MIC
00254 unsigned int __kmp_place_num_cores = 0;
00255 unsigned int __kmp_place_num_threads_per_core = 0;
00256 unsigned int __kmp_place_core_offset = 0;
00257 #endif
00258
00259 #if OMP_30_ENABLED
00260 kmp_tasking_mode_t __kmp_tasking_mode = tskm_task_teams;
00261
00262
00263
00264
00265
00266
00267
00268 KMP_BUILD_ASSERT( sizeof(kmp_tasking_flags_t) == 4 );
00269
00270 kmp_int32 __kmp_task_stealing_constraint = 1;
00271
00272 #endif
00273
00274 #ifdef DEBUG_SUSPEND
00275 int __kmp_suspend_count = 0;
00276 #endif
00277
00278 int __kmp_settings = FALSE;
00279 int __kmp_duplicate_library_ok = 0;
00280 int __kmp_forkjoin_frames = 0;
00281 PACKED_REDUCTION_METHOD_T __kmp_force_reduction_method = reduction_method_not_defined;
00282 int __kmp_determ_red = FALSE;
00283
00284 #ifdef KMP_DEBUG
00285 int kmp_a_debug = 0;
00286 int kmp_b_debug = 0;
00287 int kmp_c_debug = 0;
00288 int kmp_d_debug = 0;
00289 int kmp_e_debug = 0;
00290 int kmp_f_debug = 0;
00291 int kmp_diag = 0;
00292 #endif
00293
00294
00295 int __kmp_debug_buf = FALSE;
00296 int __kmp_debug_buf_lines = KMP_DEBUG_BUF_LINES_INIT;
00297 int __kmp_debug_buf_chars = KMP_DEBUG_BUF_CHARS_INIT;
00298 int __kmp_debug_buf_atomic = FALSE;
00299
00300 char *__kmp_debug_buffer = NULL;
00301 int __kmp_debug_count = 0;
00302 int __kmp_debug_buf_warn_chars = 0;
00303
00304
00305 #ifdef KMP_DEBUG
00306 int __kmp_par_range;
00307
00308 char __kmp_par_range_routine[KMP_PAR_RANGE_ROUTINE_LEN] = { '\0' };
00309 char __kmp_par_range_filename[KMP_PAR_RANGE_FILENAME_LEN] = { '\0' };
00310 int __kmp_par_range_lb = 0;
00311 int __kmp_par_range_ub = INT_MAX;
00312 #endif
00313
00314
00315 int __kmp_storage_map = FALSE;
00316 int __kmp_storage_map_verbose = FALSE;
00317 int __kmp_storage_map_verbose_specified = FALSE;
00318
00319 int __kmp_need_register_atfork = TRUE;
00320 int __kmp_need_register_atfork_specified = TRUE;
00321
00322
00323 int __kmp_env_chunk = FALSE;
00324 int __kmp_env_stksize = FALSE;
00325 int __kmp_env_omp_stksize = FALSE;
00326 int __kmp_env_all_threads = FALSE;
00327 int __kmp_env_omp_all_threads = FALSE;
00328 int __kmp_env_blocktime = FALSE;
00329 int __kmp_env_checks = FALSE;
00330 int __kmp_env_consistency_check = FALSE;
00331
00332 kmp_uint32 __kmp_yield_init = KMP_INIT_WAIT;
00333 kmp_uint32 __kmp_yield_next = KMP_NEXT_WAIT;
00334 kmp_uint32 __kmp_yielding_on = 1;
00335 kmp_uint32 __kmp_yield_cycle = 1;
00336 kmp_int32 __kmp_yield_on_count = 10;
00337 kmp_int32 __kmp_yield_off_count = 1;
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351 KMP_ALIGN_CACHE
00352 kmp_info_t **__kmp_threads = NULL;
00353 kmp_root_t **__kmp_root = NULL;
00354
00355
00356 KMP_ALIGN_CACHE
00357 volatile int __kmp_nth = 0;
00358 volatile int __kmp_all_nth = 0;
00359 int __kmp_thread_pool_nth = 0;
00360 volatile kmp_info_t *__kmp_thread_pool = NULL;
00361 volatile kmp_team_t *__kmp_team_pool = NULL;
00362
00363 KMP_ALIGN_CACHE
00364 volatile int __kmp_thread_pool_active_nth = 0;
00365
00366
00367
00368 KMP_ALIGN_CACHE
00369 kmp_global_t __kmp_global = {{ 0 }};
00370
00371
00372
00373
00374 KMP_ALIGN_CACHE
00375
00376 kmp_bootstrap_lock_t __kmp_initz_lock = KMP_BOOTSTRAP_LOCK_INITIALIZER( __kmp_initz_lock );
00377 kmp_bootstrap_lock_t __kmp_forkjoin_lock;
00378 kmp_bootstrap_lock_t __kmp_exit_lock;
00379 kmp_bootstrap_lock_t __kmp_monitor_lock;
00380 kmp_bootstrap_lock_t __kmp_tp_cached_lock;
00381
00382 KMP_ALIGN(128)
00383 kmp_lock_t __kmp_global_lock;
00384 KMP_ALIGN(128)
00385 kmp_queuing_lock_t __kmp_dispatch_lock;
00386 KMP_ALIGN(128)
00387 kmp_lock_t __kmp_debug_lock;
00388
00389
00390
00391 #if KMP_HANDLE_SIGNALS
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411 int __kmp_handle_signals = FALSE;
00412 #endif
00413
00414
00415 #ifdef BUILD_TV
00416 kmp_key_t __kmp_tv_key = 0;
00417 #endif
00418
00419
00420
00421
00422 #ifdef DEBUG_SUSPEND
00423 int
00424 get_suspend_count_( void ) {
00425 int count = __kmp_suspend_count;
00426 __kmp_suspend_count = 0;
00427 return count;
00428 }
00429 void
00430 set_suspend_count_( int * value ) {
00431 __kmp_suspend_count = *value;
00432 }
00433 #endif
00434
00435
00436 int _You_must_link_with_exactly_one_OpenMP_library = 1;
00437 int _You_must_link_with_Intel_OpenMP_library = 1;
00438 #if KMP_OS_WINDOWS && ( KMP_VERSION_MAJOR > 4 )
00439 int _You_must_link_with_Microsoft_OpenMP_library = 1;
00440 #endif
00441
00442