Attention
This project is still in an early phase of development.
The python API is not yet stable, and some aspects of the schema for the blueprint and workplan will likely evolve. Therefore whilst you are welcome to try out using the package, we cannot yet guarantee backwards compatibility. We expect to reach a more stable version in 2026.
CStarEnvironment#
- class cstar.system.environment.CStarEnvironment(system_name: str, mpi_exec_prefix: str, compiler: str, system_settings_klass: type[EnvSettingsBase] | None = None)#
Bases:
objectEncapsulates the configuration and management of a computing environment for a specific system, including compilers, job schedulers, memory, and core settings.
This class uses properties to avoid attribute modification after initialization.
This class also provides utilities for interacting with Linux Environment Modules (Lmod) and dynamically setting up the environment based on user and system configurations.
Examples
>>> env = CStarEnvironment( ... system_name="expanse", ... mpi_exec_prefix="srun --mpi=pmi2", ... compiler="intel", ... ) >>> print(env) CStarEnvironment(...)
Methods
Loads necessary modules for this machine using Linux Environment Modules.
CStarEnvironment.set_env_var(key, value)Set value of an environment variable.
Attributes
CStarEnvironment.compilerGet the compiler used when building in the environment.
CStarEnvironment.environment_variablesReturn the environment variables that were loaded from .env files.
CStarEnvironment.lmod_pathIdentify the expected path to a .lmod file for the current system.
CStarEnvironment.mpi_exec_prefixGet the MPI prefix used when calling mpiexec in the environment.
CStarEnvironment.package_rootReturn the root directory of the top-level package.
CStarEnvironment.settings_klassReturn the type that will load and validate the system settings.
CStarEnvironment.system_env_pathIdentify the expected path to a .env file for the current system.
CStarEnvironment.template_rootThe root directory containing CStar templates.
CStarEnvironment.uses_lmodChecks if the system uses Linux Environment Modules (Lmod) based on OS type and presence of LMOD_DIR in environment variables.