This lesson is being piloted (Beta version)

The new Spack code management system

Overview

Teaching: 15 min
Exercises: 5 min
Questions
  • How are different software versions handled?

Objectives
  • Understand the role of Spack

Table of Contents for 04-Spack

Note

UPS is being replaced by a new spack system for Alma9.

An important requirement for making valid physics results is computational reproducibility. You need to be able to repeat the same calculations on the data and MC and get the same answers every time. You may be asked to produce a slightly different version of a plot for example, and the data that goes into it has to be the same every time you run the program.

This requirement is in tension with a rapidly-developing software environment, where many collaborators are constantly improving software and adding new features. We therefore require strict version control; the workflows must be stable and not constantly changing due to updates.

DUNE must provide installed binaries and associated files for every version of the software that anyone could be using. Users must then specify which version they want to run before they run it. All software dependencies must be set up with consistent versions in order for the whole stack to run and run reproducibly.

Spack is a tool to handle the software product setup operation.

Minimal spack for root analysis and file access

You can get spack going with our minimal implementation

. /cvmfs/dune.opensciencegrid.org/spack/setup-env.sh
spack env activate dune-prototype

Use the Al9 setup example for a more complete setup experience.

This sets up the file and job management packages (metacat, rucio, justin) and a version of root that can do streaming transfers. It is useful for end stage tuple analysis.

It now also sets up a version of larsoft.

What is in spack?

You can list what is available in that environment via

spack find

Which lists packages like this:

==> In environment dune-prototype (74 root specs)
[^] art              [^] dunecore            [^] geant4           [^] lardataobj         [^] nuevdb
[^] art-root-io      [^] dunedaqdataformats  [^] geant4reweight   [^] lareventdisplay    [^] nufinder
[^] awscli           [^] dunedataprep        [^] gfal2-util       [^] larevt             [^] nug4
[^] canvas           [^] dunedetdataformats  [^] hep-concurrency  [^] larexamples        [^] nugen
[^] canvas-root-io   [^] duneexamples        [^] hypotcode        [^] larg4              [^] nurandom
[^] cetlib           [^] duneopdet           [^] ifdh-art         [^] larpandora         [^] nusimdata
[^] cetlib-except    [^] dunepdlegacy        [^] ifdhc            [^] larpandoracontent  [^] nutools
[^] cetmodules       [^] duneprototypes      [^] ifdhc-config     [^] larreco            [^] poms-client
[^] critic           [^] dunereco            [^] k5arc            [^] larrecodnn         [^] protoduneana
[^] data-dispatcher  [^] dunesim             [^] larana           [^] larsim             [^] py-merge-utils
[^] dk2nudata        [^] dunesw              [^] larcore          [^] larsimdnn          [^] py-rucio-clients
[^] dk2nugenie       [^] duneutil            [^] larcorealg       [^] larsimrad          [^] r-m-dd-config
[^] duneana          [^] fhicl-cpp           [^] larcoreobj       [^] larwirecell        [^] sam-web-client
[^] duneanaobj       [^] fife-utils          [^] lardata          [^] messagefacility    [^] snakemake
[^] dunecalib        [^] gallery             [^] lardataalg       [^] metacat

-- linux-almalinux9-x86_64 / no compilers -----------------------
autoconf@2.69       expat@2.5.0        gdbm@1.19     groff@1.22.4   libxft@2.3.3    nasm@2.15.03     pkg-config@1.7.3
automake@1.16.2     findutils@4.8.0    gettext@0.21  krb5@1.20.1    libxml2@2.9.13  ncurses@6.2      texinfo@6.7
berkeley-db@5.3.28  flex@2.6.4         git@2.39.3    libice@1.0.10  libxpm@3.5.13   ninja@1.10.2     util-linux-uuid@2.37.4
bison@3.7.4         fontconfig@2.14.0  glib@2.68.4   libsm@1.2.3    m4@1.4.19       openssh@8.7p1    xextproto@7.3.0
coreutils@8.32      freetype@2.10.4    glibc@2.34    libtool@2.4.6  m4@1.4.19       openssl@3.0.7    xproto@7.0.33
curl@7.76.1         gawk@5.1.0         gmake@4.3     libx11@1.7.0   mesa@22.3.0     patchelf@0.15.0  zlib@1.2.11
diffutils@3.7       gcc@11.5.0         gmake@4.3     libxext@1.3.4  mesa-glu@9.0.1  perl@5.32.1

-- linux-almalinux9-x86_64_v2 / %c,cxx=gcc@11.5.0 ---------------
binutils@2.43.1  gcc@12.5.0  gmp@6.3.0  hwloc@2.13.0  isl@0.26  zstd@1.5.7

