Skip to content

The spack.yaml file

Spack environments are defined using a spack.yaml file. This may be fairly familiar if you have previously used a Conda environment.yaml file. In fact, the official Spack documentation contains a useful comparison section.

However, whereas a Conda environment will install the actual binaries and shared libraries to disk inside each environment, Spack environments can leverage an upstream location and then merely create symlinks to existing applications and libraries, which reduces disk usage and reduces the need to constantly install and reinstall the same packages over and over again.

A spack.yaml file essentially contracts all the individual configuration YAML files from a custom Spack configuration scope (i.e. compilers.yaml, config.yaml, modules.yaml etc.) into one single file (spack.yaml). What were individual YAML files now become sections (compilers, config, modules etc.) of a single spack.yaml file.

Example spack.yaml files

Example spack.yaml files can be found in our spack-config-templates repository inside the environment-templates sub-directory. There is a directory per Spack release (e.g. 0.22.0) - please use the templates that match the version of Spack you are using, as the requirements for spack.yaml files can change between Spack releases.

You should grab each YAML file (or copy and paste its contents) and make sure it is saved as spack.yaml inside the directory you then want to use to store the environment.

Please note, access to the above repository is for QMUL internal users only (i.e. those with an account attached to a qmul.ac.uk email address). External users will need to raise a ticket with the ITSR support team and we can copy template config files to your personal Apocrita storage for you.