Spack

We use the Spack package manager to build a set of common HPC software packages.

This section describes how to use an extent the central installation.

Alternatively, you can use a full independent Spack installation in your home directory, or use EasyBuild.

Using the Central Installation

Activate the central Spack installation with source /cluster/spack/0.22.2/share/spack/setup-env.sh.

You can use this as a starting point for your own software builds, without the need to rebuild everything from scratch.

For this purpose, add the following three files to ~/.spack:

  • ~/.spack/upstreams.yaml
    upstreams:
      central-spack:
        install_tree: /cluster/spack/0.22.2/opt/spack
  • ~/.spack/config.yaml
    config:
      install_tree:
        root: $HOME/spack/opt/spack
      source_cache: $HOME/spack/cache
  • ~/.spack/modules.yaml
    modules:
      default:
        roots:
          lmod: $HOME/spack/share/spack/lmod
        enable: [lmod]
        lmod:
          all:
            autoload: direct
          hide_implicits: true
          hierarchy: []

Also, put these two lines into your ~/.bashrc:

export MODULEPATH=$MODULEPATH:$HOME/spack/share/spack/lmod/linux-almalinux9-x86_64/Core
. /cluster/spack/0.22.2/share/spack/setup-env.sh

You can then use the central Spack installation, with local additions added in ~/spack.

Run spack compiler find to add the system compiler to your compiler list. Also run it after loading other compilers via module load to add those, too.

Overriding Package Definitions

If you need to override selected package definitions, create an additional file ~/.spack/repos.yaml:

repos:
  - $HOME/spack/var/spack/repos

and create a description for your local repo in ~/spack/var/spack/repos/repo.yaml:

repo:
  namespace: overrides

You can then copy the package definition you need to override, and edit it locally. Example for ffmpeg:

$ cd ~/spack/var/spack/repos/
$ mkdir -p packages/ffmpeg
$ cp /cluster/spack/0.22.2/var/spack/repos/builtin/packages/ffmpeg/package.py packages/ffmpeg
$ vim packages/ffmpeg/package.py
... edit as necessary (e.g. disable the patch for version 6.1.1) ...

When running spack install ffmpeg, your local override will take precedence over the central version.