Go to the documentation of this file.
10 #define ABTD_KEY_TABLE_DEFAULT_SIZE 4
11 #define ABTD_THREAD_DEFAULT_STACKSIZE 16384
12 #define ABTD_SCHED_DEFAULT_STACKSIZE (4 * 1024 * 1024)
13 #define ABTD_SCHED_EVENT_FREQ 50
14 #define ABTD_SCHED_SLEEP_NSEC 100
16 #define ABTD_HUGE_PAGE_SIZE (2 * 1024 * 1024)
17 #define ABTD_MEM_PAGE_SIZE (2 * 1024 * 1024)
18 #define ABTD_MEM_STACK_PAGE_SIZE (8 * 1024 * 1024)
19 #define ABTD_MEM_MAX_NUM_STACKS 1024
20 #define ABTD_MEM_MAX_TOTAL_STACK_SIZE (64 * 1024 * 1024)
21 #define ABTD_MEM_MAX_NUM_DESCS 4096
25 #define ABTD_ENV_INT_MAX ((int)(INT_MAX / 2))
26 #define ABTD_ENV_UINT32_MAX ((uint32_t)(UINT32_MAX / 2))
27 #define ABTD_ENV_UINT64_MAX ((uint64_t)(UINT64_MAX / 2))
28 #define ABTD_ENV_SIZE_MAX ((size_t)(SIZE_MAX / 2))
31 #ifdef ABT_CONFIG_USE_MEM_POOL
32 static size_t roundup_pow2_size(
size_t val);
34 static const char *
get_abt_env(
const char *env_suffix);
38 static int load_env_int(
const char *env_suffix,
int default_val,
int min_val,
40 static uint32_t
load_env_uint32(
const char *env_suffix, uint32_t default_val,
41 uint32_t min_val, uint32_t max_val);
42 static uint64_t
load_env_uint64(
const char *env_suffix, uint64_t default_val,
43 uint64_t min_val, uint64_t max_val);
44 static size_t load_env_size(
const char *env_suffix,
size_t default_val,
45 size_t min_val,
size_t max_val);
52 p_global->
num_cores = sysconf(_SC_NPROCESSORS_ONLN);
64 #ifdef ABT_CONFIG_USE_DEBUG_LOG_PRINT
136 load_env_size(
"HUGE_PAGE_SIZE", default_huge_page_size, 4096,
139 #ifdef ABT_CONFIG_USE_MEM_POOL
142 p_global->mem_page_size = roundup_pow2_size(
149 p_global->mem_sp_size =
160 const uint32_t default_mem_max_stacks =
165 p_global->mem_max_stacks =
167 default_mem_max_stacks,
175 p_global->mem_max_descs =
187 #if defined(HAVE_MAP_ANONYMOUS) || defined(HAVE_MAP_ANON)
202 #ifdef ABT_CONFIG_USE_HUGE_PAGE_DEFAULT
220 if (strcasecmp(env,
"malloc") == 0) {
222 #if defined(HAVE_MAP_ANONYMOUS) || defined(HAVE_MAP_ANON)
223 }
else if (strcasecmp(env,
"mmap_rp") == 0) {
225 }
else if (strcasecmp(env,
"mmap_hp_rp") == 0) {
227 }
else if (strcasecmp(env,
"mmap_hp_thp") == 0) {
230 }
else if (strcasecmp(env,
"thp") == 0) {
239 p_global->mem_lp_alloc = lp_alloc;
263 for (i = 0; i <
sizeof(uint32_t) * 8 - 1; i++) {
264 if ((val - 1) >> i == 0)
267 return ((uint32_t)1) << i;
270 #ifdef ABT_CONFIG_USE_MEM_POOL
271 static size_t roundup_pow2_size(
size_t val)
276 for (i = 0; i <
sizeof(size_t) * 8 - 1; i++) {
277 if ((val - 1) >> i == 0)
280 return ((
size_t)1) << i;
288 const char *prefixes[] = {
"ABT_",
"ABT_ENV_" };
290 for (i = 0; i <
sizeof(prefixes) /
sizeof(prefixes[0]); i++) {
291 int prefix_size = strlen(prefixes[i]);
292 int env_suffix_size = strlen(env_suffix);
293 if (prefix_size + env_suffix_size + 1 <= (
int)
sizeof(buffer)) {
294 memcpy(buffer, prefixes[i], prefix_size);
295 memcpy(buffer + prefix_size, env_suffix, env_suffix_size);
296 buffer[prefix_size + env_suffix_size] =
'\0';
297 const char *env = getenv(buffer);
307 if (include0 && strcmp(str,
"0") == 0) {
309 }
else if (strcasecmp(str,
"n") == 0 || strcasecmp(str,
"no") == 0 ||
310 strcasecmp(str,
"false") == 0 || strcasecmp(str,
"off") == 0) {
318 if (include1 && strcmp(str,
"1") == 0) {
320 }
else if (strcasecmp(str,
"y") == 0 || strcasecmp(str,
"yes") == 0 ||
321 strcasecmp(str,
"true") == 0 || strcasecmp(str,
"on") == 0) {
343 static int load_env_int(
const char *env_suffix,
int default_val,
int min_val,
351 int abt_errno =
ABTU_atoi(env, &val, NULL);
361 uint32_t min_val, uint32_t max_val)
379 uint64_t min_val, uint64_t max_val)
397 size_t min_val,
size_t max_val)
static uint64_t load_env_uint64(const char *env_suffix, uint64_t default_val, uint64_t min_val, uint64_t max_val)
static uint32_t load_env_uint32(const char *env_suffix, uint32_t default_val, uint32_t min_val, uint32_t max_val)
static size_t ABTU_max_size(size_t a, size_t b)
static int ABTU_min_int(int a, int b)
#define ABTD_MEM_MAX_TOTAL_STACK_SIZE
void ABTD_env_init(ABTI_global *p_global)
uint64_t sched_sleep_nsec
int ABT_bool
Boolean type.
static uint64_t ABTU_max_uint64(uint64_t a, uint64_t b)
@ ABTI_MEM_LP_MMAP_HP_THP
static ABT_bool is_true(const char *str, ABT_bool include1)
static int ABTU_max_int(int a, int b)
#define ABTD_MEM_MAX_NUM_STACKS
static size_t ABTU_roundup_size(size_t val, size_t multiple)
static size_t load_env_size(const char *env_suffix, size_t default_val, size_t min_val, size_t max_val)
static size_t ABTU_min_size(size_t a, size_t b)
#define ABT_MEM_POOL_MAX_LOCAL_BUCKETS
#define ABTD_ENV_UINT64_MAX
#define ABTD_SCHED_SLEEP_NSEC
static uint64_t ABTU_min_uint64(uint64_t a, uint64_t b)
static uint32_t roundup_pow2_uint32(uint32_t val)
static int load_env_int(const char *env_suffix, int default_val, int min_val, int max_val)
#define ABTD_MEM_PAGE_SIZE
static ABT_bool is_false(const char *str, ABT_bool include0)
static uint32_t ABTU_max_uint32(uint32_t a, uint32_t b)
ABTU_ret_err int ABTU_atoui64(const char *str, uint64_t *p_val, ABT_bool *p_overflow)
static const char * get_abt_env(const char *env_suffix)
#define ABTD_ENV_UINT32_MAX
#define ABTD_KEY_TABLE_DEFAULT_SIZE
#define ABTD_SCHED_EVENT_FREQ
uint32_t sched_event_freq
uint32_t mutex_max_handovers
#define ABT_CONFIG_STATIC_CACHELINE_SIZE
void ABTD_time_init(void)
#define ABTD_ENV_SIZE_MAX
#define ABT_SUCCESS
Error code: the routine returns successfully.
ABTU_ret_err int ABTU_atoui32(const char *str, uint32_t *p_val, ABT_bool *p_overflow)
uint32_t mutex_max_wakeups
#define ABT_TRUE
True constant for ABT_bool.
#define ABTD_THREAD_DEFAULT_STACKSIZE
ABTU_ret_err int ABTU_atoi(const char *str, int *p_val, ABT_bool *p_overflow)
#define ABT_FALSE
False constant for ABT_bool.
#define ABTD_MEM_MAX_NUM_DESCS
#define ABT_CONFIG_SYS_HUGE_PAGE_SIZE
static ABT_bool load_env_bool(const char *env_suffix, ABT_bool default_val)
void ABTD_affinity_init(ABTI_global *p_global, const char *affinity_str)
#define ABTD_SCHED_DEFAULT_STACKSIZE
ABTU_ret_err int ABTU_atosz(const char *str, size_t *p_val, ABT_bool *p_overflow)
int ABTI_mem_check_lp_alloc(ABTI_global *p_global, int lp_alloc)
#define ABTD_HUGE_PAGE_SIZE
#define ABTD_MEM_STACK_PAGE_SIZE
static uint32_t ABTU_min_uint32(uint32_t a, uint32_t b)
static uint32_t ABTU_roundup_uint32(uint32_t val, uint32_t multiple)