This article will explain what the Spack manager is and how to install it.
In addition, this article will also show how to submit HPC jobs using Spack.
\uD83D\uDCD8Â Description
Spack is a package manager for various setups including supercomputers, Linux, and macOS.
Spack makes installing scientific software easy.
The Spack Package Manager is not tied to a particular programming language; so as a result, you can build a specific software stack in Python or R, link to libraries written in C, C++, or Fortran, and easily swap different compilers.
📘 Installing and setting up the Spack Package Manager environment
Spack has a getting started page located here:
https://spack.readthedocs.io/en/latest/getting_started.html
Here is a summary of the Spack commands that need to be performed to install locally under a HPC account:
#1
Clone the Spack git repository within the /home directory to keep settings local per user:
git clone https://github.com/spack/spack.git
#2
Once the Github repository is cloned under the user’s home directory, a user can source their environment settings file in their terminal or use a Submission script BEFORE calling Spack commands.
. spack/share/spack/setup-env.sh
OR
source spack/share/spack/setup-env.sh
Either command above will work.
📘 Setting up the Spack Package Manager to find available HPC compiler options and installing Spack Packages
#1
Once Spack has been sourced in the previous step, a user will be able to perform Spack commands and install various packages/libraries within the Spack environment.
Spack has a basic usage page located here:
https://spack.readthedocs.io/en/latest/basic_usage.html
Usually to start installing packages, Spack would need to find the compiler.
On HPC 2.0, users can use gcc for the compiler as an example.
module load gcc/11.3.0
spack compiler find
Once the spack compiler find command is entered, Spack should see gcc/11.3.0
Once spack sees the compiler users are all set to start installing Spack Packages.
You can see which compilers are available to Spack by running either the spack compilers
or spack compiler list
command.
#2
Here is an example command to install a Spack package and specify a version.
To install a Spack package is very simple.
The command that can be performed is the following:
spack install packagenamehere
To install a specific version, the command will change to the following.
spack install packagenamehere@Version.#.here
The Spack package manager should find the specific software and install the needed dependencies along with the given software package.
The following page explains how to view a list of available software.
https://spack.readthedocs.io/en/latest/basic_usage.html
#3
If you would like to use the spack module that was installed in a Slurm job, spack would need to be sourced WITHIN the submission script.
HPC 2.0 will have a new partition scheme.
To submit to a specific node architecture part of a team’s priority, a user can specify the general partition and target the AMD architecture:
#!/bin/bash
#SBATCH -N 1
#SBATCH -n 126
#SBATCH -p general
#SBATCH --constraint='epyc128'
. spack/share/spack/setup-env.sh (or the following command: source spack/share/spack/setup-env.sh)
spack load spackpackagenamehere
module load yourothermoduleshere
runyourcodehere
#4
The above should allow users to run the needed code depending on the package/software needs.
To view the package list for any other Spack packages that a user would like to install, the following page can be accessed:
https://spack.readthedocs.io/en/latest/package_list.html
Also, some SPACK packages will depend on the type of CPU architecture, to have a spack package installed on a specific or different CPU architectures, the spack install packagename command can be placed in the submission script above.
Placing the spack install packagename in the submission script will allow user(s) to install a specific SPACK package on a different CPU architecture outside of the initial login nodes.