Skip to content

stackhpc/ansible_role_spack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stackhpc.spack

Install and configure the Spack source-based package manager, and optionally packages using it.

  • TODO: provide a way to add spack-installed compilers (not openhpc-packaged ones) automatically.
  • TODO: uninstall packages removed from the list?
  • TODO: run spack selfchecks on first install

After running this for the first time, users should log in again to make the spack command available and update module avail.

Requirements

  • Must be run with become: true.
  • The defaults for spack_system_compilers assume OpenHPC v2 system.
  • For installing on a cluster, a shared filesystem and shared /home is required.

Role Variables

The following variables will commonly need changing:

  • spack_root: Optional. Path to install spack to. Default /home/{{ ansible_user }}/spack (note a final directory is included) - for a cluster this should be on a shared filesystem.

  • spack_version: Optional. Git tag etc of spack version to install. Default v0.16.2.

  • spack_compilers: Optional. List of spack specs describing compiler packages to install using spack. Default is an empty list. Note that removing packages from this list does not uninstall them.

  • spack_packages: As for spack_compilers but for non-compiler packages.

    E.g.:

    - "[email protected] %[email protected] fabrics=ucx schedulers=auto"

    On an OpenHPC v2 system this installs a version of OpenMPI using the UCX transport layer which integrates with the (OpenHPC-installed) Slurm. Note that %[email protected] requires Spack to use a specific compiler, which is installed from the OpenHPC repositories and configured in spack by the defaults below. While OpenHPC does provide an openmpi+ucx package, it can be hard to integrate this with further Spack packages.

  • spack_users: Optional. List of (existing) users to make spack available to by modifying their .bashrc. Default is the empty list, in which case a system-wide profile is set to make spack available for all bash sessions.

The following variables are unlikely to need changing:

  • spack_cmd: Optional. Path to spack binary. Default is "{{ spack_root}}/bin/spack".

  • spack_system_compilers: Optional. A list of dicts describing compiler packages to install from the system package manager - these are installed and added as spack compilers. The default is as follows and explains the keys:

    - system_pkg: gnu9-compilers-ohpc # name of the system-package-manager compiler package, in this case from openhpc
      module: gnu9/9.3.0          # the module it creates
      spack_pkg: [email protected]        # what `spack compiler list` shows this compiler as

    Note that values for system_pkg and module may be left empty if the compiler is already installed in the base image and/or does not have a module, but those keys must still exist.

    For OpenHPC v2 systems the above is currently the only compiler available without additional licences (see Table 6 of OpenHPC installation guide, so the default is appropriate on such systems.

  • spack_module_config: Optional. YAML for spack's modules.yml configuration file. The default configures lmod module system (as used by OpenHPC) with all compilers in spack_system_compilers as core. (Note this is provided as a block rather than actual yaml due to some non-standard Spack yaml such as "::")

Dependencies

None.

Example Playbook

This should be run on any nodes from which you want to be able to build spack packages spack, i.e. login nodes for a cluster.

- hosts: cluster_login  
  become: yes
  tasks:
    - import_role:
        name: ansible_role_spack
      vars:
        spack_root: /mnt/nfs/spack

License

Apache 2

Author Information

Steve Brasier ([email protected])

About

Install and configure spack

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published