Spack

What is Spack?

While Modules provide a wide range of pre-installed software, users may need specific versions or packages that are not available.

In these cases, Spack can be used to build and manage a custom software stack directly in the user environment.

Spack is a package manager designed for HPC systems that allows users to:

  • install software without administrative privileges

  • manage multiple versions and configurations

  • handle complex dependencies automatically

Spack complements the Modules system:

  • Modules provide centrally installed software

  • Spack allows users to build their own software environment

Spack makes installing scientific software easy. Spack isn’t tied to a particular language; you can build a software stack in Python or R, link to libraries written in C, C++, or Fortran, and easily swap compilers or target specific microarchitectures.

How set up Spack in user environment

module load spack-<version>

To summarize:

System

Spack version

Supported shells

Requirement

Command

CRESCO8

0.23.1,1.0.2

all

none

module load spack-<version>

CRESCO7

0.23.0

all

none

module load spack-0.23.0

XCRESCO

0.23.0

all

none

module load spack-0.23.0

CRESCO6

0.23.0

/bin/bash /bin/sh

module load scipy39

module load spack-0.23.0

How to use Spack

Search a software

spack list octave

octave  octave-arduino  octave-control  octave-gsl  octave-instrctl  octave-io  octave-optim  octave-quaternion  octave-signal  octave-splines  octave-statistics  octave-struct  octave-symbolic
==> 13 packages

Get info about a software

spack info octave

AutotoolsPackage:   octave

Description:
   GNU Octave is a high-level language, primarily intended for numerical
   computations. It provides a convenient command line interface for
   solving linear and nonlinear problems numerically, and for performing
   other numerical experiments using a language that is mostly compatible
   with Matlab. It may also be used as a batch-oriented language.

Homepage: https://www.gnu.org/software/octave/

Preferred version:
   9.1.0    https://ftpmirror.gnu.org/octave/octave-9.1.0.tar.gz

Safe versions:
   9.1.0    https://ftpmirror.gnu.org/octave/octave-9.1.0.tar.gz
   8.4.0    https://ftpmirror.gnu.org/octave/octave-8.4.0.tar.gz

Deprecated versions:
   None

Variants:
   arpack [false]                  false, true
       Use arpack
   build_system [autotools]        autotools
       Build systems supported by the package
   bz2 [true]                      false, true
       Use bzip2

Build Dependencies:
   arpack-ng  bzip2  fftw-api  fontconfig  gl     glpk   gnuconfig  hdf5         java    llvm  pcre2      qhull     qscintilla  readline      texinfo
   blas       curl   fltk      freetype    gl2ps  gmake  gnuplot    imagemagick  lapack  pcre  pkgconfig  qrupdate  qt          suite-sparse  zlib-api

Link Dependencies:
   arpack-ng  bzip2  fftw-api  fontconfig  gl     glpk     hdf5         java    llvm  pcre2  qrupdate    qt        suite-sparse
   blas       curl   fltk      freetype    gl2ps  gnuplot  imagemagick  lapack  pcre  qhull  qscintilla  readline  zlib-api

Run Dependencies:
   None

Licenses:
GPL-3.0-or-later

Install a software

Note

N.B.: Error during ncurses installation on AFS

If a software depends on ncurses package then software installation by means spack will be not completed and an error message will be reported as following:

/usr/sbin/ldconfig: Can't create temporary cache file /etc/ld.so.cache~: Permission denied

This event is known on ncurses documentation by this note:

“USING NCURSES WITH AFS: AFS treats each directory as a separate logical filesystem, you can’t hard-link across them. The –enable-symlinks option copes with this by making tic use symbolic links.”

Workaround: From https://github.com/spack/spack/issues/8675 a simple way to install ncurses via spack is to enabling the the use of symbolic links creation instead hard links, i.e: spack install ncurses+symlinks

By default, spack creates an hidden directory named .spack into user home. Below, an example of octave installation via spack by workaround ncurses error:

spack install octave^ncurses+symlinks
[+] /usr (external glibc-2.34-l3ukyqeboaxys3yum525zfxkzbsuljrh)
[+] /userhome/.spack/opt/spack/linux-almalinux9-skylake_avx512/gcc-11.3.1/gcc-runtime-11.3.1-aphao5cskj5j7lufcrn23sn7vo3as2jb
[+] /userhome/.spack/opt/spack/linux-almalinux9-skylake_avx512/gcc-11.3.1/pcre2-10.43-6iugizgfqsvaj5cu7hecjgis72pu5evi
[+] /userhome/.spack/opt/spack/linux-almalinux9-skylake_avx512/gcc-11.3.1/ncurses-6.5-4la6oeefwiying2qbaq52jg5uk6csnvs
[+] /userhome/.spack/opt/spack/linux-almalinux9-skylake_avx512/gcc-11.3.1/openblas-0.3.27-u5zltiouimdktyfm2rbpuoh4fcrihc5m
[+] /userhome/.spack/opt/spack/linux-almalinux9-skylake_avx512/gcc-11.3.1/bzip2-1.0.8-dlk26nltz2kcgtg5rnkwiy3yrdov62cm
[+] /userhome/.spack/opt/spack/linux-almalinux9-skylake_avx512/gcc-11.3.1/readline-8.2-ikqnu623xqzlzunqonnf3z4reut4ob5b
[+] /userhome/.spack/opt/spack/linux-almalinux9-skylake_avx512/gcc-11.3.1/octave-9.1.0-x5dmrnjlfmvexwqvlppje2mrp7plql32

mv .spack .spack_20241015

spack install octave^ncurses+symlinks

==> Fetching https://mirror.spack.io/bootstrap/github-actions/v0.5/build_cache/linux-centos7-x86_64-gcc-10.2.1-clingo-bootstrap-spack-bhqgwuvef354fwuxq7heeighavunpber.spec.json
==> Fetching https://mirror.spack.io/bootstrap/github-actions/v0.5/build_cache/linux-centos7-x86_64/gcc-10.2.1/clingo-bootstrap-spack/linux-centos7-x86_64-gcc-10.2.1-clingo-bootstrap-spack-bhqgwuvef354fw
uxq7heeighavunpber.spack
==> Installing "clingo-bootstrap@=spack%gcc@=10.2.1~docs+ipo+optimized+python+static_libstdcpp build_system=cmake build_type=Release generator=make patches=bebb819,ec99431 arch=linux-centos7-x86_64" from
a buildcache
[+] /usr (external glibc-2.34-l3ukyqeboaxys3yum525zfxkzbsuljrh)
==> Installing gcc-runtime-11.3.1-aphao5cskj5j7lufcrn23sn7vo3as2jb [2/22]
==> octave: Executing phase: 'build'
==> octave: Executing phase: 'install'
==> octave: Successfully installed octave-9.1.0-x5dmrnjlfmvexwqvlppje2mrp7plql32

Stage: 1.12s.  Autoreconf: 0.00s.  Configure: 1m 5.71s.  Build: 4m 15.51s.  Install: 33.36s.  Post-install: 2.86s.  Total: 5m 59.14s
[+] /userhome/.spack/opt/spack/linux-almalinux9-skylake_avx512/gcc-11.3.1/octave-9.1.0-x5dmrnjlfmvexwqvlppje2mrp7plql32

Launch a software

spack load octave
octave

GNU Octave, version 9.1.0
Copyright (C) 1993-2024 The Octave Project Developers.

Octave was configured for "x86_64-pc-linux-gnu".

octave:1>

Additional Information

Source URL: