mache.spack.get_spack_script

mache.spack.get_spack_script(spack_path, env_name, compiler, mpi, shell, machine=None, include_e3sm_lapack=False, include_e3sm_hdf5_netcdf=None, load_spack_env=True, *, e3sm_hdf5_netcdf=None, exclude_packages=None)[source]

Build a snippet of a load script for the given spack environment

Parameters:
  • spack_path (str) – The base path where spack has been (or will be) cloned

  • env_name (str) – The name of the spack environment to be created or recreated

  • compiler (str) – One of the E3SM supported compilers for the machine

  • mpi (str) – One of the E3SM supported MPI libraries for the given compiler and machine

  • shell ({'sh', 'csh'}) – Which shell the script is for

  • machine (str, optional) – The name of an E3SM supported machine. If none is given, the machine will be detected automatically via the host name.

  • include_e3sm_lapack (bool, optional) – Whether to include the same lapack (typically from MKL) as used in E3SM

  • e3sm_hdf5_netcdf (bool, optional) – Whether to include the same hdf5, netcdf-c, netcdf-fortran and pnetcdf as used in E3SM

  • include_e3sm_hdf5_netcdf (bool, optional) – Deprecated alias for e3sm_hdf5_netcdf.

  • exclude_packages (sequence of str or str, optional) – System-provided Spack packages to opt out of. For this function, the package bundle that affects shell setup is e3sm_hdf5_netcdf (or hdf5_netcdf), which disables the machine-provided HDF5/NetCDF module and environment-variable setup.

  • load_spack_env (bool, optional) – Whether to load the spack environment at the start of script. Must be set to False when initially building the environment

Returns:

load_script (str) – A snippet of a shell script that will load the given spack environment and add any additional steps required for using the environment such as setting environment variables or loading modules not handled by the spack environment directly