-- linux-almalinux9-x86_64_v2 / %c=gcc@11.5.0 -------------------
libpciaccess@0.17  mpc@1.3.1  mpfr@4.2.2

-- linux-almalinux9-x86_64_v2 / no compilers --------------------
autoconf-archive@2024.10.16  compiler-wrapper@1.0  gcc-runtime@11.5.0  glibc@2.34

-- linux-almalinux9-x86_64_v3 / %c,cxx,fortran=gcc@12.5.0 -------
lhapdf@6.5.5  openblas@0.3.30  openmpi@5.0.10  py-scikit-build-core@0.12.2

-- linux-almalinux9-x86_64_v3 / %c,cxx=gcc@11.5.0 ---------------
binutils@2.46.0  gcc@12.5.0  gmp@6.3.0  isl@0.26  zstd@1.5.7

-- linux-almalinux9-x86_64_v3 / %c,cxx=gcc@12.5.0 ---------------
art@3.14.04                 duneutil@10.22.00d01      larevt@10.00.21              pcre@8.45
art-root-io@1.13.06         eigen@3.4.1               larexamples@10.02.02         postgresql@17.6
artdaq-core@v3_11_01        fhicl-cpp@4.18.04         larg4@10.20.05               ppfx@02.20.09
artg4tk@13.00.00            fmt@12.1.0                larpandora@10.04.00          protobuf@3.20.3
bazel@6.5.0                 fp16@2020-05-14           larpandoracontent@05.02.01   protoduneana@10.22.00d01
boost@1.82.0                ftgl@2.4.0                larreco@10.06.07             psimd@2020-05-17
bxdecay0@1.1.0              fxdiv@2020-04-17          larrecodnn@10.04.00          pthreadpool@2023-08-29
c-ares@1.28.1               gallery@1.22.06           larsim@10.20.05              py-cython@0.29.36
canvas@3.16.04              geant4@11.2.2             larsimdnn@10.02.05           py-cython@3.2.4
castxml@0.6.11              geant4reweight@01.23.02   larsimrad@10.01.06           py-gfal2-python@1.13.0
cetlib@3.18.02              genie@3.06.02             larvecutils@09.04.03         py-grpcio@1.62.2
cetlib-except@1.09.01       gfal2@2.23.0              larwirecell@10.03.09         py-grpcio-tools@1.62.2
clhep@2.4.7.1               go@1.26.1                 libffi@3.5.2                 py-numpy@1.26.4
cmake@3.31.11               go-jsonnet@0.22.0         libjpeg-turbo@3.1.3          py-tensorflow@2.17.1
cpuinfo@2025-11-14          googletest@1.17.0         libpng@1.6.55                py-torch@2.10.0
critic@2.13.06              grpc@1.50.0               libwda@2.30.1                pythia8@8.317
cry@1.7                     gsoap@2.8.135             llvm@18.1.8                  python@3.11.15
cusparselt@0.8.1-cuda120    hep-concurrency@1.09.02   log4cpp@1.1.3                root@6.28.12
davix@0.8.10                hep-hpc@0_15_00           lz4@1.10.0                   rsync@3.4.1
delaunator-cpp@1.0.0        hepmc@2.06.11             marley@1.2.1                 rust@1.92.0
dk2nudata@01.12.00          highfive@2.10.1           messagefacility@2.10.05      swig@4.4.1
dk2nugenie@01.12.00         icu4c@76.1                nlohmann-json@3.12.0         systematicstools@01.04.04
doxygen@1.16.1              ifbeam@2.6.3              nucondb@2_6_3                torch-scatter@2.1.2
duneana@10.22.00d01         ifdh-art@2.17.08          nuevdb@1.09.15               trace@v3_24_00
duneanaobj@04.00.00         ifdhc@2.8.0               nug4@1.17.03                 triton@25.09
dunecalib@10.22.00d01       ifdhc-config@2.8.0        nugen@1.23.04                unuran@1.11.0
dunecore@10.22.00d01        jsonnet@0.21.0            nuhepmc-cmake-modules@0.2.5  valgrind@3.26.0
dunedataprep@10.22.00d01    larana@10.02.07           nurandom@1.11.06             vdt@0.4.6
duneexamples@10.22.00d01    larcore@10.00.05          nusimdata@1.29.03            wire-cell-toolkit@0.37.0
duneopdet@10.22.00d01       larcorealg@10.00.05       nusystematics@1.05.07        wiredtiger@10.0.0
dunepdlegacy@1.01.05        larcoreobj@10.00.02       nutools@3.22.01              xerces-c@3.3.0
duneprototypes@10.22.00d01  lardata@10.00.18          nvtx@3.3.0                   xrootd@5.9.1
dunereco@10.22.00d01        lardataalg@10.02.03       openldap@2.6.8               xxhash@0.8.3
dunesim@10.22.00d01         lardataobj@10.05.02       pandoramonitoring@5.0.0      yaml-cpp@0.8.0
dunesw@10.22.00d01          lareventdisplay@10.01.07  pandorasdk@5.0.0

