12 FILE *fp,
double timeout,
void (*cb_func)(
ABT_bool,
void *),
void *arg);
220 #ifndef ABT_CONFIG_ENABLE_VER_20_API
222 ABTI_SETUP_GLOBAL(NULL);
224 switch (query_kind) {
226 ABTI_global *p_global = ABTI_global_get_global_or_null();
228 *((
ABT_bool *)val) = p_global->use_debug;
230 *((
ABT_bool *)val) = ABTD_env_get_use_debug();
234 #ifdef ABT_CONFIG_PRINT_ABT_ERRNO
241 ABTI_global *p_global = ABTI_global_get_global_or_null();
243 *((
ABT_bool *)val) = p_global->use_logging;
245 *((
ABT_bool *)val) = ABTD_env_get_use_logging();
249 #ifdef HAVE_VALGRIND_SUPPORT
256 #ifndef ABT_CONFIG_DISABLE_ERROR_CHECK
269 #if !defined(ABTD_FCONTEXT_PRESERVE_FPU) && defined(ABT_CONFIG_USE_FCONTEXT)
277 #ifndef ABT_CONFIG_DISABLE_CANCELLATION
284 #ifndef ABT_CONFIG_DISABLE_CANCELLATION
291 #ifndef ABT_CONFIG_DISABLE_MIGRATION
301 #ifndef ABT_CONFIG_DISABLE_EXT_THREAD
308 #ifdef ABT_CONFIG_USE_SCHED_SLEEP
315 ABTI_global *p_global = ABTI_global_get_global_or_null();
317 *((
ABT_bool *)val) = p_global->print_config;
319 *((
ABT_bool *)val) = ABTD_env_get_print_config();
323 ABTI_global *p_global;
325 ABTI_SETUP_GLOBAL(&p_global);
326 *((
ABT_bool *)val) = p_global->set_affinity;
329 ABTI_global *p_global = ABTI_global_get_global_or_null();
331 *((
unsigned int *)val) = p_global->max_xstreams;
333 *((
unsigned int *)val) = ABTD_env_get_max_xstreams();
337 ABTI_global *p_global = ABTI_global_get_global_or_null();
339 *((
size_t *)val) = p_global->thread_stacksize;
341 *((
size_t *)val) = ABTD_env_get_thread_stacksize();
345 ABTI_global *p_global = ABTI_global_get_global_or_null();
347 *((
size_t *)val) = p_global->sched_stacksize;
349 *((
size_t *)val) = ABTD_env_get_sched_stacksize();
353 ABTI_global *p_global = ABTI_global_get_global_or_null();
355 *((uint64_t *)val) = p_global->sched_event_freq;
357 *((uint64_t *)val) = ABTD_env_get_sched_event_freq();
361 ABTI_global *p_global = ABTI_global_get_global_or_null();
363 *((uint64_t *)val) = p_global->sched_sleep_nsec;
365 *((uint64_t *)val) = ABTD_env_get_sched_sleep_nsec();
369 #ifndef ABT_CONFIG_DISABLE_TOOL_INTERFACE
376 #ifdef ABT_CONFIG_USE_FCONTEXT
386 #ifdef ABT_CONFIG_ENABLE_STACK_UNWIND
393 ABTI_global *p_global = ABTI_global_get_global_or_null();
395 if (p_global->stack_guard_kind == ABTI_STACK_GUARD_MPROTECT) {
397 }
else if (p_global->stack_guard_kind ==
398 ABTI_STACK_GUARD_MPROTECT_STRICT) {
401 #if ABT_CONFIG_STACK_CHECK_TYPE == ABTI_STACK_CHECK_TYPE_CANARY
409 if (ABTD_env_get_stack_guard_mprotect(&is_strict)) {
416 #if ABT_CONFIG_STACK_CHECK_TYPE == ABTI_STACK_CHECK_TYPE_CANARY
425 #if ABT_CONFIG_ACTIVE_WAIT_POLICY
432 #ifdef ABT_CONFIG_DISABLE_LAZY_STACK_ALLOC
477 ABTI_global *p_global;
478 #ifndef ABT_CONFIG_ENABLE_VER_20_API
480 ABTI_SETUP_GLOBAL(&p_global);
482 p_global = ABTI_global_get_global_or_null();
484 fprintf(fp,
"Argobots is not initialized.\n");
489 ABTI_info_print_config(p_global, fp);
526 ABTI_global *p_global;
527 #ifndef ABT_CONFIG_ENABLE_VER_20_API
529 ABTI_SETUP_GLOBAL(&p_global);
531 p_global = ABTI_global_get_global_or_null();
533 fprintf(fp,
"Argobots is not initialized.\n");
539 ABTD_spinlock_acquire(&p_global->xstream_list_lock);
541 fprintf(fp,
"# of created ESs: %d\n", p_global->num_xstreams);
543 ABTI_xstream *p_xstream = p_global->p_xstream_head;
545 ABTI_xstream_print(p_xstream, fp, 0,
ABT_FALSE);
546 p_xstream = p_xstream->p_next;
549 ABTD_spinlock_release(&p_global->xstream_list_lock);
589 ABTI_xstream *p_xstream = ABTI_xstream_get_ptr(xstream);
590 #ifndef ABT_CONFIG_ENABLE_VER_20_API
592 ABTI_CHECK_NULL_XSTREAM_PTR(p_xstream);
594 ABTI_xstream_print(p_xstream, fp, 0,
ABT_FALSE);
632 ABTI_sched *p_sched = ABTI_sched_get_ptr(sched);
633 #ifndef ABT_CONFIG_ENABLE_VER_20_API
635 ABTI_CHECK_NULL_SCHED_PTR(p_sched);
637 ABTI_sched_print(p_sched, fp, 0,
ABT_TRUE);
675 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
676 #ifndef ABT_CONFIG_ENABLE_VER_20_API
678 ABTI_CHECK_NULL_POOL_PTR(p_pool);
680 ABTI_pool_print(p_pool, fp, 0);
722 ABTI_thread *p_thread = ABTI_thread_get_ptr(thread);
723 #ifndef ABT_CONFIG_ENABLE_VER_20_API
725 ABTI_CHECK_NULL_THREAD_PTR(p_thread);
727 ABTI_thread_print(p_thread, fp, 0);
765 ABTI_thread_attr *p_attr = ABTI_thread_attr_get_ptr(attr);
766 #ifndef ABT_CONFIG_ENABLE_VER_20_API
768 ABTI_CHECK_NULL_THREAD_ATTR_PTR(p_attr);
770 ABTI_thread_attr_print(p_attr, fp, 0);
813 ABTI_thread *p_thread = ABTI_thread_get_ptr(task);
814 #ifndef ABT_CONFIG_ENABLE_VER_20_API
816 ABTI_CHECK_NULL_TASK_PTR(p_thread);
818 ABTI_thread_print(p_thread, fp, 0);
864 ABTI_thread *p_thread = ABTI_thread_get_ptr(thread);
865 #ifndef ABT_CONFIG_ENABLE_VER_20_API
867 ABTI_CHECK_NULL_THREAD_PTR(p_thread);
870 fprintf(fp,
"no stack\n");
873 if (p_thread->type & ABTI_THREAD_TYPE_YIELDABLE) {
874 ABTI_global *p_global = ABTI_global_get_global_or_null();
876 fprintf(fp,
"Argobots is not initialized.\n");
879 ABTI_ythread *p_ythread = ABTI_thread_get_ythread(p_thread);
880 ABTI_ythread_print_stack(p_global, p_ythread, fp);
883 fprintf(fp,
"no stack\n");
926 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
927 #ifndef ABT_CONFIG_ENABLE_VER_20_API
929 ABTI_CHECK_NULL_POOL_PTR(p_pool);
931 ABTI_global *p_global = ABTI_global_get_global_or_null();
933 fprintf(fp,
"Argobots is not initialized.\n");
937 ABTI_CHECK_ERROR(abt_errno);
1022 #define PRINT_STACK_FLAG_UNSET 0
1023 #define PRINT_STACK_FLAG_INITIALIZE 1
1024 #define PRINT_STACK_FLAG_WAIT 2
1025 #define PRINT_STACK_FLAG_FINALIZE 3
1034 ABTD_ATOMIC_INT_STATIC_INITIALIZER(0);
1036 void ABTI_info_check_print_all_thread_stacks(
void)
1044 if (self_value == 0) {
1045 ABTI_global *p_global = ABTI_global_get_global();
1047 double start_time = ABTI_get_wtime();
1052 ABTD_spinlock_acquire(&p_global->xstream_list_lock);
1055 p_global->num_xstreams) {
1063 ABTD_spinlock_release(&p_global->xstream_list_lock);
1064 ABTD_atomic_pause();
1065 ABTD_spinlock_acquire(&p_global->xstream_list_lock);
1072 "ABT_info_trigger_print_all_thread_stacks: "
1073 "timeout (only %d ESs stop)\n",
1077 if (ABTI_IS_ERROR_CHECK_ENABLED && abt_errno !=
ABT_SUCCESS) {
1078 fprintf(
print_stack_fp,
"ABT_info_trigger_print_all_thread_stacks: "
1079 "failed because of an internal error.\n");
1083 ABTD_spinlock_release(&p_global->xstream_list_lock);
1093 ABTD_atomic_pause();
1100 if (dec_value == 0) {
1107 void ABTI_info_print_config(ABTI_global *p_global, FILE *fp)
1109 fprintf(fp,
"Argobots Configuration:\n");
1111 fprintf(fp,
" - # of cores: %d\n", p_global->num_cores);
1113 fprintf(fp,
" - huge page size: %zu B\n", p_global->huge_page_size);
1114 fprintf(fp,
" - max. # of ESs: %d\n", p_global->max_xstreams);
1115 fprintf(fp,
" - cur. # of ESs: %d\n", p_global->num_xstreams);
1116 fprintf(fp,
" - ES affinity: %s\n",
1117 (p_global->set_affinity ==
ABT_TRUE) ?
"on" :
"off");
1118 fprintf(fp,
" - logging: %s\n",
1119 (p_global->use_logging ==
ABT_TRUE) ?
"on" :
"off");
1120 fprintf(fp,
" - debug output: %s\n",
1121 (p_global->use_debug ==
ABT_TRUE) ?
"on" :
"off");
1122 fprintf(fp,
" - print errno: "
1123 #ifdef ABT_CONFIG_PRINT_ABT_ERRNO
1129 fprintf(fp,
" - valgrind support: "
1130 #ifdef HAVE_VALGRIND_SUPPORT
1136 fprintf(fp,
" - thread cancellation: "
1137 #ifndef ABT_CONFIG_DISABLE_CANCELLATION
1143 fprintf(fp,
" - thread migration: "
1144 #ifndef ABT_CONFIG_DISABLE_MIGRATION
1150 fprintf(fp,
" - external thread: "
1151 #ifndef ABT_CONFIG_DISABLE_EXT_THREAD
1157 fprintf(fp,
" - error check: "
1158 #ifndef ABT_CONFIG_DISABLE_ERROR_CHECK
1164 fprintf(fp,
" - tool interface: "
1171 fprintf(fp,
" - wait policy: "
1172 #ifdef ABT_CONFIG_ACTIVE_WAIT_POLICY
1178 fprintf(fp,
" - context-switch: "
1181 #ifndef ABTD_FCONTEXT_PRESERVE_FPU
1189 fprintf(fp,
" - key table entries: %" PRIu32
"\n",
1190 p_global->key_table_size);
1191 fprintf(fp,
" - default ULT stack size: %zu KB\n",
1192 p_global->thread_stacksize / 1024);
1193 fprintf(fp,
" - default scheduler stack size: %zu KB\n",
1194 p_global->sched_stacksize / 1024);
1195 fprintf(fp,
" - default scheduler event check frequency: %u\n",
1196 p_global->sched_event_freq);
1197 fprintf(fp,
" - default scheduler sleep: "
1198 #ifdef ABT_CONFIG_USE_SCHED_SLEEP
1204 fprintf(fp,
" - default scheduler sleep duration : %" PRIu64
" [ns]\n",
1205 p_global->sched_sleep_nsec);
1207 fprintf(fp,
" - timer function: "
1210 #elif defined(ABT_CONFIG_USE_MACH_ABSOLUTE_TIME)
1211 "mach_absolute_time"
1212 #elif defined(ABT_CONFIG_USE_GETTIMEOFDAY)
1217 #ifdef ABT_CONFIG_USE_MEM_POOL
1218 fprintf(fp,
"Memory Pool:\n");
1219 fprintf(fp,
" - page size for allocation: %zu KB\n",
1220 p_global->mem_page_size / 1024);
1221 fprintf(fp,
" - stack page size: %zu KB\n", p_global->mem_sp_size / 1024);
1222 fprintf(fp,
" - max. # of stacks per ES: %u\n", p_global->mem_max_stacks);
1223 fprintf(fp,
" - max. # of descs per ES: %u\n", p_global->mem_max_descs);
1224 switch (p_global->mem_lp_alloc) {
1225 case ABTI_MEM_LP_MALLOC:
1226 fprintf(fp,
" - large page allocation: malloc\n");
1228 case ABTI_MEM_LP_MMAP_RP:
1229 fprintf(fp,
" - large page allocation: mmap regular pages\n");
1231 case ABTI_MEM_LP_MMAP_HP_RP:
1232 fprintf(fp,
" - large page allocation: mmap huge pages + "
1235 case ABTI_MEM_LP_MMAP_HP_THP:
1236 fprintf(fp,
" - large page allocation: mmap huge pages + THPs\n");
1238 case ABTI_MEM_LP_THP:
1239 fprintf(fp,
" - large page allocation: THPs\n");
1268 FILE *
fp = p_arg->
fp;
1269 ABTI_thread *p_thread = ABTI_thread_get_ptr(thread);
1272 fprintf(
fp,
"=== unknown (%p) ===\n", (
void *)thread);
1273 }
else if (p_thread->type & ABTI_THREAD_TYPE_YIELDABLE) {
1274 fprintf(
fp,
"=== ULT (%p) ===\n", (
void *)thread);
1275 ABTI_ythread *p_ythread = ABTI_thread_get_ythread(p_thread);
1276 ABT_unit_id thread_id = ABTI_thread_get_id(&p_ythread->thread);
1278 "id : %" PRIu64
"\n"
1280 (uint64_t)thread_id, (
void *)&p_ythread->ctx);
1281 ABTI_ythread_print_stack(p_arg->
p_global, p_ythread,
fp);
1283 fprintf(
fp,
"=== tasklet (%p) ===\n", (
void *)thread);
1291 if (p_pool == NULL) {
1292 fprintf(
fp,
"== NULL pool ==\n");
1296 ABTI_CHECK_TRUE(p_pool->optional_def.p_print_all,
ABT_ERR_POOL);
1298 ABT_pool pool = ABTI_pool_get_handle(p_pool);
1300 fprintf(
fp,
"== pool (%p) ==\n", (
void *)p_pool);
1312 size_t default_len = 16;
1315 ABTI_CHECK_ERROR(abt_errno);
1317 p_set->
len = default_len;
1330 for (i = 0; i < p_set->
num; i++) {
1331 if (p_set->
pools[i] == pool)
1335 if (p_set->
num == p_set->
len) {
1336 size_t new_len = p_set->
len * 2;
1340 ABTI_CHECK_ERROR(abt_errno);
1341 p_set->
len = new_len;
1348 FILE *
fp,
double timeout,
void (*cb_func)(
ABT_bool,
void *),
void *arg)
1376 struct tm *tm = NULL;
1380 ABTI_CHECK_ERROR(abt_errno);
1381 ABTI_xstream *p_xstream = p_global->p_xstream_head;
1384 tm = localtime(&seconds);
1385 ABTI_ASSERT(tm != NULL);
1386 fprintf(fp,
"Start of ULT stacks dump %04d/%02d/%02d-%02d:%02d:%02d\n",
1387 tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour,
1388 tm->tm_min, tm->tm_sec);
1391 ABTI_sched *p_main_sched = p_xstream->p_main_sched;
1392 fprintf(fp,
"= xstream[%d] (%p) =\n", p_xstream->rank,
1394 fprintf(fp,
"main_sched : %p\n", (
void *)p_main_sched);
1397 for (i = 0; i < p_main_sched->num_pools; i++) {
1398 ABT_pool pool = p_main_sched->pools[i];
1400 fprintf(fp,
" pools[%zu] : %p\n", i,
1401 (
void *)ABTI_pool_get_ptr(pool));
1403 if (ABTI_IS_ERROR_CHECK_ENABLED && abt_errno !=
ABT_SUCCESS) {
1405 ABTI_HANDLE_ERROR(abt_errno);
1408 p_xstream = p_xstream->p_next;
1410 for (i = 0; i < pool_set.num; i++) {
1412 ABTI_pool *p_pool = ABTI_pool_get_ptr(pool);
1415 fprintf(fp,
" Failed to print (errno = %d).\n", abt_errno);
1419 tm = localtime(&seconds);
1420 ABTI_ASSERT(tm != NULL);
1421 fprintf(fp,
"End of ULT stacks dump %04d/%02d/%02d-%02d:%02d:%02d\n",
1422 tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour,
1423 tm->tm_min, tm->tm_sec);