Skip to content

modules.yaml

Read the official Spack documentation

Content of modules.yaml (click to expand)
modules:
  default:
    # Where to install personal modules
    roots:
      tcl: /data/scratch/${USER}/spack/privatemodules
    enable:
    - tcl
    tcl:
      all:
        # Automatically load additional modiles required to run applications
        autoload: direct
        # Raise a conflict if two modules have an identical name
        conflict:
        - '{name}'
      # Keep module names short by not including their indentifying hash
      hash_length: 0
      hide_implicits: true
      projections:
      ## DO NOT REORDER THESE ALPHABETICALLY - ORDER IS IMPORTANT!!! ##
      # Below is a simplified version of our main, more complex configuration and can be modified as required
        all: '{name}/{version}-{compiler.name}-{compiler.version}'
        gcc: '{name}/{version}'
        gromacs^cuda^mpi: '{name}-gpu/{version}-{^mpi.name}-{^mpi.version}-cuda-{^cuda.version}-{compiler.name}-{compiler.version}'
        gromacs^mpi: '{name}-mpi/{version}-{^mpi.name}-{^mpi.version}-{compiler.name}-{compiler.version}'
        intel-oneapi-compilers: 'intel/{version}'
        intel-oneapi-mpi: 'intel-mpi/{version}'
        lammps^cuda^mpi: '{name}-gpu/{version}-{^mpi.name}-{^mpi.version}-cuda-{^cuda.version}-{compiler.name}-{compiler.version}'
        ^cuda^mpi: '{name}/{version}-{^mpi.name}-{^mpi.version}-cuda-{^cuda.version}-{compiler.name}-{compiler.version}'
        ^cuda: '{name}/{version}-cuda-{^cuda.version}-{compiler.name}-{compiler.version}'
        ^mpi: '{name}/{version}-{^mpi.name}-{^mpi.version}-{compiler.name}-{compiler.version}'
      gcc-runtime::
        conflict:
        - ''
      gromacs:
        suffixes:
          +plumed: plumed
      intel-oneapi-compilers:
        conflict:
        - 'gcc'
        - 'intel'
        - 'intel-classic'
        - 'nvidia-hpc-sdk'
      intel-oneapi-mpi:
        conflict:
        - 'intel-mpi'
        - 'openmpi'
      lammps:
        suffixes:
          +kokkos: kokkos

The default: roots: tcl: section defines where personal Spack modules should be installed. The example above uses scratch but adjust as required.

Note - you would need to run something like:

module use /data/scratch/${USER}/spack/privatemodules/linux-rocky9-x86_64_v4

to make these modules available to you in job scripts etc.

The tcl: section broadly mirrors the setup we use for centrally installed applications, but it can be customised as per the official Spack documentation. Included in the template are the required projections for naming module files correctly in the examples that follow.

Refreshing module files

Spack will automatically generate a module for a newly installed personal application, but it won't re-generate existing modules. If you make changes to your modules.yaml file, you will need to run the following command to refresh the existing ones:

spack -C ${HOME}/spack-config-templates/0.22.0 module tcl refresh --delete-tree -y

This will delete all personal modules and then re-create them. Leave off the -y if you want to review what will be recreated before manually confirming.