-- linux-almalinux9-x86_64_v3 / %c,fortran=gcc@12.5.0 -----------
fftw@3.3.10  pythia6@6.4.28

-- linux-almalinux9-x86_64_v3 / %c=gcc@11.5.0 -------------------
mpc@1.3.1  mpfr@4.2.2

-- linux-almalinux9-x86_64_v3 / %c=gcc@12.5.0 -------------------
bash@5.3           gzip@1.14                  libssh2@1.11.1   popt@1.19               py-protobuf@3.20.3  sqlite@3.51.2
bzip2@1.0.8        hdf5@1.12.3                libxcrypt@4.5.2  prrte@4.1.0             py-psutil@7.2.2     unzip@6.0
cyrus-sasl@2.1.28  intel-oneapi-tbb@2022.3.1  libyaml@0.2.5    py-h5py@3.13.0          py-psycopg2@2.9.11  xz@5.8.2
dcap@2.47.14       isa-l@2.31.1               lua@5.3.6        py-immutables@0.21      py-rpds-py@0.27.1   yasm@1.3.0
giflib@5.2.2       json-c@0.18                numactl@2.0.19   py-markupsafe@3.0.2     py-wrapt@1.17.3     zip@3.0
gl2ps@1.4.2        libedit@3.1-20240808       patch@2.8        py-maturin@1.10.2       readline@8.3
glew@2.2.0         libevent@2.1.12            pcre2@10.44      py-meson-python@0.19.0  rngstreams@1.0.1
grep@3.12          libgit2@1.9.1              perl@5.42.0      py-pbr@5.10.0           sed@4.9
gsl@2.8            libiconv@1.18              pmix@6.1.0       py-poetry-core@2.2.0    sleef@3.8

-- linux-almalinux9-x86_64_v3 / %cxx=gcc@12.5.0 -----------------
abseil-cpp@20230802.1   cryptopp@8.9.0  py-ml-dtypes@0.4.0        range-v3@0.12.0             spdlog@1.16.0
canvas-root-io@1.13.06  hepmc3@3.3.1    py-pybind11@3.0.1         rapidjson@1.2.0-2024-08-16
catch2@3.8.0            jsoncpp@1.9.6   py-python-rapidjson@1.10  re2@2023-09-01

