Changeset View
Changeset View
Standalone View
Standalone View
runtime/src/kmp.h
Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | |||||
#if KMP_OS_LINUX | #if KMP_OS_LINUX | ||||
#pragma weak clock_gettime | #pragma weak clock_gettime | ||||
#endif | #endif | ||||
#if OMPT_SUPPORT | #if OMPT_SUPPORT | ||||
#include "ompt-internal.h" | #include "ompt-internal.h" | ||||
#endif | #endif | ||||
#if OMP_50_ENABLED | |||||
// Affinity format function | |||||
#include "kmp_str.h" | |||||
#endif | |||||
// 0 - no fast memory allocation, alignment: 8-byte on x86, 16-byte on x64. | // 0 - no fast memory allocation, alignment: 8-byte on x86, 16-byte on x64. | ||||
// 3 - fast allocation using sync, non-sync free lists of any size, non-self | // 3 - fast allocation using sync, non-sync free lists of any size, non-self | ||||
// free lists of limited size. | // free lists of limited size. | ||||
#ifndef USE_FAST_MEMORY | #ifndef USE_FAST_MEMORY | ||||
#define USE_FAST_MEMORY 3 | #define USE_FAST_MEMORY 3 | ||||
#endif | #endif | ||||
#ifndef KMP_NESTED_HOT_TEAMS | #ifndef KMP_NESTED_HOT_TEAMS | ||||
▲ Show 20 Lines • Show All 652 Lines • ▼ Show 20 Lines | typedef struct kmp_nested_proc_bind_t { | ||||
int size; | int size; | ||||
int used; | int used; | ||||
} kmp_nested_proc_bind_t; | } kmp_nested_proc_bind_t; | ||||
extern kmp_nested_proc_bind_t __kmp_nested_proc_bind; | extern kmp_nested_proc_bind_t __kmp_nested_proc_bind; | ||||
#endif /* OMP_40_ENABLED */ | #endif /* OMP_40_ENABLED */ | ||||
#if OMP_50_ENABLED | |||||
extern int __kmp_display_affinity; | |||||
extern char *__kmp_affinity_format; | |||||
static const size_t KMP_AFFINITY_FORMAT_SIZE = 512; | |||||
#endif // OMP_50_ENABLED | |||||
#if KMP_AFFINITY_SUPPORTED | #if KMP_AFFINITY_SUPPORTED | ||||
#define KMP_PLACE_ALL (-1) | #define KMP_PLACE_ALL (-1) | ||||
#define KMP_PLACE_UNDEFINED (-2) | #define KMP_PLACE_UNDEFINED (-2) | ||||
// Is KMP_AFFINITY is being used instead of OMP_PROC_BIND/OMP_PLACES? | // Is KMP_AFFINITY is being used instead of OMP_PROC_BIND/OMP_PLACES? | ||||
#define KMP_AFFINITY_NON_PROC_BIND \ | #define KMP_AFFINITY_NON_PROC_BIND \ | ||||
((__kmp_nested_proc_bind.bind_types[0] == proc_bind_false || \ | ((__kmp_nested_proc_bind.bind_types[0] == proc_bind_false || \ | ||||
__kmp_nested_proc_bind.bind_types[0] == proc_bind_intel) && \ | __kmp_nested_proc_bind.bind_types[0] == proc_bind_intel) && \ | ||||
(__kmp_affinity_num_masks > 0 || __kmp_affinity_type == affinity_balanced)) | (__kmp_affinity_num_masks > 0 || __kmp_affinity_type == affinity_balanced)) | ||||
▲ Show 20 Lines • Show All 1,694 Lines • ▼ Show 20 Lines | kmp_teams_size_t | ||||
th_teams_size; /* number of teams/threads in teams construct */ | th_teams_size; /* number of teams/threads in teams construct */ | ||||
#if KMP_AFFINITY_SUPPORTED | #if KMP_AFFINITY_SUPPORTED | ||||
int th_current_place; /* place currently bound to */ | int th_current_place; /* place currently bound to */ | ||||
int th_new_place; /* place to bind to in par reg */ | int th_new_place; /* place to bind to in par reg */ | ||||
int th_first_place; /* first place in partition */ | int th_first_place; /* first place in partition */ | ||||
int th_last_place; /* last place in partition */ | int th_last_place; /* last place in partition */ | ||||
#endif | #endif | ||||
#endif | #endif | ||||
#if OMP_50_ENABLED | |||||
int th_prev_level; /* previous level for affinity format */ | |||||
int th_prev_num_threads; /* previous num_threads for affinity format */ | |||||
#endif | |||||
#if USE_ITT_BUILD | #if USE_ITT_BUILD | ||||
kmp_uint64 th_bar_arrive_time; /* arrival to barrier timestamp */ | kmp_uint64 th_bar_arrive_time; /* arrival to barrier timestamp */ | ||||
kmp_uint64 th_bar_min_time; /* minimum arrival time at the barrier */ | kmp_uint64 th_bar_min_time; /* minimum arrival time at the barrier */ | ||||
kmp_uint64 th_frame_time; /* frame timestamp */ | kmp_uint64 th_frame_time; /* frame timestamp */ | ||||
#endif /* USE_ITT_BUILD */ | #endif /* USE_ITT_BUILD */ | ||||
kmp_local_t th_local; | kmp_local_t th_local; | ||||
struct private_common *th_pri_head; | struct private_common *th_pri_head; | ||||
▲ Show 20 Lines • Show All 177 Lines • ▼ Show 20 Lines | #endif /* KMP_ARCH_X86 || KMP_ARCH_X86_64 */ | ||||
dispatch_shared_info_t *t_disp_buffer; // buffers for dispatch system | dispatch_shared_info_t *t_disp_buffer; // buffers for dispatch system | ||||
int t_id; // team's id, assigned by debugger. | int t_id; // team's id, assigned by debugger. | ||||
int t_active_level; // nested active parallel level | int t_active_level; // nested active parallel level | ||||
kmp_r_sched_t t_sched; // run-time schedule for the team | kmp_r_sched_t t_sched; // run-time schedule for the team | ||||
#if OMP_40_ENABLED && KMP_AFFINITY_SUPPORTED | #if OMP_40_ENABLED && KMP_AFFINITY_SUPPORTED | ||||
int t_first_place; // first & last place in parent thread's partition. | int t_first_place; // first & last place in parent thread's partition. | ||||
int t_last_place; // Restore these values to master after par region. | int t_last_place; // Restore these values to master after par region. | ||||
#endif // OMP_40_ENABLED && KMP_AFFINITY_SUPPORTED | #endif // OMP_40_ENABLED && KMP_AFFINITY_SUPPORTED | ||||
#if OMP_50_ENABLED | |||||
int t_display_affinity; | |||||
#endif | |||||
int t_size_changed; // team size was changed?: 0: no, 1: yes, -1: changed via | int t_size_changed; // team size was changed?: 0: no, 1: yes, -1: changed via | ||||
// omp_set_num_threads() call | // omp_set_num_threads() call | ||||
#if OMP_50_ENABLED | #if OMP_50_ENABLED | ||||
void *const *t_def_allocator; /* per implicit task default allocator */ | void *const *t_def_allocator; /* per implicit task default allocator */ | ||||
#endif | #endif | ||||
// Read/write by workers as well | // Read/write by workers as well | ||||
#if (KMP_ARCH_X86 || KMP_ARCH_X86_64) | #if (KMP_ARCH_X86 || KMP_ARCH_X86_64) | ||||
▲ Show 20 Lines • Show All 667 Lines • ▼ Show 20 Lines | |||||
extern void | extern void | ||||
__kmp_runtime_initialize(void); /* machine specific initialization */ | __kmp_runtime_initialize(void); /* machine specific initialization */ | ||||
extern void __kmp_runtime_destroy(void); | extern void __kmp_runtime_destroy(void); | ||||
#if KMP_AFFINITY_SUPPORTED | #if KMP_AFFINITY_SUPPORTED | ||||
extern char *__kmp_affinity_print_mask(char *buf, int buf_len, | extern char *__kmp_affinity_print_mask(char *buf, int buf_len, | ||||
kmp_affin_mask_t *mask); | kmp_affin_mask_t *mask); | ||||
extern kmp_str_buf_t *__kmp_affinity_str_buf_mask(kmp_str_buf_t *buf, | |||||
kmp_affin_mask_t *mask); | |||||
extern void __kmp_affinity_initialize(void); | extern void __kmp_affinity_initialize(void); | ||||
extern void __kmp_affinity_uninitialize(void); | extern void __kmp_affinity_uninitialize(void); | ||||
extern void __kmp_affinity_set_init_mask( | extern void __kmp_affinity_set_init_mask( | ||||
int gtid, int isa_root); /* set affinity according to KMP_AFFINITY */ | int gtid, int isa_root); /* set affinity according to KMP_AFFINITY */ | ||||
#if OMP_40_ENABLED | #if OMP_40_ENABLED | ||||
extern void __kmp_affinity_set_place(int gtid); | extern void __kmp_affinity_set_place(int gtid); | ||||
#endif | #endif | ||||
extern void __kmp_affinity_determine_capable(const char *env_var); | extern void __kmp_affinity_determine_capable(const char *env_var); | ||||
extern int __kmp_aux_set_affinity(void **mask); | extern int __kmp_aux_set_affinity(void **mask); | ||||
extern int __kmp_aux_get_affinity(void **mask); | extern int __kmp_aux_get_affinity(void **mask); | ||||
extern int __kmp_aux_get_affinity_max_proc(); | extern int __kmp_aux_get_affinity_max_proc(); | ||||
extern int __kmp_aux_set_affinity_mask_proc(int proc, void **mask); | extern int __kmp_aux_set_affinity_mask_proc(int proc, void **mask); | ||||
extern int __kmp_aux_unset_affinity_mask_proc(int proc, void **mask); | extern int __kmp_aux_unset_affinity_mask_proc(int proc, void **mask); | ||||
extern int __kmp_aux_get_affinity_mask_proc(int proc, void **mask); | extern int __kmp_aux_get_affinity_mask_proc(int proc, void **mask); | ||||
extern void __kmp_balanced_affinity(kmp_info_t *th, int team_size); | extern void __kmp_balanced_affinity(kmp_info_t *th, int team_size); | ||||
#if KMP_OS_LINUX | #if KMP_OS_LINUX | ||||
extern int kmp_set_thread_affinity_mask_initial(void); | extern int kmp_set_thread_affinity_mask_initial(void); | ||||
#endif | #endif | ||||
#endif /* KMP_AFFINITY_SUPPORTED */ | #endif /* KMP_AFFINITY_SUPPORTED */ | ||||
#if OMP_50_ENABLED | |||||
// No need for KMP_AFFINITY_SUPPORTED guard as only one field in the | |||||
// format string is for affinity, so platforms that do not support | |||||
// affinity can still use the other fields, e.g., %n for num_threads | |||||
extern size_t __kmp_aux_capture_affinity(int gtid, const char *format, | |||||
kmp_str_buf_t *buffer); | |||||
extern void __kmp_aux_display_affinity(int gtid, const char *format); | |||||
#endif | |||||
extern void __kmp_cleanup_hierarchy(); | extern void __kmp_cleanup_hierarchy(); | ||||
extern void __kmp_get_hierarchy(kmp_uint32 nproc, kmp_bstate_t *thr_bar); | extern void __kmp_get_hierarchy(kmp_uint32 nproc, kmp_bstate_t *thr_bar); | ||||
#if KMP_USE_FUTEX | #if KMP_USE_FUTEX | ||||
extern int __kmp_futex_determine_capable(void); | extern int __kmp_futex_determine_capable(void); | ||||
▲ Show 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | extern void __kmp_run_after_invoked_task(int gtid, int tid, | ||||
kmp_info_t *this_thr, | kmp_info_t *this_thr, | ||||
kmp_team_t *team); | kmp_team_t *team); | ||||
// should never have been exported | // should never have been exported | ||||
KMP_EXPORT int __kmpc_invoke_task_func(int gtid); | KMP_EXPORT int __kmpc_invoke_task_func(int gtid); | ||||
#if OMP_40_ENABLED | #if OMP_40_ENABLED | ||||
extern int __kmp_invoke_teams_master(int gtid); | extern int __kmp_invoke_teams_master(int gtid); | ||||
extern void __kmp_teams_master(int gtid); | extern void __kmp_teams_master(int gtid); | ||||
extern int __kmp_aux_get_team_num(); | |||||
extern int __kmp_aux_get_num_teams(); | |||||
#endif | #endif | ||||
extern void __kmp_save_internal_controls(kmp_info_t *thread); | extern void __kmp_save_internal_controls(kmp_info_t *thread); | ||||
extern void __kmp_user_set_library(enum library_type arg); | extern void __kmp_user_set_library(enum library_type arg); | ||||
extern void __kmp_aux_set_library(enum library_type arg); | extern void __kmp_aux_set_library(enum library_type arg); | ||||
extern void __kmp_aux_set_stacksize(size_t arg); | extern void __kmp_aux_set_stacksize(size_t arg); | ||||
extern void __kmp_aux_set_blocktime(int arg, kmp_info_t *thread, int tid); | extern void __kmp_aux_set_blocktime(int arg, kmp_info_t *thread, int tid); | ||||
extern void __kmp_aux_set_defaults(char const *str, int len); | extern void __kmp_aux_set_defaults(char const *str, int len); | ||||
▲ Show 20 Lines • Show All 413 Lines • Show Last 20 Lines |