ARGOBOTS
dce6e727ffc4ca5b3ffc04cb9517c6689be51ec5
|
Go to the documentation of this file.
10 #define ABTD_KEY_TABLE_DEFAULT_SIZE 4
11 #define ABTD_SCHED_DEFAULT_STACKSIZE (4 * 1024 * 1024)
12 #define ABTD_SCHED_EVENT_FREQ 50
13 #define ABTD_SCHED_SLEEP_NSEC 100
15 #define ABTD_SYS_PAGE_SIZE 4096
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))
32 static const char *
get_abt_env(
const char *env_suffix);
36 static int load_env_int(
const char *env_suffix,
int default_val,
int min_val,
38 static uint32_t
load_env_uint32(
const char *env_suffix, uint32_t default_val,
39 uint32_t min_val, uint32_t max_val);
40 static uint64_t
load_env_uint64(
const char *env_suffix, uint64_t default_val,
41 uint64_t min_val, uint64_t max_val);
42 static size_t load_env_size(
const char *env_suffix,
size_t default_val,
43 size_t min_val,
size_t max_val);
50 p_global->
num_cores = sysconf(_SC_NPROCESSORS_ONLN);
105 #ifdef ABT_CONFIG_DISABLE_STACK_UNWIND_DUMP_RAW_STACK
116 load_env_size(
"HUGE_PAGE_SIZE", default_huge_page_size, 4096,
119 #ifdef ABT_CONFIG_USE_MEM_POOL
140 const uint32_t default_mem_max_stacks =
147 default_mem_max_stacks,
167 #if defined(HAVE_MAP_ANONYMOUS) || defined(HAVE_MAP_ANON)
182 #ifdef ABT_CONFIG_USE_HUGE_PAGE_DEFAULT
200 if (strcasecmp(env,
"malloc") == 0) {
202 #if defined(HAVE_MAP_ANONYMOUS) || defined(HAVE_MAP_ANON)
203 }
else if (strcasecmp(env,
"mmap_rp") == 0) {
205 }
else if (strcasecmp(env,
"mmap_hp_rp") == 0) {
207 }
else if (strcasecmp(env,
"mmap_hp_thp") == 0) {
210 }
else if (strcasecmp(env,
"thp") == 0) {
232 #ifdef ABT_CONFIG_USE_DEBUG_LOG_PRINT
243 #ifdef ABT_CONFIG_USE_DEBUG_LOG_PRINT
263 const int num_cores = sysconf(_SC_NPROCESSORS_ONLN);
282 sys_page_size = getpagesize();
295 default_thread_stacksize += sys_page_size * 2;
299 default_thread_stacksize, 512,
311 default_sched_stacksize += sys_page_size * 2;
315 default_sched_stacksize, 512,
337 const char *env =
get_abt_env(
"STACK_OVERFLOW_CHECK");
340 if (strcasecmp(env,
"mprotect_strict") == 0) {
343 }
else if (strcasecmp(env,
"mprotect") == 0) {
353 #if ABT_CONFIG_STACK_CHECK_TYPE == ABTI_STACK_CHECK_TYPE_MPROTECT
356 #elif ABT_CONFIG_STACK_CHECK_TYPE == ABTI_STACK_CHECK_TYPE_MPROTECT_STRICT
365 *is_strict = strict_val;
381 for (i = 0; i <
sizeof(uint32_t) * 8 - 1; i++) {
382 if ((val - 1) >> i == 0)
385 return ((uint32_t)1) << i;
393 for (i = 0; i <
sizeof(size_t) * 8 - 1; i++) {
394 if ((val - 1) >> i == 0)
397 return ((
size_t)1) << i;
404 const char *prefixes[] = {
"ABT_",
"ABT_ENV_" };
406 for (i = 0; i <
sizeof(prefixes) /
sizeof(prefixes[0]); i++) {
407 int prefix_size = strlen(prefixes[i]);
408 int env_suffix_size = strlen(env_suffix);
409 if (prefix_size + env_suffix_size + 1 <= (
int)
sizeof(buffer)) {
410 memcpy(buffer, prefixes[i], prefix_size);
411 memcpy(buffer + prefix_size, env_suffix, env_suffix_size);
412 buffer[prefix_size + env_suffix_size] =
'\0';
413 const char *env = getenv(buffer);
423 if (include0 && strcmp(str,
"0") == 0) {
425 }
else if (strcasecmp(str,
"n") == 0 || strcasecmp(str,
"no") == 0 ||
426 strcasecmp(str,
"false") == 0 || strcasecmp(str,
"off") == 0) {
434 if (include1 && strcmp(str,
"1") == 0) {
436 }
else if (strcasecmp(str,
"y") == 0 || strcasecmp(str,
"yes") == 0 ||
437 strcasecmp(str,
"true") == 0 || strcasecmp(str,
"on") == 0) {
459 static int load_env_int(
const char *env_suffix,
int default_val,
int min_val,
467 int abt_errno =
ABTU_atoi(env, &val, NULL);
477 uint32_t min_val, uint32_t max_val)
495 uint64_t min_val, uint64_t max_val)
513 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
uint32_t ABTD_env_get_sched_event_freq(void)
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)
@ ABTI_STACK_GUARD_MPROTECT_STRICT
static int ABTU_max_int(int a, int b)
uint64_t ABTD_env_get_sched_sleep_nsec(void)
#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
static size_t roundup_pow2_size(size_t val)
#define ABTD_SCHED_SLEEP_NSEC
static uint64_t ABTU_min_uint64(uint64_t a, uint64_t b)
#define ABT_CONFIG_DEFAULT_THREAD_STACKSIZE
size_t ABTD_env_get_sys_pagesize(void)
static uint32_t roundup_pow2_uint32(uint32_t val)
ABT_bool ABTD_env_get_use_debug(void)
static int load_env_int(const char *env_suffix, int default_val, int min_val, int max_val)
ABTI_stack_guard stack_guard_kind
#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)
size_t ABTD_env_get_thread_stacksize(void)
ABTU_ret_err int ABTU_atoui64(const char *str, uint64_t *p_val, ABT_bool *p_overflow)
int ABTD_env_get_max_xstreams(void)
static const char * get_abt_env(const char *env_suffix)
#define ABTD_ENV_UINT32_MAX
#define ABTD_SYS_PAGE_SIZE
ABT_bool ABTD_env_get_use_logging(void)
#define ABTD_KEY_TABLE_DEFAULT_SIZE
uint32_t ABTD_env_key_table_size(void)
#define ABTD_SCHED_EVENT_FREQ
uint32_t sched_event_freq
uint32_t mutex_max_handovers
ABT_bool ABTD_env_get_print_config(void)
#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)
ABT_bool ABTD_env_get_stack_guard_mprotect(ABT_bool *is_strict)
@ ABTI_STACK_GUARD_MPROTECT
uint32_t mutex_max_wakeups
#define ABT_TRUE
True constant for ABT_bool.
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)
size_t ABTD_env_get_sched_stacksize(void)
#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)