Go to the documentation of this file.
14 #ifdef ABT_CONFIG_USE_DEBUG_LOG
15 static inline uint64_t sched_get_new_id(
void);
95 #ifndef ABT_CONFIG_ENABLE_VER_20_API
105 sched_create(def, num_pools, pools, p_config, def_automatic, &p_sched);
178 #ifndef ABT_CONFIG_ENABLE_VER_20_API
241 #ifndef ABT_CONFIG_ENABLE_VER_20_API
327 #ifndef ABT_CONFIG_ENABLE_VER_20_API
333 for (p = idx; p < (size_t)idx + max_pools; p++) {
338 pools[p - idx] = p_sched->
pools[p];
458 #ifndef ABT_CONFIG_ENABLE_VER_20_API
464 #ifndef ABT_CONFIG_ENABLE_VER_20_API
570 #ifndef ABT_CONFIG_ENABLE_VER_20_API
618 #ifndef ABT_CONFIG_ENABLE_VER_20_API
635 size_t pool_size = 0, p;
637 for (p = 0; p < p_sched->
num_pools; p++) {
677 for (p = 0; p < num_pools; p++) {
687 for (i = 0; i < p; i++) {
698 pool_list[p] = pools[p];
711 pool_list, p_config, def_automatic,
716 num_pools, pool_list, p_config,
717 def_automatic, pp_newsched);
721 pool_list, p_config, def_automatic,
726 pool_list, p_config, def_automatic,
736 for (i = 0; i < num_pools; i++) {
776 for (p = 0; p < num_pools; p++)
778 for (p = 0; p < num_pools; p++) {
785 for (i = 0; i < p; i++) {
799 pool_list, p_config, def_automatic,
804 num_pools, pool_list, p_config,
805 def_automatic, pp_newsched);
809 pool_list, p_config, def_automatic,
814 pool_list, p_config, def_automatic,
824 for (i = 0; i < num_pools; i++) {
845 for (p = 0; p < p_sched->
num_pools; p++) {
865 LOG_DEBUG(
"[S%" PRIu64
"] freed\n", p_sched->id);
866 p_sched->
data = NULL;
914 size_t pool_size = 0, p;
916 for (p = 0; p < p_sched->
num_pools; p++) {
931 size_t pool_size = 0, p;
933 for (p = 0; p < p_sched->
num_pools; p++) {
962 if (p_sched == NULL) {
963 fprintf(p_os,
"%*s== NULL SCHED ==\n", indent,
"");
966 const char *kind_str, *used;
968 kind = p_sched->
kind;
972 kind_str =
"BASIC_WAIT";
981 switch (p_sched->
used) {
997 "%*s== SCHED (%p) ==\n"
998 #ifdef ABT_CONFIG_USE_DEBUG_LOG
999 "%*sid : %" PRIu64
"\n"
1001 "%*skind : %" PRIxPTR
" (%s)\n"
1003 "%*sautomatic: %s\n"
1004 "%*srequest : 0x%x\n"
1005 "%*snum_pools: %zu\n"
1007 "%*stot_size : %zu\n"
1010 indent,
"", (
void *)p_sched,
1011 #ifdef ABT_CONFIG_USE_DEBUG_LOG
1012 indent,
"", p_sched->id,
1014 indent,
"", p_sched->
kind, kind_str, indent,
"", used, indent,
1015 "", (p_sched->automatic ==
ABT_TRUE) ?
"TRUE" :
"FALSE", indent,
1017 "", p_sched->num_pools, indent,
"",
1020 (
void *)p_sched->p_ythread, indent,
"", p_sched->data);
1023 for (i = 0; i < p_sched->num_pools; i++) {
1060 ABT_bool automatic = def_automatic;
1062 int automatic_val = 0;
1078 for (p = 0; p < num_pools; p++) {
1086 for (i = 0; i < p; i++) {
1096 pool_list[p] = pools[p];
1100 for (p = 0; p < num_pools; p++) {
1105 p_sched->automatic = automatic;
1107 p_sched->p_replace_sched = NULL;
1108 p_sched->p_replace_waiter = NULL;
1110 p_sched->pools = pool_list;
1111 p_sched->num_pools = num_pools;
1112 p_sched->type = def->
type;
1113 p_sched->p_ythread = NULL;
1114 p_sched->data = NULL;
1116 p_sched->init = def->
init;
1117 p_sched->run = def->
run;
1118 p_sched->free = def->
free;
1121 #ifdef ABT_CONFIG_USE_DEBUG_LOG
1122 p_sched->id = sched_get_new_id();
1124 LOG_DEBUG(
"[S%" PRIu64
"] created\n", p_sched->id);
1130 if (p_sched->init) {
1132 abt_errno = p_sched->init(newsched, config);
1134 for (p = 0; p < num_pools; p++) {
1147 *pp_newsched = p_sched;
1152 #ifdef ABT_CONFIG_USE_DEBUG_LOG
1153 static inline uint64_t sched_get_new_id(
void)
#define ABTI_CHECK_NULL_SCHED_PTR(p)
ABT_sched_predef
Predefined scheduler type.
static ABTI_sched * ABTI_sched_get_ptr(ABT_sched sched)
void ABTI_sched_reset_id(void)
ABTD_atomic_int32 num_blocked
static void ABTD_atomic_relaxed_store_uint64(ABTD_atomic_uint64 *ptr, uint64_t val)
int ABT_sched_create_basic(ABT_sched_predef predef, int num_pools, ABT_pool *pools, ABT_sched_config config, ABT_sched *newsched)
Create a new scheduler with a predefined scheduler type.
int ABT_bool
Boolean type.
static uint32_t ABTD_atomic_acquire_load_uint32(const ABTD_atomic_uint32 *ptr)
ABT_sched_type type
Unused value.
#define ABTI_SETUP_GLOBAL(pp_global)
void ABTI_sched_print(ABTI_sched *p_sched, FILE *p_os, int indent, ABT_bool print_sub)
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)
#define ABT_ERR_INV_XSTREAM
Error code: invalid execution stream.
#define ABT_ERR_INV_SCHED_PREDEF
Error code: invalid predefined scheduler type.
#define ABTI_SCHED_NUM_PRIO
void ABTI_sched_free(ABTI_global *p_global, ABTI_local *p_local, ABTI_sched *p_sched, ABT_bool force_free)
#define ABTI_CHECK_ERROR(abt_errno)
int ABT_sched_exit(ABT_sched sched)
Request a scheduler to finish.
static ABT_sched ABTI_sched_get_handle(ABTI_sched *p_sched)
ABT_sched_run_fn run
Function that defines a kernel of a scheduler.
struct ABT_sched_config_opaque * ABT_sched_config
Scheduler configuration handle type.
void ABTI_thread_free(ABTI_global *p_global, ABTI_local *p_local, ABTI_thread *p_thread)
static size_t ABTI_pool_get_size(ABTI_pool *p_pool)
#define ABTI_IS_ERROR_CHECK_ENABLED
static ABTD_atomic_uint64 g_sched_id
struct ABT_pool_opaque * ABT_pool
Pool handle type.
ABT_sched_config_var ABT_sched_config_automatic
Predefined ABT_sched_config_var to configure whether the scheduler is freed automatically or not.
size_t ABTI_sched_get_effective_size(ABTI_local *p_local, ABTI_sched *p_sched)
int ABT_sched_finish(ABT_sched sched)
Request a scheduler to finish after its pools get empty.
struct ABT_sched_opaque * ABT_sched
Scheduler handle type.
static int32_t ABTD_atomic_acquire_load_int32(const ABTD_atomic_int32 *ptr)
ABT_sched_def * ABTI_sched_get_basic_wait_def(void)
static ABT_sched_config ABTI_sched_config_get_handle(ABTI_sched_config *p_config)
size_t ABTI_sched_get_total_size(ABTI_sched *p_sched)
ABTU_ret_err int ABTI_sched_get_migration_pool(ABTI_sched *p_sched, ABTI_pool *source_pool, ABTI_pool **pp_pool)
void ABTI_pool_free(ABTI_pool *p_pool)
static ABTI_sched_kind sched_get_kind(ABT_sched_def *def)
#define ABTI_SCHED_REQ_REPLACE
static void ABTD_atomic_relaxed_store_uint32(ABTD_atomic_uint32 *ptr, uint32_t val)
size_t ABTI_sched_get_size(ABTI_sched *p_sched)
#define ABTI_SCHED_REQ_EXIT
#define ABTI_HANDLE_ERROR(n)
static ABTU_ret_err int ABTU_malloc(size_t size, void **p_ptr)
#define LOG_DEBUG(fmt,...)
#define ABT_ERR_SCHED
Error code: error related to a scheduler.
static ABTU_ret_err int sched_create(ABT_sched_def *def, int num_pools, ABT_pool *pools, ABTI_sched_config *p_config, ABT_bool def_automatic, ABTI_sched **pp_newsched)
#define ABTD_ATOMIC_UINT64_STATIC_INITIALIZER(val)
ABTU_ret_err int ABTI_pool_create_basic(ABT_pool_kind kind, ABT_pool_access access, ABT_bool automatic, ABTI_pool **pp_newpool)
ABT_sched_get_migr_pool_fn get_migr_pool
static size_t ABTI_pool_get_total_size(ABTI_pool *p_pool)
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)
ABT_sched_def * ABTI_sched_get_randws_def(void)
int ABT_sched_get_total_size(ABT_sched sched, size_t *size)
Obtain the sum of the total sizes of pools associated with a scheduler.
#define ABTI_ASSERT(cond)
static void ABTI_sched_set_request(ABTI_sched *p_sched, uint32_t req)
#define ABT_ERR_MIGRATION_TARGET
Error code: error related to a migration target.
static ABTI_local * ABTI_local_get_local(void)
#define ABT_SUCCESS
Error code: the routine returns successfully.
ABT_sched_get_migr_pool_fn get_migr_pool
Function that returns a pool for migration.
int ABT_sched_get_num_pools(ABT_sched sched, int *num_pools)
Obtain the number of pools associated with a scheduler.
#define ABT_TRUE
True constant for ABT_bool.
static ABTI_pool * ABTI_pool_get_ptr(ABT_pool pool)
ABTD_atomic_uint32 request
#define ABT_FALSE
False constant for ABT_bool.
uintptr_t ABTI_sched_kind
ABT_sched_free_fn free
Function that frees a scheduler.
int ABT_sched_set_data(ABT_sched sched, void *data)
Associate a user value with a scheduler.
#define ABT_ERR_INV_ARG
Error code: invalid user argument.
static uint64_t ABTD_atomic_fetch_add_uint64(ABTD_atomic_uint64 *ptr, uint64_t v)
static void ABTU_free(void *ptr)
A struct that defines a scheduler.
struct ABTI_local ABTI_local
void ABTI_sched_finish(ABTI_sched *p_sched)
void ABTI_pool_print(ABTI_pool *p_pool, FILE *p_os, int indent)
#define ABTI_CHECK_TRUE(cond, abt_errno)
int ABT_sched_has_to_stop(ABT_sched sched, ABT_bool *stop)
Check if a scheduler needs to stop.
static ABTI_sched_config * ABTI_sched_config_get_ptr(ABT_sched_config config)
ABT_sched_init_fn init
Function that initializes a scheduler.
int ABT_sched_free(ABT_sched *sched)
Free a scheduler.
static int32_t ABTI_pool_release(ABTI_pool *p_pool)
int ABT_sched_get_pools(ABT_sched sched, int max_pools, int idx, ABT_pool *pools)
Retrieve pools associated with a scheduler.
static void ABTI_pool_retain(ABTI_pool *p_pool)
ABT_pool_kind
Predefined pool type.
int ABT_sched_get_data(ABT_sched sched, void **data)
Retrieve a user value associated with a scheduler.
ABTD_atomic_int32 num_scheds
#define ABTI_SCHED_REQ_FINISH
static ABT_pool ABTI_pool_get_handle(ABTI_pool *p_pool)
ABT_bool ABTI_sched_has_to_stop(ABTI_local **pp_local, ABTI_sched *p_sched)
int ABT_sched_create(ABT_sched_def *def, int num_pools, ABT_pool *pools, ABT_sched_config config, ABT_sched *newsched)
Create a new scheduler with a scheduler definition.
int ABT_sched_get_size(ABT_sched sched, size_t *size)
Obtain the sum of sizes of pools associated with a scheduler.
ABT_sched_def * ABTI_sched_get_prio_def(void)
ABT_pool_access
Pool access type.
void ABTI_sched_exit(ABTI_sched *p_sched)