Changeset View
Changeset View
Standalone View
Standalone View
runtime/src/kmp_csupport.cpp
Show First 20 Lines • Show All 1,861 Lines • ▼ Show 20 Lines | |||||
int ompc_get_ancestor_thread_num(int level) { | int ompc_get_ancestor_thread_num(int level) { | ||||
return __kmp_get_ancestor_thread_num(__kmp_entry_gtid(), level); | return __kmp_get_ancestor_thread_num(__kmp_entry_gtid(), level); | ||||
} | } | ||||
int ompc_get_team_size(int level) { | int ompc_get_team_size(int level) { | ||||
return __kmp_get_team_size(__kmp_entry_gtid(), level); | return __kmp_get_team_size(__kmp_entry_gtid(), level); | ||||
} | } | ||||
#if OMP_50_ENABLED | |||||
/* OpenMP 5.0 Affinity Format API */ | |||||
void ompc_set_affinity_format(char const *format) { | |||||
if (!__kmp_init_serial) { | |||||
__kmp_serial_initialize(); | |||||
} | |||||
__kmp_strncpy_truncate(__kmp_affinity_format, KMP_AFFINITY_FORMAT_SIZE, | |||||
format, KMP_STRLEN(format) + 1); | |||||
} | |||||
size_t ompc_get_affinity_format(char *buffer, size_t size) { | |||||
size_t format_size; | |||||
if (!__kmp_init_serial) { | |||||
__kmp_serial_initialize(); | |||||
} | |||||
format_size = KMP_STRLEN(__kmp_affinity_format); | |||||
if (buffer && size) { | |||||
__kmp_strncpy_truncate(buffer, size, __kmp_affinity_format, | |||||
format_size + 1); | |||||
} | |||||
return format_size; | |||||
} | |||||
void ompc_display_affinity(char const *format) { | |||||
int gtid; | |||||
if (!TCR_4(__kmp_init_middle)) { | |||||
__kmp_middle_initialize(); | |||||
} | |||||
gtid = __kmp_get_gtid(); | |||||
__kmp_aux_display_affinity(gtid, format); | |||||
} | |||||
size_t ompc_capture_affinity(char *buffer, size_t buf_size, | |||||
char const *format) { | |||||
int gtid; | |||||
size_t num_required; | |||||
kmp_str_buf_t capture_buf; | |||||
if (!TCR_4(__kmp_init_middle)) { | |||||
__kmp_middle_initialize(); | |||||
} | |||||
gtid = __kmp_get_gtid(); | |||||
__kmp_str_buf_init(&capture_buf); | |||||
num_required = __kmp_aux_capture_affinity(gtid, format, &capture_buf); | |||||
if (buffer && buf_size) { | |||||
__kmp_strncpy_truncate(buffer, buf_size, capture_buf.str, | |||||
capture_buf.used + 1); | |||||
} | |||||
__kmp_str_buf_free(&capture_buf); | |||||
return num_required; | |||||
} | |||||
#endif /* OMP_50_ENABLED */ | |||||
void kmpc_set_stacksize(int arg) { | void kmpc_set_stacksize(int arg) { | ||||
// __kmp_aux_set_stacksize initializes the library if needed | // __kmp_aux_set_stacksize initializes the library if needed | ||||
__kmp_aux_set_stacksize(arg); | __kmp_aux_set_stacksize(arg); | ||||
} | } | ||||
void kmpc_set_stacksize_s(size_t arg) { | void kmpc_set_stacksize_s(size_t arg) { | ||||
// __kmp_aux_set_stacksize initializes the library if needed | // __kmp_aux_set_stacksize initializes the library if needed | ||||
__kmp_aux_set_stacksize(arg); | __kmp_aux_set_stacksize(arg); | ||||
▲ Show 20 Lines • Show All 2,234 Lines • Show Last 20 Lines |