ARGOBOTS  dce6e727ffc4ca5b3ffc04cb9517c6689be51ec5
abtd_env.c
Go to the documentation of this file.
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  * See COPYRIGHT in top-level directory.
4  */
5 
6 #include "abti.h"
7 #include <unistd.h>
8 #include <strings.h>
9 
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
14 
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
22 
23 /* To avoid potential overflow, we intentionally use a smaller value than the
24  * real limit. */
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))
29 
30 static uint32_t roundup_pow2_uint32(uint32_t val);
31 static size_t roundup_pow2_size(size_t val);
32 static const char *get_abt_env(const char *env_suffix);
33 static ABT_bool is_false(const char *str, ABT_bool include0);
34 static ABT_bool is_true(const char *str, ABT_bool include1);
35 static ABT_bool load_env_bool(const char *env_suffix, ABT_bool default_val);
36 static int load_env_int(const char *env_suffix, int default_val, int min_val,
37  int max_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);
44 
45 void ABTD_env_init(ABTI_global *p_global)
46 {
47  const char *env;
48 
49  /* Get the number of available cores in the system */
50  p_global->num_cores = sysconf(_SC_NPROCESSORS_ONLN);
51 
52  /* ABT_SET_AFFINITY, ABT_ENV_SET_AFFINITY */
53  env = get_abt_env("SET_AFFINITY");
54  if (env != NULL && is_false(env, ABT_FALSE)) {
55  p_global->set_affinity = ABT_FALSE;
56  } else {
57  /* By default, we use the CPU affinity */
58  p_global->set_affinity = ABT_TRUE;
59  ABTD_affinity_init(p_global, env);
60  }
61 
62  /* Log setting */
63  p_global->use_logging = ABTD_env_get_use_logging();
64  /* Debug setting (unused) */
65  p_global->use_debug = ABTD_env_get_use_debug();
66  /* Maximum size of the internal ES array */
67  p_global->max_xstreams = ABTD_env_get_max_xstreams();
68  /* Default key table size */
69  p_global->key_table_size = ABTD_env_key_table_size();
70  /* mprotect-based stack guard setting */
71  ABT_bool is_strict;
72  if (ABTD_env_get_stack_guard_mprotect(&is_strict)) {
73  if (is_strict) {
74  p_global->stack_guard_kind = ABTI_STACK_GUARD_MPROTECT_STRICT;
75  } else {
76  p_global->stack_guard_kind = ABTI_STACK_GUARD_MPROTECT;
77  }
78  } else {
79  /* Stack canary is compile-time setting. */
80  p_global->stack_guard_kind = ABTI_STACK_GUARD_NONE;
81  }
82  /* System page size. */
83  p_global->sys_page_size = ABTD_env_get_sys_pagesize();
84  /* Default stack size for ULT */
85  p_global->thread_stacksize = ABTD_env_get_thread_stacksize();
86  /* Default stack size for scheduler */
87  p_global->sched_stacksize = ABTD_env_get_sched_stacksize();
88  /* Default frequency for event checking by the scheduler */
89  p_global->sched_event_freq = ABTD_env_get_sched_event_freq();
90  /* Default nanoseconds for scheduler sleep */
91  p_global->sched_sleep_nsec = ABTD_env_get_sched_sleep_nsec();
92 
93  /* ABT_MUTEX_MAX_HANDOVERS, ABT_ENV_MUTEX_MAX_HANDOVERS
94  * Default maximum number of mutex handover */
95  p_global->mutex_max_handovers =
96  load_env_uint32("MUTEX_MAX_HANDOVERS", 64, 1, ABTD_ENV_UINT32_MAX);
97 
98  /* ABT_MUTEX_MAX_WAKEUPS, ABT_ENV_MUTEX_MAX_WAKEUPS
99  * Default maximum number of mutex wakeup operations */
100  p_global->mutex_max_wakeups =
101  load_env_uint32("MUTEX_MAX_WAKEUPS", 1, 1, ABTD_ENV_UINT32_MAX);
102 
103  /* ABT_PRINT_RAW_STACK, ABT_ENV_PRINT_RAW_STACK */
104  ABT_bool default_print_raw_stack = ABT_TRUE;
105 #ifdef ABT_CONFIG_DISABLE_STACK_UNWIND_DUMP_RAW_STACK
106  default_print_raw_stack = ABT_FALSE;
107 #endif
108  p_global->print_raw_stack =
109  load_env_bool("PRINT_RAW_STACK", default_print_raw_stack);
110  /* ABT_HUGE_PAGE_SIZE, ABT_ENV_HUGE_PAGE_SIZE
111  * Huge page size */
112  size_t default_huge_page_size = (ABT_CONFIG_SYS_HUGE_PAGE_SIZE != 0)
114  : ABTD_HUGE_PAGE_SIZE;
115  p_global->huge_page_size =
116  load_env_size("HUGE_PAGE_SIZE", default_huge_page_size, 4096,
117  ABTD_ENV_SIZE_MAX);
118 
119 #ifdef ABT_CONFIG_USE_MEM_POOL
120  /* ABT_MEM_PAGE_SIZE, ABT_ENV_MEM_PAGE_SIZE
121  * Page size for memory allocation. It must be 2^N. */
122  p_global->mem_page_size = roundup_pow2_size(
123  ABTU_roundup_size(load_env_size("MEM_PAGE_SIZE", ABTD_MEM_PAGE_SIZE,
124  4096, ABTD_ENV_SIZE_MAX),
126 
127  /* ABT_MEM_STACK_PAGE_SIZE, ABT_ENV_MEM_STACK_PAGE_SIZE
128  * Stack page size for memory allocation */
129  p_global->mem_sp_size =
130  ABTU_roundup_size(load_env_size("MEM_STACK_PAGE_SIZE",
131  ABTD_MEM_STACK_PAGE_SIZE,
132  p_global->thread_stacksize * 4,
133  ABTD_ENV_SIZE_MAX),
135 
136  /* ABT_MEM_MAX_NUM_STACKS, ABT_ENV_MEM_MAX_NUM_STACKS
137  * Maximum number of stacks that each ES can keep during execution. */
138  /* If each execution stream caches too many stacks in total, let's reduce
139  * the max # of stacks. */
140  const uint32_t default_mem_max_stacks =
141  ABTU_min_uint32(ABTD_MEM_MAX_TOTAL_STACK_SIZE /
142  p_global->thread_stacksize,
143  ABTD_MEM_MAX_NUM_STACKS);
144  /* The value must be a multiple of ABT_MEM_POOL_MAX_LOCAL_BUCKETS. */
145  p_global->mem_max_stacks =
146  ABTU_roundup_uint32(load_env_uint32("MEM_MAX_NUM_STACKS",
147  default_mem_max_stacks,
149  ABTD_ENV_UINT32_MAX),
151 
152  /* ABT_MEM_MAX_NUM_DESCS, ABT_ENV_MEM_MAX_NUM_DESCS
153  * Maximum number of descriptors that each ES can keep during execution */
154  /* The value must be a multiple of ABT_MEM_POOL_MAX_LOCAL_BUCKETS. */
155  p_global->mem_max_descs =
156  ABTU_roundup_uint32(load_env_uint32("MEM_MAX_NUM_DESCS",
157  ABTD_MEM_MAX_NUM_DESCS,
159  ABTD_ENV_UINT32_MAX),
161 
162  /* ABT_MEM_LP_ALLOC, ABT_ENV_MEM_LP_ALLOC
163  * How to allocate large pages. The default is to use mmap() for huge
164  * pages and then to fall back to allocate regular pages using mmap() when
165  * huge pages are run out of. */
166  int lp_alloc;
167 #if defined(HAVE_MAP_ANONYMOUS) || defined(HAVE_MAP_ANON)
168  /*
169  * To use hugepage, mmap() needs a correct size of hugepage; otherwise,
170  * an error happens on "munmap()" (not mmap()).
171  */
172  if (get_abt_env("HUGE_PAGE_SIZE")) {
173  /* If the explicitly user explicitly sets the huge page size via the
174  * environmental variable, we respect that value. It is the user's
175  * responsibility to set a correct huge page size. */
176  lp_alloc = ABTI_MEM_LP_MMAP_HP_RP;
177  } else {
178  /* Let's use huge page when both of the following conditions are met:
179  * 1. Huge page is actually usable (ABT_CONFIG_USE_HUGE_PAGE_DEFAULT).
180  * 2. The huge page size is not too large (e.g., some systems use 512 MB
181  * huge page, which is too big for the default setting). */
182 #ifdef ABT_CONFIG_USE_HUGE_PAGE_DEFAULT
183  if (4096 <= ABT_CONFIG_SYS_HUGE_PAGE_SIZE &&
184  ABT_CONFIG_SYS_HUGE_PAGE_SIZE <= 8 * 1024 * 1024) {
185  lp_alloc = ABTI_MEM_LP_MMAP_HP_RP;
186  } else {
187  lp_alloc = ABTI_MEM_LP_MMAP_RP;
188  }
189 #else
190  /* Huge page allocation failed at configuration time. Don't use it.*/
191  lp_alloc = ABTI_MEM_LP_MMAP_RP;
192 #endif
193  }
194 #else
195  /* We cannot use mmap(). Let's use a normal malloc(). */
196  lp_alloc = ABTI_MEM_LP_MALLOC;
197 #endif
198  env = get_abt_env("MEM_LP_ALLOC");
199  if (env != NULL) {
200  if (strcasecmp(env, "malloc") == 0) {
201  lp_alloc = ABTI_MEM_LP_MALLOC;
202 #if defined(HAVE_MAP_ANONYMOUS) || defined(HAVE_MAP_ANON)
203  } else if (strcasecmp(env, "mmap_rp") == 0) {
204  lp_alloc = ABTI_MEM_LP_MMAP_RP;
205  } else if (strcasecmp(env, "mmap_hp_rp") == 0) {
206  lp_alloc = ABTI_MEM_LP_MMAP_HP_RP;
207  } else if (strcasecmp(env, "mmap_hp_thp") == 0) {
208  lp_alloc = ABTI_MEM_LP_MMAP_HP_THP;
209 #endif
210  } else if (strcasecmp(env, "thp") == 0) {
211  lp_alloc = ABTI_MEM_LP_THP;
212  }
213  }
214 
215  /* Check if the requested allocation method is really possible. */
216  if (lp_alloc != ABTI_MEM_LP_MALLOC) {
217  p_global->mem_lp_alloc = ABTI_mem_check_lp_alloc(p_global, lp_alloc);
218  } else {
219  p_global->mem_lp_alloc = lp_alloc;
220  }
221 #endif
222 
223  /* Whether to print the configuration on ABT_init() */
224  p_global->print_config = ABTD_env_get_print_config();
225 
226  /* Init timer */
227  ABTD_time_init();
228 }
229 
230 ABT_bool ABTD_env_get_use_debug(void)
231 {
232 #ifdef ABT_CONFIG_USE_DEBUG_LOG_PRINT
233  const ABT_bool default_use_debug = ABT_TRUE;
234 #else
235  const ABT_bool default_use_debug = ABT_FALSE;
236 #endif
237  /* ABT_USE_DEBUG, ABT_ENV_USE_DEBUG */
238  return load_env_bool("USE_DEBUG", default_use_debug);
239 }
240 
241 ABT_bool ABTD_env_get_use_logging(void)
242 {
243 #ifdef ABT_CONFIG_USE_DEBUG_LOG_PRINT
244  /* If the debug log printing is set in configure, logging is turned on by
245  * default. */
246  const ABT_bool default_use_logging = ABT_TRUE;
247 #else
248  /* Otherwise, logging is not turned on by default. */
249  const ABT_bool default_use_logging = ABT_FALSE;
250 #endif
251  /* ABT_USE_LOG, ABT_ENV_USE_LOG */
252  return load_env_bool("USE_LOG", default_use_logging);
253 }
254 
255 ABT_bool ABTD_env_get_print_config(void)
256 {
257  /* ABT_PRINT_CONFIG, ABT_ENV_PRINT_CONFIG */
258  return load_env_bool("PRINT_CONFIG", ABT_FALSE);
259 }
260 
261 int ABTD_env_get_max_xstreams(void)
262 {
263  const int num_cores = sysconf(_SC_NPROCESSORS_ONLN);
264  /* ABT_MAX_NUM_XSTREAMS, ABT_ENV_MAX_NUM_XSTREAMS */
265  return load_env_int("MAX_NUM_XSTREAMS", num_cores, 1, ABTD_ENV_INT_MAX);
266 }
267 
268 uint32_t ABTD_env_key_table_size(void)
269 {
270  /* ABT_KEY_TABLE_SIZE, ABT_ENV_KEY_TABLE_SIZE */
271  return roundup_pow2_uint32(load_env_uint32("KEY_TABLE_SIZE",
272  ABTD_KEY_TABLE_DEFAULT_SIZE, 1,
273  ABTD_ENV_UINT32_MAX));
274 }
275 
276 size_t ABTD_env_get_sys_pagesize(void)
277 {
278  /* ABT_SYS_PAGE_SIZE, ABT_ENV_SYS_PAGE_SIZE
279  * System page size. It must be 2^N. */
280  size_t sys_page_size = ABTD_SYS_PAGE_SIZE;
281 #if HAVE_GETPAGESIZE
282  sys_page_size = getpagesize();
283 #endif
284  return roundup_pow2_size(
285  load_env_size("SYS_PAGE_SIZE", sys_page_size, 64, ABTD_ENV_SIZE_MAX));
286 }
287 
288 size_t ABTD_env_get_thread_stacksize(void)
289 {
290  size_t default_thread_stacksize = ABT_CONFIG_DEFAULT_THREAD_STACKSIZE;
291  if (ABTD_env_get_stack_guard_mprotect(NULL)) {
292  /* Maximum 2 pages are used for mprotect(), so let's increase the
293  * default stack size. */
294  const size_t sys_page_size = ABTD_env_get_sys_pagesize();
295  default_thread_stacksize += sys_page_size * 2;
296  }
297  /* ABT_THREAD_STACKSIZE, ABT_ENV_THREAD_STACKSIZE */
298  return ABTU_roundup_size(load_env_size("THREAD_STACKSIZE",
299  default_thread_stacksize, 512,
300  ABTD_ENV_SIZE_MAX),
302 }
303 
304 size_t ABTD_env_get_sched_stacksize(void)
305 {
306  size_t default_sched_stacksize = ABTD_SCHED_DEFAULT_STACKSIZE;
307  if (ABTD_env_get_stack_guard_mprotect(NULL)) {
308  /* Maximum 2 pages are used for mprotect(), so let's increase the
309  * default stack size. */
310  const size_t sys_page_size = ABTD_env_get_sys_pagesize();
311  default_sched_stacksize += sys_page_size * 2;
312  }
313  /* ABT_SCHED_STACKSIZE, ABT_ENV_SCHED_STACKSIZE */
314  return ABTU_roundup_size(load_env_size("SCHED_STACKSIZE",
315  default_sched_stacksize, 512,
316  ABTD_ENV_SIZE_MAX),
318 }
319 
320 uint32_t ABTD_env_get_sched_event_freq(void)
321 {
322  /* ABT_SCHED_EVENT_FREQ, ABT_ENV_SCHED_EVENT_FREQ */
323  return load_env_uint32("SCHED_EVENT_FREQ", ABTD_SCHED_EVENT_FREQ, 1,
324  ABTD_ENV_UINT32_MAX);
325 }
326 
327 uint64_t ABTD_env_get_sched_sleep_nsec(void)
328 {
329  /* ABT_SCHED_SLEEP_NSEC, ABT_ENV_SCHED_SLEEP_NSEC */
330  return load_env_uint64("SCHED_SLEEP_NSEC", ABTD_SCHED_SLEEP_NSEC, 0,
331  ABTD_ENV_UINT64_MAX);
332 }
333 
334 ABT_bool ABTD_env_get_stack_guard_mprotect(ABT_bool *is_strict)
335 {
336  /* ABT_STACK_OVERFLOW_CHECK, ABT_ENV_STACK_OVERFLOW_CHECK */
337  const char *env = get_abt_env("STACK_OVERFLOW_CHECK");
338  ABT_bool strict_val, mprotect_val;
339  if (env) {
340  if (strcasecmp(env, "mprotect_strict") == 0) {
341  strict_val = ABT_TRUE;
342  mprotect_val = ABT_TRUE;
343  } else if (strcasecmp(env, "mprotect") == 0) {
344  strict_val = ABT_FALSE;
345  mprotect_val = ABT_TRUE;
346  } else {
347  /* Otherwise, disable mprotect-based stack guard. */
348  strict_val = ABT_FALSE;
349  mprotect_val = ABT_FALSE;
350  }
351  } else {
352  /* Set the default mode. */
353 #if ABT_CONFIG_STACK_CHECK_TYPE == ABTI_STACK_CHECK_TYPE_MPROTECT
354  strict_val = ABT_FALSE;
355  mprotect_val = ABT_TRUE;
356 #elif ABT_CONFIG_STACK_CHECK_TYPE == ABTI_STACK_CHECK_TYPE_MPROTECT_STRICT
357  strict_val = ABT_TRUE;
358  mprotect_val = ABT_TRUE;
359 #else
360  strict_val = ABT_FALSE;
361  mprotect_val = ABT_FALSE;
362 #endif
363  }
364  if (is_strict)
365  *is_strict = strict_val;
366  return mprotect_val;
367 }
368 
369 /*****************************************************************************/
370 /* Internal static functions */
371 /*****************************************************************************/
372 
373 static uint32_t roundup_pow2_uint32(uint32_t val)
374 {
375  /* 3 -> 4
376  * 4 -> 4
377  * 5 -> 8 */
378  if (val == 0)
379  return 0;
380  uint32_t i;
381  for (i = 0; i < sizeof(uint32_t) * 8 - 1; i++) {
382  if ((val - 1) >> i == 0)
383  break;
384  }
385  return ((uint32_t)1) << i;
386 }
387 
388 static size_t roundup_pow2_size(size_t val)
389 {
390  if (val == 0)
391  return 0;
392  size_t i;
393  for (i = 0; i < sizeof(size_t) * 8 - 1; i++) {
394  if ((val - 1) >> i == 0)
395  break;
396  }
397  return ((size_t)1) << i;
398 }
399 
400 static const char *get_abt_env(const char *env_suffix)
401 {
402  /* Valid prefix is ABT_ and ABT_ENV_. ABT_ is prioritized. */
403  char buffer[128];
404  const char *prefixes[] = { "ABT_", "ABT_ENV_" };
405  uint32_t i;
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);
414  if (env)
415  return env;
416  }
417  }
418  return NULL;
419 }
420 
421 static ABT_bool is_false(const char *str, ABT_bool include0)
422 {
423  if (include0 && strcmp(str, "0") == 0) {
424  return ABT_TRUE;
425  } else if (strcasecmp(str, "n") == 0 || strcasecmp(str, "no") == 0 ||
426  strcasecmp(str, "false") == 0 || strcasecmp(str, "off") == 0) {
427  return ABT_TRUE;
428  }
429  return ABT_FALSE;
430 }
431 
432 static ABT_bool is_true(const char *str, ABT_bool include1)
433 {
434  if (include1 && strcmp(str, "1") == 0) {
435  return ABT_TRUE;
436  } else if (strcasecmp(str, "y") == 0 || strcasecmp(str, "yes") == 0 ||
437  strcasecmp(str, "true") == 0 || strcasecmp(str, "on") == 0) {
438  return ABT_TRUE;
439  }
440  return ABT_FALSE;
441 }
442 
443 static ABT_bool load_env_bool(const char *env_suffix, ABT_bool default_val)
444 {
445  const char *env = get_abt_env(env_suffix);
446  if (!env) {
447  return default_val;
448  } else {
449  if (default_val) {
450  /* If env is not "false", return true */
451  return is_false(env, ABT_TRUE) ? ABT_FALSE : ABT_TRUE;
452  } else {
453  /* If env is not "true", return false */
454  return is_true(env, ABT_TRUE) ? ABT_TRUE : ABT_FALSE;
455  }
456  }
457 }
458 
459 static int load_env_int(const char *env_suffix, int default_val, int min_val,
460  int max_val)
461 {
462  const char *env = get_abt_env(env_suffix);
463  if (!env) {
464  return ABTU_max_int(min_val, ABTU_min_int(max_val, default_val));
465  } else {
466  int val;
467  int abt_errno = ABTU_atoi(env, &val, NULL);
468  if (abt_errno != ABT_SUCCESS) {
469  return ABTU_max_int(min_val, ABTU_min_int(max_val, default_val));
470  } else {
471  return ABTU_max_int(min_val, ABTU_min_int(max_val, val));
472  }
473  }
474 }
475 
476 static uint32_t load_env_uint32(const char *env_suffix, uint32_t default_val,
477  uint32_t min_val, uint32_t max_val)
478 {
479  const char *env = get_abt_env(env_suffix);
480  if (!env) {
481  return ABTU_max_uint32(min_val, ABTU_min_uint32(max_val, default_val));
482  } else {
483  uint32_t val;
484  int abt_errno = ABTU_atoui32(env, &val, NULL);
485  if (abt_errno != ABT_SUCCESS) {
486  return ABTU_max_uint32(min_val,
487  ABTU_min_uint32(max_val, default_val));
488  } else {
489  return ABTU_max_uint32(min_val, ABTU_min_uint32(max_val, val));
490  }
491  }
492 }
493 
494 static uint64_t load_env_uint64(const char *env_suffix, uint64_t default_val,
495  uint64_t min_val, uint64_t max_val)
496 {
497  const char *env = get_abt_env(env_suffix);
498  if (!env) {
499  return ABTU_max_uint64(min_val, ABTU_min_uint64(max_val, default_val));
500  } else {
501  uint64_t val;
502  int abt_errno = ABTU_atoui64(env, &val, NULL);
503  if (abt_errno != ABT_SUCCESS) {
504  return ABTU_max_uint64(min_val,
505  ABTU_min_uint64(max_val, default_val));
506  } else {
507  return ABTU_max_uint64(min_val, ABTU_min_uint64(max_val, val));
508  }
509  }
510 }
511 
512 static size_t load_env_size(const char *env_suffix, size_t default_val,
513  size_t min_val, size_t max_val)
514 {
515  const char *env = get_abt_env(env_suffix);
516  if (!env) {
517  return ABTU_max_size(min_val, ABTU_min_size(max_val, default_val));
518  } else {
519  size_t val;
520  int abt_errno = ABTU_atosz(env, &val, NULL);
521  if (abt_errno != ABT_SUCCESS) {
522  return ABTU_max_size(min_val, ABTU_min_size(max_val, default_val));
523  } else {
524  return ABTU_max_size(min_val, ABTU_min_size(max_val, val));
525  }
526  }
527 }
load_env_uint64
static uint64_t load_env_uint64(const char *env_suffix, uint64_t default_val, uint64_t min_val, uint64_t max_val)
Definition: abtd_env.c:494
load_env_uint32
static uint32_t load_env_uint32(const char *env_suffix, uint32_t default_val, uint32_t min_val, uint32_t max_val)
Definition: abtd_env.c:476
ABTU_max_size
static size_t ABTU_max_size(size_t a, size_t b)
Definition: abtu.h:40
ABTU_min_int
static int ABTU_min_int(int a, int b)
Definition: abtu.h:45
ABT_bool
int ABT_bool
Boolean type.
Definition: abt.h:1043
ABTU_max_uint64
static uint64_t ABTU_max_uint64(uint64_t a, uint64_t b)
Definition: abtu.h:35
is_true
static ABT_bool is_true(const char *str, ABT_bool include1)
Definition: abtd_env.c:432
ABTU_max_int
static int ABTU_max_int(int a, int b)
Definition: abtu.h:15
ABTU_roundup_size
static size_t ABTU_roundup_size(size_t val, size_t multiple)
Definition: abtu.h:95
load_env_size
static size_t load_env_size(const char *env_suffix, size_t default_val, size_t min_val, size_t max_val)
Definition: abtd_env.c:512
ABTU_min_size
static size_t ABTU_min_size(size_t a, size_t b)
Definition: abtu.h:70
ABT_MEM_POOL_MAX_LOCAL_BUCKETS
#define ABT_MEM_POOL_MAX_LOCAL_BUCKETS
Definition: abti_mem_pool.h:9
roundup_pow2_size
static size_t roundup_pow2_size(size_t val)
Definition: abtd_env.c:388
ABTU_min_uint64
static uint64_t ABTU_min_uint64(uint64_t a, uint64_t b)
Definition: abtu.h:65
ABT_CONFIG_DEFAULT_THREAD_STACKSIZE
#define ABT_CONFIG_DEFAULT_THREAD_STACKSIZE
Definition: abt_config.h:21
roundup_pow2_uint32
static uint32_t roundup_pow2_uint32(uint32_t val)
Definition: abtd_env.c:373
load_env_int
static int load_env_int(const char *env_suffix, int default_val, int min_val, int max_val)
Definition: abtd_env.c:459
is_false
static ABT_bool is_false(const char *str, ABT_bool include0)
Definition: abtd_env.c:421
ABTU_max_uint32
static uint32_t ABTU_max_uint32(uint32_t a, uint32_t b)
Definition: abtu.h:25
ABTU_atoui64
ABTU_ret_err int ABTU_atoui64(const char *str, uint64_t *p_val, ABT_bool *p_overflow)
Definition: atoi.c:65
get_abt_env
static const char * get_abt_env(const char *env_suffix)
Definition: abtd_env.c:400
abti.h
ABT_CONFIG_STATIC_CACHELINE_SIZE
#define ABT_CONFIG_STATIC_CACHELINE_SIZE
Definition: abt_config.h:81
ABT_SUCCESS
#define ABT_SUCCESS
Error code: the routine returns successfully.
Definition: abt.h:92
ABTU_atoui32
ABTU_ret_err int ABTU_atoui32(const char *str, uint32_t *p_val, ABT_bool *p_overflow)
Definition: atoi.c:39
ABT_TRUE
#define ABT_TRUE
True constant for ABT_bool.
Definition: abt.h:784
ABTU_atoi
ABTU_ret_err int ABTU_atoi(const char *str, int *p_val, ABT_bool *p_overflow)
Definition: atoi.c:11
ABT_FALSE
#define ABT_FALSE
False constant for ABT_bool.
Definition: abt.h:786
ABT_CONFIG_SYS_HUGE_PAGE_SIZE
#define ABT_CONFIG_SYS_HUGE_PAGE_SIZE
Definition: abt_config.h:84
load_env_bool
static ABT_bool load_env_bool(const char *env_suffix, ABT_bool default_val)
Definition: abtd_env.c:443
ABTU_atosz
ABTU_ret_err int ABTU_atosz(const char *str, size_t *p_val, ABT_bool *p_overflow)
Definition: atoi.c:85
ABTU_min_uint32
static uint32_t ABTU_min_uint32(uint32_t a, uint32_t b)
Definition: abtu.h:55
ABTU_roundup_uint32
static uint32_t ABTU_roundup_uint32(uint32_t val, uint32_t multiple)
Definition: abtu.h:75