Install Spack -- The HPC Package Manager and Configure its Shell Environment
Spack, the supercomputer tool for HPC libraries and dependencies building, has been around quite a while in HPC community and almost appear on any big machine. It offers extremely comprehensive control of package building, such as the versions of target package, versions of dependencies of target package, compilers and their version.
One of many significant features, which make Spack such handy tool for resolving HPC toolchains, is building configurations. Spec variants are the kernel concepts of this feature. Spec variants
of spack package cover mostly the building configuration flags of CMake or Make, the compiler flags and the linker flags. They are the ports of building configuration of softwares.
Beside appearing frequently on cluster of supercomputing nodes, Spack also works well on workstations and laptops. This makes deployment, managements and usages of HPC toolchains much more easier than it’s used to be. For HPC developers, making this task easy is really life enjoyment.
In this short article, I want to talk about how to fast install Spack from Spack Github repo on UNIX-like operating system such as FreeBSD and GNU/Linux. I also will show a simple and necessary configuration to make Spack ready to go on daily usage. The resource I would like to quote here is Spack documentation.
Installation and environment configurations are quite easy. First, git clone
the repo in your preferred way. Either
or
would fetch spack github repo and checkout releases/v0.20
branch in /home/$USER/spack
folder.
Then we must let the operating system knows there is utilities of Spack by setting up environment variables. Spack package provides a series of shell scripts for different shells to automate this task. ls
the ~/spack/share/spack/
path to see which one is your shell needs. Here, we use bash
script setup-env.sh
as example. To automate this regular task, we would put this line
into ~/.bashrc
by running
After this, the installation is done. To test if spack works properly, we can try to run
to see the if version is right. Or do a more useful test by running
to checkout which version of hdf5
spack could offer, the building tools and dependencies, and what the spec variants
are. If your installation and configuration were right, the output should very similar with this:
- last time edited @18th. Aug. 2024