A Quick Look at Spack - NERSC/spack GitHub Wiki

What is Spack?

The Supercomputing PACKage manager is a tool developed at Lawrence Livermore National Laboratory to help automate the installation of complex scientific software on high performance computers. Current version is v0.10. Spack allows for customizing package installs via a spec syntax.

Examples

# Install a particular version by appending @
$ spack install [email protected]

# Specify a compiler (and its version), with %
$ spack install [email protected] %[email protected]

# Add special compile-time options by name
$ spack install [email protected] %[email protected] debug=True

# Add special boolean compile-time options with +
$ spack install [email protected] %[email protected] +debug

# Add compiler flags using the conventional names
$ spack install [email protected] %[email protected] cppflags="-O3 -floop-block"

# Cross-compile for a different architecture with target=
$ spack install [email protected] target=mic_knl

How to get Spack?

If you don't have git installed make sure to install it on your system. Then you can either:

  1. Fork the LLNL repo of Spack git clone https://github.com/LLNL/spack.git
  2. Fork the NERSC repo of Spack https://github.com/NERSC/spack.git

The difference between the two is that the NERSC repo has NERSC specific features while the LLNL repo will be a bit more up to date.

Using Spack

It's as easy as:
spack install libelf

Users can also specify the compiler and compiler version:

spack install libelf%gcc  
spack install libelf%[email protected]

Users can also specify any variants:

# Turn off shared libraries
spack install libelf~shared

Some packages can also have multi-valued variants:

# Enable dataspaces staging transports for adios
spack install adios staging=dataspaces

Spec Cheatsheet

Parameter Spec Symbol What it does
package python Name of the package you want to install
compiler % Specify the compiler
variant +/~ Turn on feature/ Turn off feature
dependency ^ Used to manipulate dependency spec
architecture arch= target= os= Specify the architecture (autodetected for you)
compiler flags ldflags= cppflags= cxxflags= Specify any compiler flags

That's Pretty Much It!

That's all there is to use Spack. No special setup is required. If however you are interested in customizing Spack then there are *.yaml files available to configure. For more information read: Configuration Files in Spack

Definitions

spec: A specialized syntax used to specify a package. Used on the command line and can be queried.

virtual: A package with many different implementations, e.g mpi is an virtual dependency and could represent mpich, mvapich, openmpi etc.

concretization: A fixed-point algorithm used to fully specify how a package will be installed. A spec is considered concrete when all parameters of a package are specified. In other words a software stack of packages is unique with a unique compiler, dependencies and variants.

package file: A package file is the template recipe used by Spack to encapsulate all the different ways a package can be installed