ARGOBOTS
dce6e727ffc4ca5b3ffc04cb9517c6689be51ec5
|
Go to the documentation of this file.
23 size_t len,
size_t *num,
117 #ifndef ABT_CONFIG_ENABLE_VER_20_API
134 p_deprecated_def = NULL;
145 &optional_def, &deprecated_def);
146 p_required_def = &required_def;
147 p_optional_def = &optional_def;
148 p_deprecated_def = &deprecated_def;
149 p_old_def = &old_def;
156 pool_create(access, p_required_def, p_optional_def, p_deprecated_def,
157 p_old_def, p_config, def_automatic,
ABT_FALSE, &p_newpool);
228 #ifndef ABT_CONFIG_ENABLE_VER_20_API
881 *p_unit = p_thread->
unit;
950 *p_unit = p_thread->
unit;
1023 *p_unit = p_thread->
unit;
1331 #ifndef ABT_CONFIG_ENABLE_VER_20_API
1338 #ifndef ABT_CONFIG_ENABLE_VER_20_API
1380 *
id = (int)p_pool->
id;
1407 &optional_def, &deprecated_def);
1412 &optional_def, &deprecated_def);
1426 pool_create(access, &required_def, &optional_def, &deprecated_def, NULL,
1427 NULL, automatic,
ABT_TRUE, pp_newpool);
1460 if (p_pool == NULL) {
1461 fprintf(p_os,
"%*s== NULL POOL ==\n", indent,
"");
1465 switch (p_pool->
access) {
1487 "%*s== POOL (%p) ==\n"
1488 "%*sid : %" PRIu64
"\n"
1490 "%*sautomatic : %s\n"
1491 "%*snum_scheds : %d\n"
1492 "%*sis_empty : %s\n"
1494 "%*snum_blocked : %d\n"
1496 indent,
"", (
void *)p_pool, indent,
"", p_pool->
id, indent,
"",
1498 (p_pool->automatic ==
ABT_TRUE) ?
"TRUE" :
"FALSE", indent,
"",
1595 size_t max_threads,
size_t *num_popped,
1601 for (i = 0; i < max_threads; i++) {
1620 for (i = 0; i < num_units; i++) {
1648 #ifdef ABT_CONFIG_ENABLE_VER_20_API
1697 ABT_bool automatic = def_automatic;
1699 int automatic_val = 0;
1708 p_pool->access = access;
1709 p_pool->automatic = automatic;
1710 p_pool->is_builtin = is_builtin;
1713 p_pool->data = NULL;
1714 memcpy(&p_pool->required_def, p_required_def,
1716 if (p_optional_def) {
1717 memcpy(&p_pool->optional_def, p_optional_def,
1722 if (p_deprecated_def) {
1723 memcpy(&p_pool->deprecated_def, p_deprecated_def,
1736 if (p_pool->optional_def.p_init) {
1745 *pp_newpool = p_pool;
1767 size_t len,
size_t *num,
1817 ABT_unit *push_units, push_units_buffer[64];
1818 if (num >
sizeof(push_units_buffer) /
sizeof(push_units_buffer[0])) {
1823 push_units = push_units_buffer;
1826 size_t i, num_units = 0;
1827 for (i = 0; i < num; i++) {
1835 if (push_units != push_units_buffer)
1839 push_units[num_units++] = p_thread->
unit;
1842 if (num_units > 0) {
1845 if (push_units != push_units_buffer)
int ABT_pool_pop_thread(ABT_pool pool, ABT_thread *thread)
Pop a work unit from a pool.
ABT_pool_user_get_size_fn p_get_size
#define ABTI_CHECK_NULL_SCHED_PTR(p)
static ABTI_sched * ABTI_sched_get_ptr(ABT_sched sched)
int ABT_pool_get_data(ABT_pool pool, void **data)
Retrieve user data from a pool.
ABT_pool_user_init_fn p_init
int ABT_pool_pop_wait(ABT_pool pool, ABT_unit *p_unit, double time_secs)
Pop a unit from a pool with wait.
ABT_pool_remove_fn p_remove
int ABT_bool
Boolean type.
int ABT_pool_get_size(ABT_pool pool, size_t *size)
Get the size of a pool.
int ABT_pool_print_all_threads(ABT_pool pool, void *arg, void(*print_fn)(void *arg, ABT_thread))
Apply a print function to every work unit in a pool.
static ABT_thread pool_pop_wrapper(ABT_pool pool, ABT_pool_context context)
uint64_t ABT_pool_context
A pool context value.
static ABT_unit pool_create_unit_wrapper(ABT_pool pool, ABT_thread thread)
int ABT_pool_add_sched(ABT_pool pool, ABT_sched sched)
Create a new work unit associated with a scheduler and push it to a pool.
struct ABT_thread_opaque * ABT_thread
Work unit handle type.
ABT_pool_user_push_fn p_push
ABT_pool_user_pop_fn p_pop
#define ABTI_SETUP_GLOBAL(pp_global)
int ABT_pool_is_empty(ABT_pool pool, ABT_bool *is_empty)
Check if a pool is empty.
static ABTU_ret_err int ABTI_unit_set_associated_pool(ABTI_global *p_global, ABT_unit unit, ABTI_pool *p_pool, ABTI_thread **pp_thread)
#define ABT_POOL_CONTEXT_OP_POOL_OTHER
A flag that hints an unspecified pool operation.
ABT_pool_user_print_all_fn p_print_all
static ABTI_global * ABTI_global_get_global(void)
#define ABT_ERR_POOL
Error code: error related to a pool.
ABT_unit_create_from_thread_fn u_create_from_thread
static ABTI_pool_user_def * ABTI_pool_user_def_get_ptr(ABT_pool_user_def def)
#define ABTI_CHECK_ERROR(abt_errno)
static ABT_thread pool_pop_wait_wrapper(ABT_pool pool, double time_secs, ABT_pool_context context)
ABT_unit_free_fn u_free
Function that frees a work unit.
static int pool_pop_threads_ex(ABT_pool pool, ABT_thread *threads, size_t len, size_t *num, ABT_pool_context pool_ctx)
static void pool_push_wrapper(ABT_pool pool, ABT_unit unit, ABT_pool_context context)
static int pool_push_thread_ex(ABT_pool pool, ABT_thread thread, ABT_pool_context pool_ctx)
int ABT_pool_push_threads(ABT_pool pool, const ABT_thread *threads, size_t num)
Push work units to a pool.
static size_t ABTI_pool_get_size(ABTI_pool *p_pool)
void(* print_fn)(void *, ABT_thread)
ABT_pool_remove_fn p_remove
Function that removes a work unit from a pool.
static ABT_thread ABTI_thread_get_handle(ABTI_thread *p_thread)
static ABTU_ret_err int ABTI_thread_set_associated_pool(ABTI_global *p_global, ABTI_thread *p_thread, ABTI_pool *p_pool)
static void ABTD_atomic_release_store_int32(ABTD_atomic_int32 *ptr, int32_t val)
ABT_unit_is_in_pool_fn u_is_in_pool
Function that returns whether a work unit is in its associated pool or not.
ABT_thread ABTI_pool_pop_timedwait(ABTI_pool *p_pool, double abstime_secs)
ABT_pool_user_free_unit_fn p_free_unit
struct ABT_pool_opaque * ABT_pool
Pool handle type.
#define ABTI_CHECK_NULL_POOL_USER_DEF_PTR(p)
static void pool_print_thread_to_unit(void *arg, ABT_thread thread)
static ABT_bool pool_is_empty_wrapper(ABT_pool pool)
static ABT_thread ABTI_pool_pop(ABTI_pool *p_pool, ABT_pool_context context)
ABT_pool_pop_timedwait_fn p_pop_timedwait
struct ABT_sched_opaque * ABT_sched
Scheduler handle type.
static int32_t ABTD_atomic_acquire_load_int32(const ABTD_atomic_int32 *ptr)
#define ABT_ERR_INV_SCHED
Error code: invalid scheduler.
int ABT_pool_pop_threads_ex(ABT_pool pool, ABT_thread *threads, size_t len, size_t *num, ABT_pool_context pool_ctx)
Pop work units from a pool.
int ABT_pool_print_all(ABT_pool pool, void *arg, void(*print_fn)(void *, ABT_unit))
Apply a print function to every work unit in a pool using a user-defined function.
static void pool_free_unit_wrapper(ABT_pool pool, ABT_unit unit)
static void ABTD_atomic_release_store_uint64(ABTD_atomic_uint64 *ptr, uint64_t val)
static int pool_init_wrapper(ABT_pool pool, ABT_pool_config config)
#define LOG_DEBUG_POOL_POP(p_pool, thread)
A struct that defines a pool.
static ABT_pool_config ABTI_pool_config_get_handle(ABTI_pool_config *p_config)
static void ABTI_pool_push_many(ABTI_pool *p_pool, const ABT_unit *units, size_t num, ABT_pool_context context)
ABT_unit_is_in_pool_fn u_is_in_pool
void(* print_fn)(void *, ABT_unit)
int ABT_pool_remove(ABT_pool pool, ABT_unit unit)
Remove a specified work unit from a pool.
#define ABTI_HANDLE_ERROR(n)
static ABTD_atomic_uint64 g_pool_id
struct ABT_pool_config_opaque * ABT_pool_config
Pool configuration handle type.
static ABT_thread ABTI_pool_pop_wait(ABTI_pool *p_pool, double time_secs, ABT_pool_context context)
ABTU_ret_err int ABTI_pool_create_basic(ABT_pool_kind kind, ABT_pool_access access, ABT_bool automatic, ABTI_pool **pp_newpool)
static ABTU_ret_err int ABTU_malloc(size_t size, void **p_ptr)
static ABTU_ret_err int ABTI_pool_remove(ABTI_pool *p_pool, ABT_unit unit)
ABT_pool_pop_timedwait_fn p_pop_timedwait
Function that pops a work unit from a pool with wait.
ABT_pool_pop_fn p_pop
Function that pops a work unit from a pool.
ABT_pool_free_fn p_free
Function that frees a pool.
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)
#define ABT_ERR_INV_UNIT
Error code: invalid work unit for scheduling.
#define ABTD_ATOMIC_UINT64_STATIC_INITIALIZER(val)
#define ABT_ERR_INV_POOL_ACCESS
Error code: invalid pool access type.
static int pool_pop_thread_ex(ABT_pool pool, ABT_thread *thread, ABT_pool_context pool_ctx)
ABT_pool_print_all_fn p_print_all
Function that applies a user-given function to all work units in a pool.
ABT_pool_access access
Access type.
ABT_pool_user_pop_wait_fn p_pop_wait
static size_t ABTI_pool_get_total_size(ABTI_pool *p_pool)
struct ABT_unit_opaque * ABT_unit
Work unit handle type for scheduling.
const ABT_pool_config_var ABT_pool_config_automatic
Predefined ABT_pool_config_var to configure whether the pool is freed automatically or not.
ABT_bool ABTI_initialized(void)
static ABTI_local * ABTI_local_get_local(void)
int ABT_pool_pop(ABT_pool pool, ABT_unit *p_unit)
Pop a work unit from a pool.
ABT_pool_get_size_fn p_get_size
Function that returns a work 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)
#define ABTI_STATIC_ASSERT(cond)
ABT_pool_push_fn p_push
Function that pushes a work unit to a pool.
#define ABT_SUCCESS
Error code: the routine returns successfully.
int ABT_pool_push(ABT_pool pool, ABT_unit unit)
Push a unit to a pool.
static size_t pool_get_size_wrapper(ABT_pool pool)
static uint64_t pool_get_new_id(void)
int ABT_pool_get_total_size(ABT_pool pool, size_t *size)
Get the total size of a pool.
ABT_pool_user_push_many_fn p_push_many
ABTI_pool_deprecated_def deprecated_def
int ABT_pool_create_basic(ABT_pool_kind kind, ABT_pool_access access, ABT_bool automatic, ABT_pool *newpool)
Create a new pool from a predefined type.
#define ABT_TRUE
True constant for ABT_bool.
static ABTI_pool * ABTI_pool_get_ptr(ABT_pool pool)
int ABT_pool_push_thread(ABT_pool pool, ABT_thread thread)
Push a work unit to a pool.
static int pool_push_threads_ex(ABT_pool pool, const ABT_thread *threads, size_t num, ABT_pool_context pool_ctx)
static void pool_create_def_from_old_def(const ABT_pool_def *p_def, ABTI_pool_old_def *p_old_def, ABTI_pool_required_def *p_required_def, ABTI_pool_optional_def *p_optional_def, ABTI_pool_deprecated_def *p_deprecated_def)
#define ABT_FALSE
False constant for ABT_bool.
static void ABTI_pool_pop_many(ABTI_pool *p_pool, ABT_thread *threads, size_t len, size_t *num, ABT_pool_context context)
static void pool_print_all_wrapper(ABT_pool pool, void *arg, void(*print_f)(void *, ABT_thread))
static ABTU_ret_err int pool_create(ABT_pool_access access, const ABTI_pool_required_def *p_required_def, const ABTI_pool_optional_def *p_optional_def, const ABTI_pool_deprecated_def *p_deprecated_def, const ABTI_pool_old_def *p_old_def, ABTI_pool_config *p_config, ABT_bool def_automatic, ABT_bool is_builtin, ABTI_pool **pp_newpool)
ABTI_pool_old_def old_def
static void pool_print_unit_to_thread(void *arg, ABT_unit unit)
#define ABTI_UB_ASSERT(cond)
ABT_pool_user_pop_many_fn p_pop_many
#define ABTI_CHECK_NULL_POOL_PTR(p)
static uint64_t ABTD_atomic_fetch_add_uint64(ABTD_atomic_uint64 *ptr, uint64_t v)
#define ABT_ERR_INV_POOL_KIND
Error code: invalid pool kind.
void ABTI_pool_reset_id(void)
ABT_pool_pop_wait_fn p_pop_wait
static void ABTU_free(void *ptr)
int ABT_pool_pop_thread_ex(ABT_pool pool, ABT_thread *thread, ABT_pool_context pool_ctx)
Pop a work unit from a pool.
static ABTI_thread * ABTI_unit_get_thread(ABTI_global *p_global, ABT_unit unit)
int ABT_pool_set_data(ABT_pool pool, void *data)
Set user data in a pool.
int ABT_pool_pop_wait_thread_ex(ABT_pool pool, ABT_thread *thread, double time_secs, ABT_pool_context pool_ctx)
Pop 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)
ABT_unit_create_from_thread_fn u_create_from_thread
Function that creates an ABT_unit handle that is associated with an ABT_thread handle.
void ABTI_pool_print(ABTI_pool *p_pool, FILE *p_os, int indent)
static void ABTI_pool_push(ABTI_pool *p_pool, ABT_unit unit, ABT_pool_context context)
ABT_pool_print_all_fn p_print_all
int ABT_pool_pop_timedwait(ABT_pool pool, ABT_unit *p_unit, double abstime_secs)
Pop a unit from a pool with timed wait.
int ABT_pool_free(ABT_pool *pool)
Free a pool.
static ABTI_pool_config * ABTI_pool_config_get_ptr(ABT_pool_config config)
struct ABTI_local ABTI_local
int ABT_pool_create(ABT_pool_user_def def, ABT_pool_config config, ABT_pool *newpool)
Create a new pool.
ABTI_pool_required_def required_def
static ABT_bool ABTI_pool_is_empty(ABTI_pool *p_pool)
#define ABTI_CHECK_TRUE(cond, abt_errno)
void ABTI_pool_free(ABTI_pool *p_pool)
ABT_pool_init_fn p_init
Function that frees a work unit.
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)
static int pool_pop_wait_thread_ex(ABT_pool pool, ABT_thread *thread, double time_secs, ABT_pool_context pool_ctx)
ABT_pool_user_is_empty_fn p_is_empty
int ABT_pool_pop_wait_thread(ABT_pool pool, ABT_thread *thread, double time_secs)
Pop a work unit from a pool.
static void pool_push_many_wrapper(ABT_pool pool, const ABT_unit *units, size_t num_units, ABT_pool_context context)
ABT_bool ABTI_pool_user_def_is_new(const ABT_pool_user_def def)
ABT_pool_kind
Predefined pool type.
static void pool_free_wrapper(ABT_pool pool)
static ABTI_thread * ABTI_thread_get_ptr(ABT_thread thread)
static ABT_pool ABTI_pool_get_handle(ABTI_pool *p_pool)
ABT_pool_user_create_unit_fn p_create_unit
int ABT_pool_get_access(ABT_pool pool, ABT_pool_access *access)
Get an access type of a pool.
ABT_pool_get_size_fn p_get_size
ABT_pool_user_free_fn p_free
int ABT_pool_push_thread_ex(ABT_pool pool, ABT_thread thread, ABT_pool_context pool_ctx)
Push a work unit to a pool.
static void pool_pop_many_wrapper(ABT_pool pool, ABT_thread *threads, size_t max_threads, size_t *num_popped, ABT_pool_context context)
#define ABTI_UB_ASSERT_BOOL(bool_val)
int ABT_pool_push_threads_ex(ABT_pool pool, const ABT_thread *threads, size_t num, ABT_pool_context pool_ctx)
Push work units to a pool.
int ABT_pool_get_id(ABT_pool pool, int *id)
Get ID of a pool.
int ABT_pool_pop_threads(ABT_pool pool, ABT_thread *threads, size_t len, size_t *num)
Pop work units from a pool.
ABT_pool_access
Pool access type.