-- linux-almalinux9-x86_64_v3 / no compilers --------------------
autoconf-archive@2024.10.16  py-charset-normalizer@3.4.4            py-pyproject-metadata@0.11.0
awscli@1.29.41               py-click@8.3.1                         py-python-dateutil@2.8.2
cetbuildtools@8.20.00        py-colorama@0.4.4                      py-pythreader@2.15.0
cetmodules@3.27.04           py-conda-inject@1.3.1                  py-pyyaml@6.0.3
compiler-wrapper@1.0         py-configargparse@1.7.1                py-referencing@0.36.2
cuda@12.6.3                  py-connectionpool@0.0.3                py-requests@2.32.5
cudnn@8.9.7.29-12            py-decorator@5.2.1                     py-reretry@0.11.8
data-dispatcher@2.0.3        py-docutils@0.16                       py-rich@14.3.2
dunedaqdataformats@4.4.5     py-dogpile-cache@1.3.3                 py-rsa@4.7.2
dunedetdataformats@4.4.6     py-dpath@2.2.0                         py-rucio-clients@38.5.1
fife-utils@3.7.7             py-fastjsonschema@2.21.2               py-s3transfer@0.6.2
g4abla@3.3                   py-filelock@3.19.1                     py-semantic-version@2.10.0
g4emlow@8.5                  py-flatbuffers@25.9.23                 py-setuptools@79.0.1
g4ensdfstate@2.3             py-flit-core@3.12.0                    py-setuptools-rust@1.12.0
g4incl@1.2                   py-fsspec@2025.9.0                     py-setuptools-scm@9.2.2
g4ndl@4.7.1                  py-gast@0.6.0                          py-six@1.17.0
g4particlexs@4.0             py-geventhttpclient@1.4.4              py-smart-open@5.2.1
g4photonevaporation@5.7      py-gitdb@4.0.9                         py-smmap@5.0.0
g4pii@1.3                    py-gitpython@3.1.43                    py-snakemake-interface-common@1.22.0
g4radioactivedecay@5.6       py-google-pasta@0.2.0                  py-snakemake-interface-executor-plugins@9.3.2
g4realsurface@2.2            py-hatch-fancy-pypi-readme@25.1.0      py-snakemake-interface-logger-plugins@2.0.0
g4saiddata@2.0               py-hatch-nodejs-version@0.3.2          py-snakemake-interface-report-plugins@1.3.0
g4tendl@1.4                  py-hatch-vcs@0.5.0                     py-snakemake-interface-scheduler-plugins@2.0.2
gcc-runtime@11.5.0           py-hatchling@1.27.0                    py-snakemake-interface-storage-plugins@4.2.3
gcc-runtime@12.5.0           py-humanfriendly@10.0                  py-srproxy@00.45
gcc-runtime@12.5.0           py-idna@3.10                           py-stevedore@5.4.0
geant4-data@11.2.2           py-jinja2@3.1.6                        py-sympy@1.14.0
genie-phyopt@3.04.00         py-jmespath@1.0.1                      py-tabulate@0.9.0
genie-xsec@3.04.00           py-jsonschema@4.25.1                   py-tensorboard@2.17.1
gfal2-util@1.9.0             py-jsonschema-specifications@2025.9.1  py-tensorboard-data-server@0.7.0
glx@1.4                      py-jupyter-core@5.8.1                  py-termcolor@3.1.0
go-bootstrap@1.24.13         py-lark@1.3.1                          py-throttler@1.2.2
hypotcode@2.1                py-libclang@18.1.1                     py-tomli@2.0.1
justin@01.06.04              py-markdown@3.4.1                      py-tqdm@4.67.1
k5arc@v1_4                   py-markdown-it-py@4.0.0                py-traitlets@5.14.3
larcv2@2_2_6                 py-mdurl@0.1.2                         py-trove-classifiers@2025.9.11.17
larfinder@develop            py-merge-utils@1.0.2                   py-typing-extensions@4.15.0
larsoft-data@1.02.02         py-mpmath@1.3.0                        py-urllib3@1.26.20
meson@1.10.1                 py-nbformat@5.10.4                     py-webpie@5.16.3
metacat@4.1.4                py-networkx@2.7.1                      py-werkzeug@3.1.3
nufinder@1.03.01             py-opt-einsum@3.4.0                    py-wheel@0.45.1
openjdk@11.0.23_9            py-packaging@25.0                      py-wsdbtools@1.9.3
pandorapfa@5.1.0             py-pathspec@0.12.1                     py-yte@1.5.7
perl-data-dumper@2.173       py-pip@25.1.1                          python-venv@1.0
poms-client@4.5.2            py-pkgconfig@1.5.5                     r-m-dd-config@1.9
py-absl-py@1.4.0             py-plac@1.4.5                          rstartree@0.2
py-appdirs@1.4.4             py-platformdirs@4.4.0                  rust-bootstrap@1.92.0
py-argparse-dataclass@2.0.0  py-pluggy@1.6.0                        sam-web-client@3.6
py-astunparse@1.6.3          py-pulp@2.6.0                          snakemake@9.14.0
py-attrs@25.3.0              py-pyasn1@0.4.8                        util-macros@1.20.2
py-botocore@1.31.41          py-pygccxml@3.0.2                      wire-cell-data@0.2.0
py-calver@2025.10.20         py-pygments@2.19.2
py-certifi@2026.1.4          py-pyjwt@2.4.0
==> 433 installed packages
==> 0 concretized packages to be installed (show with `spack find -c`)

This particular environment loads only one version of most of the packages.

Spack commands

You can find a list of common spack commands for DUNE here

There is a larsoft release in spack now

spack find dunesw
-- linux-almalinux9-x86_64_v3 / %c,cxx=gcc@12.5.0 ---------------
dunesw@10.22.00d01
==> 1 installed package

You can use it with released code and your own fcls. To modify you need to try out the new tools described in the next section.

Tools to build code against spack releases - under development

You can find tools for building/developing code here

Also the PYTHONPATH describes where Python modules will be loaded from.

Try

which root

to see the version of root that spack sets up. Try it out!

Spack basic commands

Command Action
spack list List everything spack knows about
spack find Displays what is available in your environment
spack load Load a package
spack unload Unload a package

Key Points

  • Spack is a tool to deliver well defined software configurations

  • CVMFS distributes software and related files without installing them on the target computer (using a VM, Virtual Machine).