ARGOBOTS
dce6e727ffc4ca5b3ffc04cb9517c6689be51ec5
|
Go to the documentation of this file.
6 #ifndef ABTI_H_INCLUDED
7 #define ABTI_H_INCLUDED
19 #ifndef ABT_CONFIG_DISABLE_ERROR_CHECK
20 #define ABTI_IS_ERROR_CHECK_ENABLED 1
22 #define ABTI_IS_ERROR_CHECK_ENABLED 0
25 #ifdef ABT_CONFIG_DISABLE_EXT_THREAD
26 #define ABTI_IS_EXT_THREAD_ENABLED 0
28 #define ABTI_IS_EXT_THREAD_ENABLED 1
31 #ifdef ABT_CONFIG_DISABLE_UB_ASSERT
32 #define ABTI_IS_UB_ASSERT_ENABLED 0
34 #define ABTI_IS_UB_ASSERT_ENABLED 1
42 #define ABTI_SCHED_NUM_PRIO 3
44 #define ABTI_SCHED_REQ_FINISH (1 << 0)
45 #define ABTI_SCHED_REQ_EXIT (1 << 1)
46 #define ABTI_SCHED_REQ_REPLACE (1 << 2)
48 #define ABTI_THREAD_REQ_JOIN (1 << 0)
49 #define ABTI_THREAD_REQ_CANCEL (1 << 1)
50 #define ABTI_THREAD_REQ_MIGRATE (1 << 2)
52 #define ABTI_THREAD_INIT_ID 0xFFFFFFFFFFFFFFFF
53 #define ABTI_TASK_INIT_ID 0xFFFFFFFFFFFFFFFF
57 #define ABTI_UNIT_HASH_TABLE_SIZE_EXP 8
58 #define ABTI_UNIT_HASH_TABLE_SIZE ((size_t)(1 << ABTI_UNIT_HASH_TABLE_SIZE_EXP))
60 #define ABTI_STACK_CHECK_TYPE_NONE 0
61 #define ABTI_STACK_CHECK_TYPE_CANARY 1
62 #define ABTI_STACK_CHECK_TYPE_MPROTECT 2
63 #define ABTI_STACK_CHECK_TYPE_MPROTECT_STRICT 3
82 #define ABTI_THREAD_TYPE_EXT ((ABTI_thread_type)0)
83 #define ABTI_THREAD_TYPE_THREAD ((ABTI_thread_type)(0x1 << 0))
84 #define ABTI_THREAD_TYPE_ROOT ((ABTI_thread_type)(0x1 << 1))
85 #define ABTI_THREAD_TYPE_PRIMARY ((ABTI_thread_type)(0x1 << 2))
86 #define ABTI_THREAD_TYPE_MAIN_SCHED ((ABTI_thread_type)(0x1 << 3))
87 #define ABTI_THREAD_TYPE_YIELDABLE ((ABTI_thread_type)(0x1 << 4))
88 #define ABTI_THREAD_TYPE_NAMED ((ABTI_thread_type)(0x1 << 5))
89 #define ABTI_THREAD_TYPE_MIGRATABLE ((ABTI_thread_type)(0x1 << 6))
94 #define ABTI_THREAD_TYPE_MEM_MEMPOOL_DESC ((ABTI_thread_type)(0x1 << 7))
97 #define ABTI_THREAD_TYPE_MEM_MALLOC_DESC ((ABTI_thread_type)(0x1 << 8))
100 #define ABTI_THREAD_TYPE_MEM_MEMPOOL_DESC_STACK ((ABTI_thread_type)(0x1 << 9))
103 #define ABTI_THREAD_TYPE_MEM_MALLOC_DESC_STACK ((ABTI_thread_type)(0x1 << 10))
107 #define ABTI_THREAD_TYPE_MEM_MEMPOOL_DESC_MEMPOOL_LAZY_STACK \
108 ((ABTI_thread_type)(0x1 << 11))
112 #define ABTI_THREAD_TYPE_MEM_MALLOC_DESC_MEMPOOL_LAZY_STACK \
113 ((ABTI_thread_type)(0x1 << 12))
115 #define ABTI_THREAD_TYPES_MEM \
116 (ABTI_THREAD_TYPE_MEM_MEMPOOL_DESC | ABTI_THREAD_TYPE_MEM_MALLOC_DESC | \
117 ABTI_THREAD_TYPE_MEM_MEMPOOL_DESC_STACK | \
118 ABTI_THREAD_TYPE_MEM_MALLOC_DESC_STACK | \
119 ABTI_THREAD_TYPE_MEM_MEMPOOL_DESC_MEMPOOL_LAZY_STACK | \
120 ABTI_THREAD_TYPE_MEM_MALLOC_DESC_MEMPOOL_LAZY_STACK)
123 #define ABTI_MUTEX_ATTR_NONE 0
125 #define ABTI_MUTEX_ATTR_RECURSIVE 1
128 #define ABTI_UNUSED(a) (void)(a)
166 #ifndef ABT_CONFIG_DISABLE_TOOL_INTERFACE
167 typedef struct ABTI_tool_context ABTI_tool_context;
171 struct ABTI_native_thread_id_opaque;
174 struct ABTI_thread_id_opaque;
190 #ifndef ABT_CONFIG_ACTIVE_WAIT_POLICY
208 #ifndef ABT_CONFIG_USE_SIMPLE_MUTEX
248 #ifdef ABT_CONFIG_USE_MEM_POOL
258 #ifndef ABT_CONFIG_DISABLE_EXT_THREAD
270 #ifndef ABT_CONFIG_DISABLE_TOOL_INTERFACE
274 void *tool_thread_user_arg;
290 void *(*get_local_ptr_f)(void);
313 #ifdef ABT_CONFIG_USE_MEM_POOL
339 #ifdef ABT_CONFIG_USE_DEBUG_LOG
442 #ifndef ABT_CONFIG_DISABLE_MIGRATION
522 #ifdef HAVE_PTHREAD_BARRIER_INIT
536 #ifndef ABT_CONFIG_DISABLE_TOOL_INTERFACE
537 struct ABTI_tool_context {
594 int idx,
void *p_val);
622 int key,
void *p_val);
642 void (*thread_func)(
void *),
void *arg,
ABT_unit(* ABT_pool_pop_fn)(ABT_pool)
ABT_task(* ABT_unit_get_task_fn)(ABT_unit)
ABT_pool_user_get_size_fn p_get_size
ABTI_local_func gp_ABTI_local_func
ABT_sched_predef
Predefined scheduler type.
ABTI_mem_pool_local_pool mem_pool_desc_ext
ABTD_atomic_int32 num_blocked
ABT_pool_user_init_fn p_init
ABTD_futex_multiple futex
uint64_t sched_sleep_nsec
ABT_pool_remove_fn p_remove
ABT_unit_create_from_thread_fn symbol
void(* f_migration_cb)(ABT_thread, void *)
struct timespec ABTD_time
int ABT_bool
Boolean type.
ABT_bool ABTI_sched_has_to_stop(ABTI_sched *p_sched)
@ ABTI_XSTREAM_TYPE_PRIMARY
ABTU_ret_err int ABTI_sched_create_basic(ABT_sched_predef predef, int num_pools, ABT_pool *pools, ABTI_sched_config *p_config, ABTI_sched **pp_newsched)
ABT_bool(* ABT_unit_is_in_pool_fn)(ABT_unit)
@ ABTI_STACK_GUARD_MPROTECT_STRICT
ABT_bool ABTI_sched_has_unit(ABTI_sched *p_sched)
void(* ABT_sched_run_fn)(ABT_sched)
struct ABT_thread_opaque * ABT_thread
Work unit handle type.
ABT_pool_user_push_fn p_push
ABT_pool_user_pop_fn p_pop
ABTD_atomic_ptr p_migration_pool
ABTD_spinlock xstream_list_lock
ABT_unit_type(* ABT_unit_get_type_fn)(ABT_unit)
void ABTI_xstream_schedule(void *p_arg)
ABTI_mem_pool_global_pool mem_pool_stack
ABT_pool_user_print_all_fn p_print_all
ABTU_ret_err int ABTI_thread_revive(ABTI_global *p_global, ABTI_local *p_local, ABTI_pool *p_pool, void(*thread_func)(void *), void *arg, ABTI_thread *p_thread)
void ABTI_sched_exit(ABTI_sched *p_sched)
void(* ABT_pool_user_print_all_fn)(ABT_pool, void *arg, void(*)(void *, ABT_thread))
Function that applies a user-given function to all work units in a pool.
ABT_unit(* ABT_pool_user_create_unit_fn)(ABT_pool, ABT_thread)
Function that creates an ABT_unit handle that is associated with an ABT_thread handle.
void ABTI_pool_reset_id(void)
void ABTI_thread_print(ABTI_thread *p_thread, FILE *p_os, int indent)
ABT_unit_create_from_thread_fn u_create_from_thread
ABT_unit(* ABT_pool_pop_wait_fn)(ABT_pool, double)
ABTI_global * gp_ABTI_global
ABTD_atomic_uint32 request
ABTI_mem_pool_local_pool mem_pool_stack
ABT_unit_id ABTI_thread_get_id(ABTI_thread *p_thread)
#define ABTD_XSTREAM_LOCAL
void ABTI_thread_free(ABTI_global *p_global, ABTI_local *p_local, ABTI_thread *p_thread)
ABTU_ret_err int ABTI_ythread_create_primary(ABTI_global *p_global, ABTI_local *p_local, ABTI_xstream *p_xstream, ABTI_ythread **p_ythread)
ABT_unit(* ABT_pool_pop_timedwait_fn)(ABT_pool, double)
void ABTI_unit_unmap_thread(ABTI_global *p_global, ABT_unit unit)
ABT_sched_type
Scheduler's work unit type.
int(* ABT_pool_print_all_fn)(ABT_pool, void *arg, void(*)(void *, ABT_unit))
void(* ABT_pool_user_push_many_fn)(ABT_pool, const ABT_unit *, size_t, ABT_pool_context)
Function that pushes work units to a pool.
ABT_pool_user_free_unit_fn p_free_unit
struct ABT_pool_opaque * ABT_pool
Pool handle type.
ABTI_stack_guard stack_guard_kind
void ABTI_thread_attr_print(ABTI_thread_attr *p_attr, FILE *p_os, int indent)
size_t(* ABT_pool_user_get_size_fn)(ABT_pool)
Function that returns the number of work units in a pool.
ABT_pool_pop_timedwait_fn p_pop_timedwait
void(* ABT_pool_user_push_fn)(ABT_pool, ABT_unit, ABT_pool_context)
Function that pushes a work unit to a pool.
void(* ABT_unit_free_fn)(ABT_unit *)
ABT_pool_access dummy_access
ABT_sched_def * ABTI_sched_get_basic_wait_def(void)
void ABTI_pool_free(ABTI_pool *p_pool)
void ABTI_info_check_print_all_thread_stacks(void)
void ABTI_ythread_free_root(ABTI_global *p_global, ABTI_local *p_local, ABTI_ythread *p_ythread)
uint64_t ABT_unit_id
Work unit ID type.
A struct that defines a pool.
ABTI_unit_to_thread_entry unit_to_thread_entires[ABTI_UNIT_HASH_TABLE_SIZE]
int(* ABT_pool_remove_fn)(ABT_pool, ABT_unit)
int(* ABT_pool_init_fn)(ABT_pool, ABT_pool_config)
ABT_unit_is_in_pool_fn u_is_in_pool
void ABTI_xstream_free(ABTI_global *p_global, ABTI_local *p_local, ABTI_xstream *p_xstream, ABT_bool force_free)
void ABTI_sched_finish(ABTI_sched *p_sched)
ABTI_pool_optional_def optional_def
ABTU_ret_err int ABTI_pool_get_randws_def(ABT_pool_access access, ABTI_pool_required_def *p_required_def, ABTI_pool_optional_def *p_optional_def, ABTI_pool_deprecated_def *p_deprecated_def)
void ABTI_unit_finalize_hash_table(ABTI_global *p_global)
ABTU_ret_err int ABTI_pool_create_basic(ABT_pool_kind kind, ABT_pool_access access, ABT_bool automatic, ABTI_pool **pp_newpool)
ABTI_sched * p_main_sched
ABT_unit_get_type_fn dummy_fn1
int(* ABT_sched_init_fn)(ABT_sched, ABT_sched_config)
void * p_migration_cb_arg
ABTU_ret_err int ABTI_thread_handle_request_migrate(ABTI_global *p_global, ABTI_local *p_local, ABTI_thread *p_thread)
ABTU_ret_err int ABTI_sched_get_migration_pool(ABTI_sched *, ABTI_pool *, ABTI_pool **)
ABT_sched_get_migr_pool_fn get_migr_pool
uint32_t sched_event_freq
ABT_pool_user_pop_wait_fn p_pop_wait
@ ABTI_XSTREAM_TYPE_SECONDARY
void ABTI_sched_reset_id(void)
void ABTI_thread_join(ABTI_local **pp_local, ABTI_thread *p_thread)
ABT_sched_def * ABTI_sched_get_basic_def(void)
ABTU_ret_err int ABTI_sched_config_read(const ABTI_sched_config *p_config, int idx, void *p_val)
struct ABT_unit_opaque * ABT_unit
Work unit handle type for scheduling.
void(* ABT_pool_user_pop_many_fn)(ABT_pool, ABT_thread *, size_t, size_t *, ABT_pool_context)
Function that pops work units from a pool.
ABT_sched_def * ABTI_sched_get_randws_def(void)
ABTI_mem_pool_local_pool mem_pool_stack_ext
ABTD_spinlock waiter_lock
pthread_barrier_t ABTD_xstream_barrier
void ABTI_xstream_print(ABTI_xstream *p_xstream, FILE *p_os, int indent, ABT_bool print_sub)
uint32_t mutex_max_handovers
ABT_bool ABTI_initialized(void)
ABTI_mutex * p_waiter_mutex
ABTI_sched * p_replace_sched
ABTD_atomic_int is_in_pool
ABT_unit_get_thread_fn dummy_fn2
#define ABT_CONFIG_STATIC_CACHELINE_SIZE
ABTI_thread * ABTI_unit_get_thread_from_user_defined_unit(ABTI_global *p_global, ABT_unit unit)
ABTU_ret_err int ABTI_pool_get_fifo_wait_def(ABT_pool_access access, ABTI_pool_required_def *p_required_def, ABTI_pool_optional_def *p_optional_def, ABTI_pool_deprecated_def *p_deprecated_def)
void ABTI_unit_init_hash_table(ABTI_global *p_global)
ABTI_ythread * p_primary_ythread
ABT_unit_is_in_pool_fn dummy_fn4
ABT_thread(* ABT_pool_user_pop_wait_fn)(ABT_pool, double, ABT_pool_context)
Function that pops a work unit from a pool with wait.
char padding2[ABT_CONFIG_STATIC_CACHELINE_SIZE]
void ABTI_xstream_check_events(ABTI_xstream *p_xstream, ABTI_sched *p_sched)
char padding1[ABT_CONFIG_STATIC_CACHELINE_SIZE]
struct ABTI_thread_id_opaque * ABTI_thread_id
void(* ABT_pool_user_free_fn)(ABT_pool)
Function that frees a pool.
ABTI_xstream * p_xstream_head
ABTI_mem_pool_local_pool mem_pool_desc
ABT_thread(* ABT_unit_get_thread_fn)(ABT_unit)
ABTI_pool_required_def required_def
ABT_pool_user_push_many_fn p_push_many
ABTI_pool_deprecated_def deprecated_def
void(* set_local_xstream_f)(ABTI_xstream *)
@ ABTI_STACK_GUARD_MPROTECT
ABTU_ret_err int ABTI_thread_attr_dup(const ABTI_thread_attr *p_attr, ABTI_thread_attr **pp_dup_attr) ABTU_ret_err
uint32_t mutex_max_wakeups
void(* ABT_pool_push_fn)(ABT_pool, ABT_unit)
uint32_t ABTI_thread_type
ABTD_atomic_uint32 request
void ABTI_xstream_start_primary(ABTI_global *p_global, ABTI_xstream **pp_local_xstream, ABTI_xstream *p_xstream, ABTI_ythread *p_ythread)
ABTU_ret_err int ABTI_ythread_create_root(ABTI_global *p_global, ABTI_local *p_local, ABTI_xstream *p_xstream, ABTI_ythread **pp_root_ythread)
void(* ABT_pool_user_free_unit_fn)(ABT_pool, ABT_unit)
Function that frees an ABT_unit handle.
ABTI_ythread * p_root_ythread
uintptr_t ABTI_sched_kind
ABTI_atomic_unit_to_thread list
ABTI_pool_old_def old_def
void ABTI_ythread_free_primary(ABTI_global *p_global, ABTI_local *p_local, ABTI_ythread *p_ythread)
ABT_pool_user_pop_many_fn p_pop_many
ABT_bool(* ABT_pool_user_is_empty_fn)(ABT_pool)
Function that returns if a pool is empty.
ABT_pool_pop_wait_fn p_pop_wait
void(* f_destructor)(void *value)
void ABTI_thread_handle_request_cancel(ABTI_global *p_global, ABTI_xstream *p_local_xstream, ABTI_thread *p_thread)
A struct that defines a scheduler.
ABTD_XSTREAM_LOCAL ABTI_local * lp_ABTI_local
ABT_thread(* ABT_pool_user_pop_fn)(ABT_pool, ABT_pool_context)
Function that pops a work unit from a pool.
ABTU_ret_err int ABTI_pool_config_read(const ABTI_pool_config *p_config, int key, void *p_val)
ABTU_ret_err int ABTI_pool_get_fifo_def(ABT_pool_access access, ABTI_pool_required_def *p_required_def, ABTI_pool_optional_def *p_optional_def, ABTI_pool_deprecated_def *p_deprecated_def)
ABTU_ret_err int ABTI_ythread_create_main_sched(ABTI_global *p_global, ABTI_local *p_local, ABTI_xstream *p_xstream, ABTI_sched *p_sched)
#define ABTI_UNIT_HASH_TABLE_SIZE
ABT_pool(* ABT_sched_get_migr_pool_fn)(ABT_sched)
ABTI_xstream * p_last_xstream
ABTD_spinlock mem_pool_desc_lock
size_t(* ABT_pool_get_size_fn)(ABT_pool)
void ABTI_sched_free(ABTI_global *p_global, ABTI_local *p_local, ABTI_sched *p_sched, ABT_bool force_free)
ABTD_atomic_ptr p_keytable
ABTU_ret_err int ABTI_thread_get_mig_data(ABTI_global *p_global, ABTI_local *p_local, ABTI_thread *p_thread, ABTI_thread_mig_data **pp_mig_data)
ABT_pool_print_all_fn p_print_all
ABTD_spinlock mem_pool_stack_lock
struct ABTI_local ABTI_local
ABTU_align_member_var(ABT_CONFIG_STATIC_CACHELINE_SIZE) ABTI_thread *p_thread
void(* f_cb)(ABT_thread, void *)
int(* ABT_pool_free_fn)(ABT_pool)
ABTD_atomic_ptr p_elems[1]
ABTI_pool_required_def required_def
void ABTI_pool_print(ABTI_pool *p_pool, FILE *p_os, int indent)
int(* ABT_pool_user_init_fn)(ABT_pool, ABT_pool_config)
Function that creates a pool.
ABT_unit_get_task_fn dummy_fn3
void ABTI_ktable_free(ABTI_global *p_global, ABTI_local *p_local, ABTI_ktable *p_ktable)
void ABTI_thread_reset_id(void)
void(* ABT_tool_thread_callback_fn)(ABT_thread, ABT_xstream, uint64_t event, ABT_tool_context context, void *user_arg)
ABTI_pool_optional_def optional_def
ABTU_ret_err int ABTI_ythread_create_sched(ABTI_global *p_global, ABTI_local *p_local, ABTI_pool *p_pool, ABTI_sched *p_sched)
struct ABTI_native_thread_id_opaque * ABTI_native_thread_id
ABT_pool_user_is_empty_fn p_is_empty
ABTU_ret_err int ABTI_unit_map_thread(ABTI_global *p_global, ABT_unit unit, ABTI_thread *p_thread)
int(* ABT_sched_free_fn)(ABT_sched)
ABTU_ret_err int ABTI_xstream_create_primary(ABTI_global *p_global, ABTI_xstream **pp_xstream)
ABT_bool ABTI_pool_user_def_is_new(const ABT_pool_user_def def)
ABT_pool_kind
Predefined pool type.
void(* p_callback)(void **arg)
ABTI_ythread * p_replace_waiter
ABTD_atomic_int32 num_scheds
void ABTI_ythread_print_stack(ABTI_global *p_global, ABTI_ythread *p_ythread, FILE *p_os)
ABT_pool_user_create_unit_fn p_create_unit
ABTI_mem_pool_global_pool mem_pool_desc
ABT_pool_get_size_fn p_get_size
ABT_pool_user_free_fn p_free
void ABTI_info_print_config(ABTI_global *p_global, FILE *fp)
ABT_sched_def * ABTI_sched_get_prio_def(void)
void(* f_destructor)(void *value)
ABT_unit(* ABT_unit_create_from_thread_fn)(ABT_thread)
ABT_pool_access
Pool access type.
void ABTI_sched_print(ABTI_sched *p_sched, FILE *p_os, int indent, ABT_bool print_sub)