Spack

Spack is a package manager for supercomputers, Linux, and macOS. It makes installing scientific software easy. Spack isn’t tied to a particular language; you can build a software stack in Python or R, link to libraries written in C, C++, or Fortran, and easily swap compilers or target specific microarchitectures. For more details visit Spack documentation.

How to Install Spack?

SStack tool allows you to install Spack, and use it to install software in your desired location. For example, to install a Spack named spack-el7 with the default version in the project space /project/hpcteam/, run command:

sstack install -t spack -n spack-el7 -p /project/hpcteam/

To install a specific Spack version, use the option -v or --version. For example, to install the develop version, run command:

sstack install -t spack -n spack-el7 -v develop

This creates a module file that you can load in your environment to be able to use the stack to install software.

For example, to use spack-el7, you need to load its module as follows:

module use "/project/hpcteam/modules"
module load spack/spack-el7

To check if Spack is now available and you can use it, run the following command:

spack --version

Output

0.17.2

How to Use Spack to Manage Software?

Show Available Packages

The spack list command shows available packages. To show all available packages that you can install using Spack, run command:

spack list

Output

...
cquery                     nfft                                      py-parso                           r-rminer
cracklib                   nfs-ganesha                               py-partd                           r-rmpfr
cradl                      nfs-utils                                 py-particle                        r-rmpi
cram                       nghttp2                                   py-path-py                         r-rms
cray-fftw                  nginx                                     py-pathlib                         r-rmutil
cray-libsci                ngmerge                                   py-pathlib2                        r-rmysql
cray-mpich                 ngmlr                                     py-pathos                          r-rnaseqmap
cray-mvapich2              ngspice                                   py-pathspec                        r-rncl
creduce                    nicstat                                   py-pathtools                       r-rnexml
cromwell                   nim                                       py-patool                          r-rngtools
cromwell-womtool           ninja                                     py-patsy                           r-rnoaa
cronie                     ninja-fortran                             py-pauvre                          r-robust
...

You can use the spack list command to query a package. Spack automatically adds wildcards to both ends of the string, or you can add your own wildcards. For example, to show all available Python packages, use py-* which means packages the start with py- and end with anything, as shown below:

spack list 'py-*'

Output

py-3to2                                   py-docopt                    py-moviepy                 py-pythran
py-4suite-xml                             py-docutils                  py-mpi4py                  py-pytimeparse
py-abcpy                                  py-docutils-stubs            py-mpld3                   py-pytools
py-abipy                                  py-dominate                  py-mpmath                  py-pytorch-gradual-warmup-lr
py-absl-py                                py-dotnetcore2               py-mrcfile                 py-pytorch-lightning
py-accimage                               py-doxypy                    py-msal                    py-pytorch-sphinx-theme
py-acme-tiny                              py-doxypypy                  py-msal-extensions         py-pytweening
py-adal                                   py-dp-gp-cluster             py-msgpack                 py-pytz
py-adb-enhanced                           py-dpath                     py-msgpack-numpy           py-pyudev
py-addict                                 py-drmaa                     py-msrest                  py-pyugrid
py-adios                                  py-dryscrape                 py-msrestazure             py-pyusb
...

Installing Packages

Installing a package with Spack is very simple. Syntax

spack install <package_name>

For example, to install the tmux package, run command:

spack install tmux

Once the package is installed successfully, a module is created where you can load in your envrunment to use the package.

To find the correct module name to load, run command:

module spider tmux

Output

------------------------------------------------------------------------------------------------------------------------------------------------------------
  tmux: tmux/3.2a-kvccbsg
------------------------------------------------------------------------------------------------------------------------------------------------------------

    You will need to load all module(s) on any one of the lines below before the "tcl/8.6.12-ukuy5os" module is available to load.

      spack/spack-el7
...

To load the tmux module run command:

module load tmux/3.2a-kvccbsglk

For more details visit Spack documentation.