celeritas icon indicating copy to clipboard operation
celeritas copied to clipboard

Refactor CELER_(DISABLE|PARALLEL) environment variables

Open sethrj opened this issue 2 years ago • 0 comments

We have some environment variables that "disable" capabilities automatically on (e.g., MPI or CUDA), others that "enable" capabilities (profiling). The "color" environment variable can be disabled or enabled, with an "automatic" evaluation as a third option.

It would be better to have an API:

template<class T>
T getenv(std::string const& key, T default);

so for example we could set

static bool use_root = getenv("CELER_ROOT", CELERITAS_USE_ROOT);

and the getenv would:

  1. load the environment variable (and register its access for later output)
  2. set the value to the default if blank, or parse the variable otherwise
  3. save the possibly defaulted result into the environment list

sethrj avatar Nov 09 '23 12:11 sethrj