USE OF Spack

Spack ( https://github.com/spack/spack ) is an automated HPC software package manager, and is now part of High Performance Software Foundation (HPSF). Spack provides recipes for building more than 8000 packages suitable for multi-node, GPU accelerated computing environment. These packages include fluidynamics simulation, bioinformatics, finite-element methods, and meteorology.

Getting Started

Spack is loaded by default, you can check the spack installation in login node by:

$ which spack
spack ()
{ 
   : this is a shell function from: /opt/shared/spack/share/spack/setup-env.sh;
   : the real spack script is here: /opt/shared/spack/bin/spack;
   _spack_shell_wrapper "$@";
   return $?
}

 

Spack is designed to save all of your custom configurations, environments, software installations (binaries, scripts, source code), and generated module files into a designated folder within your home directory ~/.spack, modules are exported as a module that can be module load for use.

  • ~/.spack/local: apps install location
  • ~/.spack/environments: installation environments
  • ~/.spack/lmod: modulefiles path
  • ~/.spack/source: packages source directory

It is important to note that deleting this folder will result in the permanent deletion of all custom configurations,

 

To check available packages on spack for installation:

$ spack list lammps

which is same as the information provided by the Spack repository website: https://packages.spack.io/

 

To check information including all versions and build options of a package and then the building dependencies, you may use:

$ spack info lammps
$ spack spec lammps

To install a new package with Spack preferred version or a specific version

$ spack install lammps
or
$ spack install lammps@20240207.1

Depending on the size of package, installation time may vary from several seconds to several hours

On successful, the package is installed under your home directory and available to load with environment module:

$ module avail
--------------------------------------------- /home/USER/.spack/lmod/Core ---------------------------------------------
   lammps/20230802.3-g56lbmu

--------------------------------------------- /opt/shared/spack/lmod/Core ----------------------------------------------
   aocc/4.2.0-qpqu2gf               gcc/12.3.0-5x7uqys                             mpich/4.2.1-begklur
   cmake/3.27.9-azi4m5i             gcc/13.2.0-nefmpti                      (D)    nvhpc/24.3-qpzgbwq
   cuda/11.8.0-nctwsal              intel-oneapi-compilers/2023.2.4-57qdwc2        openblas/0.3.26-jpipmfm
   cuda/12.4.0-uhdfj7w       (D)    intel-oneapi-compilers/2024.1.0-imjimv2 (D)    openmpi/5.0.3-65bzfqx
   cudnn/8.9.7.29-12-ndz4fnc        intel-oneapi-mkl/2024.0.0-d3piu27              pmix/5.0.1-evqhfgt
   emacs/29.3-wufu3b6               intel-oneapi-mpi/2021.12.1-cecwr4h
   flexiblas/3.4.2-it7qvck          llvm/17.0.6-keqsohx

  Where:
   D:  Default Module

If it does not appear, check that the installation is completed without error, and try

$ spack module lmod refresh

Load the package module, all dependencies will be loaded along with the package.

$ module load lammps
$ module list

Currently Loaded Modules:
  1) gcc-runtime/11.4.1-ahrtqhe   7) ncurses/6.5-7vqgpuy      13) pmix/5.0.2-bvlbelo
  2) glibc/2.34-xri56vc           8) hwloc/2.9.3-x5taend      14) openmpi/5.0.3-osrdpgu
  3) libpciaccess/0.17-no5k4qa    9) openssl/3.3.1-7ncqyb7    15) fftw/3.3.10-nnl52im
  4) xz/5.4.6-33q6vql            10) libevent/2.1.12-s7nsnle  16) lammps/20230802.3-g56lbmu
  5) zlib-ng/2.1.6-zz4exat       11) numactl/2.0.14-ywp3ada
  6) libxml2/2.10.3-xsx2vvv      12) openssh/9.7p1-w4kuyux

You can find the package being added to your executable path

$ which lmp
/home/USER/.spack/local/linux-rocky9-x86_64_v4/gcc-11.4.1/lammps-20230802.3-g56lbmu6ygakbqd3kyygr4ctllccdons/bin/lmp

To locate the installation directory of the package

$ spack location -i lammps
/home/USER/.spack/local/linux-rocky9-x86_64_v4/gcc-11.4.1/lammps-20230802.3-g56lbmu6ygakbqd3kyygr4ctllccdons

To uninstall the package and its associated module file

$ spack uninstall lammps
 
Selecting compilers

Multiple compilers and compiler versions are available for building software using Spack on HPC 4

You may check the availability of compilers:

$ spack compilers
or
$ spack compiler list
==> Available compilers
-- aocc rocky9-x86_64 -------------------------------------------
aocc@4.2.0

-- clang rocky9-x86_64 ------------------------------------------
clang@17.0.6

-- gcc rocky9-x86_64 --------------------------------------------
gcc@13.2.0  gcc@12.3.0  gcc@11.4.1

-- intel rocky9-x86_64 ------------------------------------------
intel@2021.10.0

-- nvhpc rocky9-x86_64 ------------------------------------------
nvhpc@24.3  nvhpc@23.11

-- oneapi rocky9-x86_64 -----------------------------------------
oneapi@2024.1.0  oneapi@2023.2.4

To select a specific compiler to build the software:

$ spack install lammps%gcc@13.2.0

which a compiler is specified with % and its version using @