Installations with Spack

As a user of large-scale Linux systems both at a university and at a national laboratory, I often find myself needing to use software that isn’t available at a system level. In some cases, it’s possible to make a request for that application to be added by the system administrators, but, more often than not, I’ll need to install the application locally if I want to use it. Spack makes this process really easy.

First step is to download Spack from github:

git clone https://github.com/spack/spack.git

Next, add the spack/bin directory to your PATH:

export PATH=<path/to/spack>/bin:$PATH

Now you can list all the applications that can be installed using:

spack list

And get a list of information about each application with:

spack info <application>

By default, Spack will install all the prerequisites that it can’t find on the system, and it doesn’t do a great job of finding them. To specify where applications are already installed, create a .spack directory in your home directory. Within that directory, create a packages.yaml file.

To point to an installation of OpenMPI v3.12, built with gcc v4.85, and also point to an installation of cmake v3.70, add the following to packages.yaml:

packages:
openmpi:
buildable: False
paths:
openmpi@3.1.2%gcc@4.8.5: /opt/openmpi-3.1.2
cmake:
buildable: False
paths:
cmake@3.7.0: /usr/local/bin/cmake

Now, instead of building openmpi and cmake (both of which can take a fair amount of time and space), Spack will use these existing installations.

Finally, you can perform the Spack installation:

spack install <application name>

Leave a Reply

Your email address will not be published. Required fields are marked *