Basic Installation Tutorial¶
This tutorial will guide you through the process of installing software using Spack. We will first cover the spack install command, focusing on the power of the spec syntax and the flexibility it gives to users. We will also cover the spack find command for viewing installed packages and the spack uninstall command. Finally, we will touch on how Spack manages compilers, especially as it relates to using Spack-built compilers within Spack. We will include full output from all of the commands demonstrated, although we will frequently call attention to only small portions of that output (or merely to the fact that it succeeded). The provided output is all from an AWS instance running Ubuntu 18.04
Installing Spack¶
Spack works out of the box. Simply clone spack and get going. We will clone Spack and immediately checkout the most recent release, v0.15.
$ git clone https://github.com/spack/spack ~/spack
Cloning into '/home/spack/spack'...
remote: Enumerating objects: 32, done.
remote: Counting objects: 100% (32/32), done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 220923 (delta 10), reused 14 (delta 5), pack-reused 220891
Receiving objects: 100% (220923/220923), 87.99 MiB | 2.31 MiB/s, done.
Resolving deltas: 100% (93872/93872), done.
$ cd ~/spack
$ git checkout releases/v0.15
Branch 'releases/v0.15' set up to track remote branch 'releases/v0.15' from 'origin'.
Switched to a new branch 'releases/v0.15'
Next add Spack to your path. Spack has some nice command line
integration tools, so instead of simply appending to your PATH
variable, source the spack setup script. Then add Spack to your path.
$ . share/spack/setup-env.sh
Finally, if you are running in an Amazon Cloud9 instance (which you likely are for this tutorial), you will need to run one additional setup script:
$ . share/spack/setup-tutorial-env.sh
You should see a lot of output. This is important, as it will increase your available disk space and install some needed system software.
Once you’ve sourced these scripts, you’re good to go!
What is in Spack?¶
The spack list
command shows available packages.
$ spack list
==> 4338 packages.
abinit py-fparser
abseil-cpp py-freezegun
abyss py-fsspec
accfft py-funcsigs
The spack list
command can also take a query string. Spack
automatically adds wildcards to both ends of the string. For example,
we can view all available python packages.
$ spack list py-
==> 984 packages.
lumpy-sv py-numba
perl-file-copy-recursive py-numcodecs
py-3to2 py-numexpr
py-4suite-xml py-numexpr3
Installing Packages¶
Installing a package with Spack is very simple. To install a piece of
software, simply type spack install <package_name>
.
$ spack install zlib
==> Installing zlib
==> No binary for zlib found: installing from source
==> zlib: Executing phase: 'install'
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zlib-1.2.11-smoyzzo2qhzpn6mg6rd3l2p7b23enshg
Spack can install software either from source or from a binary cache. Packages in the binary cache are signed with GPG for security. For the tutorial we have prepared a binary cache so you don’t have to wait on slow compilation from source. To be able to install from the binary cache, we will need to configure Spack with the location of the binary cache and trust the GPG key that the binary cache was signed with.
$ spack mirror add tutorial s3://spack-tutorial-container/mirror/
$ spack gpg trust share/spack/keys/tutorial.pub
gpg: keybox '/home/spack/spack/opt/spack/gpg/pubring.kbx' created
gpg: /home/spack/spack/opt/spack/gpg/trustdb.gpg: trustdb created
gpg: key 95F8681195E239D8: public key "Spack Build Pipeline (Demo Key) <key@spack.demo>" imported
gpg: Total number processed: 1
gpg: imported: 1
You’ll learn more about configuring Spack later in the tutorial, but
for now you will be able to install the rest of the packages in the
tutorial from a binary cache using the same spack install
command. By default this will install the binary cached version if it
exists and fall back on installing from source.
Spack’s spec syntax is the interface by which we can request specific
configurations of the package. The %
sigil is used to specify
compilers.
$ spack install zlib %clang
==> Installing zlib
==> Extracting zlib from binary cache
==> Installing patchelf
==> No binary for patchelf found: installing from source
==> patchelf: Executing phase: 'autoreconf'
==> patchelf: Executing phase: 'configure'
==> patchelf: Executing phase: 'build'
==> patchelf: Executing phase: 'install'
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/patchelf-0.10-2nj3vxxz5lwexpp5srseegxt7v6n4whp
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/clang-6.0.0/zlib-1.2.11-5qffmms6gwykcikh6aag4h3z4scrfdla
Note that this installation is located separately from the previous one. We will discuss this in more detail later, but this is part of what allows Spack to support arbitrarily versioned software.
You can check for particular versions before requesting them. We will
use the spack versions
command to see the available versions, and then
install a different version of zlib
.
$ spack versions zlib
==> Safe versions (already checksummed):
1.2.11 1.2.8 1.2.3
==> Remote versions (not yet checksummed):
1.2.10 1.2.6.1 1.2.4.5 1.2.3.9 1.2.3.3 1.2.2.1 1.2.0.7 1.2.0.1 1.1.0 1.0.4 0.94 0.9
1.2.9 1.2.6 1.2.4.4 1.2.3.8 1.2.3.2 1.2.2 1.2.0.6 1.2.0 1.0.9 1.0.2 0.93 0.8
1.2.7.3 1.2.5.3 1.2.4.3 1.2.3.7 1.2.3.1 1.2.1.2 1.2.0.5 1.1.4 1.0.8 1.0.1 0.92
1.2.7.2 1.2.5.2 1.2.4.2 1.2.3.6 1.2.2.4 1.2.1.1 1.2.0.4 1.1.3 1.0.7 1.0-pre 0.91
1.2.7.1 1.2.5.1 1.2.4.1 1.2.3.5 1.2.2.3 1.2.1 1.2.0.3 1.1.2 1.0.6 0.99 0.79
1.2.7 1.2.5 1.2.4 1.2.3.4 1.2.2.2 1.2.0.8 1.2.0.2 1.1.1 1.0.5 0.95 0.71
The @
sigil is used to specify versions, both of packages and of
compilers.
$ spack install zlib@1.2.8
==> Installing zlib
==> Extracting zlib from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zlib-1.2.8-t4p5jnme6csjrx4vbnla5za7ghcctg76
The spec syntax also includes compiler flags. Spack accepts
cppflags
, cflags
, cxxflags
, fflags
, ldflags
, and
ldlibs
parameters. The values of these fields must be quoted on
the command line if they include spaces. These values are injected
into the compile line automatically by the Spack compiler wrappers.
$ spack install zlib @1.2.8 cppflags=-O3
==> Installing zlib
==> Extracting zlib from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zlib-1.2.8-h6i53ifim7gcwnzo4s6thvcbe7nxybps
The spack find
command is used to query installed packages. Note that
some packages appear identical with the default output. The -l
flag
shows the hash of each package, and the -f
flag shows any non-empty
compiler flags of those packages.
$ spack find
==> 6 installed packages
-- linux-ubuntu18.04-x86_64 / clang@6.0.0 -----------------------
zlib@1.2.11
-- linux-ubuntu18.04-x86_64 / gcc@6.5.0 -------------------------
zlib@1.2.11
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
patchelf@0.10 zlib@1.2.8 zlib@1.2.8 zlib@1.2.11
Spack generates a hash for each spec. This hash is a function of the full provenance of the package, so any change to the spec affects the hash. Spack uses this value to compare specs and to generate unique installation directories for every combinatorial version. As we move into more complicated packages with software dependencies, we can see that Spack reuses existing packages to satisfy a dependency only when the existing package’s hash matches the desired spec.
$ spack install tcl
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zlib-1.2.11-smoyzzo2qhzpn6mg6rd3l2p7b23enshg
==> Installing tcl
==> Extracting tcl from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/tcl-8.6.8-aszidznovy2kcbefk4dexwf5mlrjbbcw
Dependencies can be explicitly requested using the ^
sigil. Note that
the spec syntax is recursive. Anything we could specify about the
top-level package, we can also specify about a dependency using ^
.
$ spack install tcl ^zlib @1.2.8 %clang
==> Installing zlib
==> Extracting zlib from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/clang-6.0.0/zlib-1.2.8-pdfmc5xxsopitln5y7wcirbmfz47o5tp
==> Installing tcl
==> Extracting tcl from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/clang-6.0.0/tcl-8.6.8-4ef57swt6n2ke74mhx4pny32z7hzxif3
Packages can also be referred to from the command line by their package
hash. Using the spack find -lf
command earlier we saw that the hash
of our optimized installation of zlib (cppflags="-O3"
) began with
hmvjty5
. We can now explicitly build with that package without typing
the entire spec, by using the /
sigil to refer to it by hash. As with
other tools like git, you do not need to specify an entire hash on the
command line. You can specify just enough digits to identify a hash
uniquely. If a hash prefix is ambiguous (i.e., two or more installed
packages share the prefix) then spack will report an error.
$ spack install tcl ^/h6i
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zlib-1.2.8-h6i53ifim7gcwnzo4s6thvcbe7nxybps
==> Installing tcl
==> Extracting tcl from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/tcl-8.6.8-xthyjrqu2t7fz7vc3dx5hxuw2fhyol3e
The spack find
command can also take a -d
flag, which can show
dependency information. Note that each package has a top-level entry,
even if it also appears as a dependency.
$ spack find -ldf
==> 10 installed packages
-- linux-ubuntu18.04-x86_64 / clang@6.0.0 -----------------------
4ef57sw tcl@8.6.8%clang
pdfmc5x zlib@1.2.8%clang
pdfmc5x zlib@1.2.8%clang
5qffmms zlib@1.2.11%clang
-- linux-ubuntu18.04-x86_64 / gcc@6.5.0 -------------------------
qtrzwov zlib@1.2.11%gcc
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
2nj3vxx patchelf@0.10%gcc
aszidzn tcl@8.6.8%gcc
smoyzzo zlib@1.2.11%gcc
xthyjrq tcl@8.6.8%gcc
h6i53if zlib@1.2.8%gcc cppflags="-O3"
t4p5jnm zlib@1.2.8%gcc
h6i53if zlib@1.2.8%gcc cppflags="-O3"
smoyzzo zlib@1.2.11%gcc
Let’s move on to slightly more complicated packages. HDF5
is a
good example of a more complicated package, with an MPI dependency. If
we install it “out of the box,” it will build with openmpi
.
$ spack install hdf5
==> Installing libsigsegv
==> Extracting libsigsegv from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libsigsegv-2.12-lbrx7lnfz46ukewxbhxnucmx76g23c6q
==> Installing pkgconf
==> Extracting pkgconf from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pkgconf-1.7.3-4sh6pymrm2ms4auu3ajbjjr6fiuhz5g7
==> Installing util-macros
==> Extracting util-macros from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/util-macros-1.19.1-gs6ag7ktdoiirb62t7bcagjw62szrrg2
==> Installing libiconv
==> Extracting libiconv from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libiconv-1.16-jearpk4xci4zc7dkrza4fufaqfkq7rfl
==> Installing xz
==> Extracting xz from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/xz-5.2.5-6nxes4rhk52rhxj7dntwqa5nzou5sv2t
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zlib-1.2.11-smoyzzo2qhzpn6mg6rd3l2p7b23enshg
==> Installing m4
==> Extracting m4 from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/m4-1.4.18-mkc3u4x2p2wie6jfhuku7g5rkovcrxps
==> Installing ncurses
==> Extracting ncurses from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/ncurses-6.2-crhlefo3dv7lmsv5pf4icsy4gepkdorm
==> Installing libxml2
==> Extracting libxml2 from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libxml2-2.9.10-m3l53bhqaaznpmdxzs5jirieu4spdtyq
==> Installing libtool
==> Extracting libtool from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libtool-2.4.6-jdxbjftheiotj6solpomva7dowrhlerl
==> Installing readline
==> Extracting readline from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/readline-8.0-t54jzdy2jj4snltjazlm3br2urcilc6v
==> Installing libpciaccess
==> Extracting libpciaccess from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libpciaccess-0.13.5-cmn6yii6vkzjrapeabvbcna3qqqx6web
==> Installing gdbm
==> Extracting gdbm from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/gdbm-1.18.1-4av4gywgpaspkhy3dvbb62nulqogtzbb
==> Installing perl
==> Extracting perl from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/perl-5.30.3-hyrsxn4yox7dp7sywfcs7lbknj45c5pq
==> Installing autoconf
==> Extracting autoconf from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/autoconf-2.69-nwb3bf5ibencr3coo5kgkxa7tjrj7yfy
==> Installing automake
==> Extracting automake from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/automake-1.16.2-wdflovn6aocicngqouowxgj3pi3w7uoc
==> Installing numactl
==> Extracting numactl from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/numactl-2.0.12-yvxocdy2kcxvvgatrrst3sqzyt7yxhgn
==> Installing hwloc
==> Extracting hwloc from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/hwloc-1.11.11-ckxpgsn6uuptknjsle5cagqxpbo3b7uc
==> Installing openmpi
==> Extracting openmpi from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/openmpi-3.1.6-wudo6kygednztgzemlnq4l7rlwrwu3zw
==> Installing hdf5
==> Extracting hdf5 from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/hdf5-1.10.6-pjpfy3sesp2y7rultzk32ppfy7tp27fa
Spack packages can also have build options, called variants. Boolean
variants can be specified using the +
and ~
or -
sigils. There are two sigils for False
to avoid conflicts with
shell parsing in different situations. Variants (boolean or otherwise)
can also be specified using the same syntax as compiler flags. Here
we can install HDF5 without MPI support.
$ spack install hdf5~mpi
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zlib-1.2.11-smoyzzo2qhzpn6mg6rd3l2p7b23enshg
==> Installing hdf5
==> Extracting hdf5 from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/hdf5-1.10.6-g2cmvjrggxk7cun53boavqgxcyqvd3dm
We might also want to install HDF5 with a different MPI
implementation. While MPI is not a package itself, packages can depend on
abstract interfaces like MPI. Spack handles these through “virtual
dependencies.” A package, such as HDF5, can depend on the MPI
interface. Other packages (openmpi
, mpich
, mvapich
, etc.)
provide the MPI interface. Any of these providers can be requested for
an MPI dependency. For example, we can build HDF5 with MPI support
provided by mpich by specifying a dependency on mpich
. Spack also
supports versioning of virtual dependencies. A package can depend on the
MPI interface at version 3, and provider packages specify what version of
the interface they provide. The partial spec ^mpi@3
can be safisfied
by any of several providers.
$ spack install hdf5+hl+mpi ^mpich
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libsigsegv-2.12-lbrx7lnfz46ukewxbhxnucmx76g23c6q
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pkgconf-1.7.3-4sh6pymrm2ms4auu3ajbjjr6fiuhz5g7
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/util-macros-1.19.1-gs6ag7ktdoiirb62t7bcagjw62szrrg2
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libiconv-1.16-jearpk4xci4zc7dkrza4fufaqfkq7rfl
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/xz-5.2.5-6nxes4rhk52rhxj7dntwqa5nzou5sv2t
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zlib-1.2.11-smoyzzo2qhzpn6mg6rd3l2p7b23enshg
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/m4-1.4.18-mkc3u4x2p2wie6jfhuku7g5rkovcrxps
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/ncurses-6.2-crhlefo3dv7lmsv5pf4icsy4gepkdorm
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libxml2-2.9.10-m3l53bhqaaznpmdxzs5jirieu4spdtyq
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libtool-2.4.6-jdxbjftheiotj6solpomva7dowrhlerl
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/readline-8.0-t54jzdy2jj4snltjazlm3br2urcilc6v
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libpciaccess-0.13.5-cmn6yii6vkzjrapeabvbcna3qqqx6web
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/gdbm-1.18.1-4av4gywgpaspkhy3dvbb62nulqogtzbb
==> Installing hwloc
==> Extracting hwloc from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/hwloc-2.2.0-luexnupqtztews7ilnpknxmtpu4itryb
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/perl-5.30.3-hyrsxn4yox7dp7sywfcs7lbknj45c5pq
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/autoconf-2.69-nwb3bf5ibencr3coo5kgkxa7tjrj7yfy
==> Installing texinfo
==> Extracting texinfo from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/texinfo-6.5-cr3i7estivhxruaqbm6s4osfsxtmbsoz
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/automake-1.16.2-wdflovn6aocicngqouowxgj3pi3w7uoc
==> Installing findutils
==> Extracting findutils from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/findutils-4.6.0-hrv4dx5txigi2la7siu3qsa7cervn7tv
==> Installing mpich
==> Extracting mpich from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/mpich-3.3.2-qrpxybcrx4nqqmkjq6osjdveojb2jfah
==> Installing hdf5
==> Extracting hdf5 from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/hdf5-1.10.6-znt7mfzon6fvsmwv7izlvq43stciepy3
We’ll do a quick check in on what we have installed so far.
$ spack find -ldf
==> 35 installed packages
-- linux-ubuntu18.04-x86_64 / clang@6.0.0 -----------------------
4ef57sw tcl@8.6.8%clang
pdfmc5x zlib@1.2.8%clang
pdfmc5x zlib@1.2.8%clang
5qffmms zlib@1.2.11%clang
-- linux-ubuntu18.04-x86_64 / gcc@6.5.0 -------------------------
qtrzwov zlib@1.2.11%gcc
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
nwb3bf5 autoconf@2.69%gcc
mkc3u4x m4@1.4.18%gcc
lbrx7ln libsigsegv@2.12%gcc
hyrsxn4 perl@5.30.3%gcc
4av4gyw gdbm@1.18.1%gcc
t54jzdy readline@8.0%gcc
crhlefo ncurses@6.2%gcc
wdflovn automake@1.16.2%gcc
hyrsxn4 perl@5.30.3%gcc
4av4gyw gdbm@1.18.1%gcc
t54jzdy readline@8.0%gcc
crhlefo ncurses@6.2%gcc
hrv4dx5 findutils@4.6.0%gcc
4av4gyw gdbm@1.18.1%gcc
t54jzdy readline@8.0%gcc
crhlefo ncurses@6.2%gcc
g2cmvjr hdf5@1.10.6%gcc
smoyzzo zlib@1.2.11%gcc
pjpfy3s hdf5@1.10.6%gcc
wudo6ky openmpi@3.1.6%gcc
ckxpgsn hwloc@1.11.11%gcc
cmn6yii libpciaccess@0.13.5%gcc
m3l53bh libxml2@2.9.10%gcc
jearpk4 libiconv@1.16%gcc
6nxes4r xz@5.2.5%gcc
smoyzzo zlib@1.2.11%gcc
yvxocdy numactl@2.0.12%gcc
znt7mfz hdf5@1.10.6%gcc
qrpxybc mpich@3.3.2%gcc
luexnup hwloc@2.2.0%gcc
cmn6yii libpciaccess@0.13.5%gcc
m3l53bh libxml2@2.9.10%gcc
jearpk4 libiconv@1.16%gcc
6nxes4r xz@5.2.5%gcc
smoyzzo zlib@1.2.11%gcc
ckxpgsn hwloc@1.11.11%gcc
cmn6yii libpciaccess@0.13.5%gcc
m3l53bh libxml2@2.9.10%gcc
jearpk4 libiconv@1.16%gcc
6nxes4r xz@5.2.5%gcc
smoyzzo zlib@1.2.11%gcc
yvxocdy numactl@2.0.12%gcc
luexnup hwloc@2.2.0%gcc
cmn6yii libpciaccess@0.13.5%gcc
m3l53bh libxml2@2.9.10%gcc
jearpk4 libiconv@1.16%gcc
6nxes4r xz@5.2.5%gcc
smoyzzo zlib@1.2.11%gcc
jearpk4 libiconv@1.16%gcc
cmn6yii libpciaccess@0.13.5%gcc
lbrx7ln libsigsegv@2.12%gcc
jdxbjft libtool@2.4.6%gcc
m3l53bh libxml2@2.9.10%gcc
jearpk4 libiconv@1.16%gcc
6nxes4r xz@5.2.5%gcc
smoyzzo zlib@1.2.11%gcc
mkc3u4x m4@1.4.18%gcc
lbrx7ln libsigsegv@2.12%gcc
qrpxybc mpich@3.3.2%gcc
luexnup hwloc@2.2.0%gcc
cmn6yii libpciaccess@0.13.5%gcc
m3l53bh libxml2@2.9.10%gcc
jearpk4 libiconv@1.16%gcc
6nxes4r xz@5.2.5%gcc
smoyzzo zlib@1.2.11%gcc
crhlefo ncurses@6.2%gcc
yvxocdy numactl@2.0.12%gcc
wudo6ky openmpi@3.1.6%gcc
ckxpgsn hwloc@1.11.11%gcc
cmn6yii libpciaccess@0.13.5%gcc
m3l53bh libxml2@2.9.10%gcc
jearpk4 libiconv@1.16%gcc
6nxes4r xz@5.2.5%gcc
smoyzzo zlib@1.2.11%gcc
yvxocdy numactl@2.0.12%gcc
2nj3vxx patchelf@0.10%gcc
hyrsxn4 perl@5.30.3%gcc
4av4gyw gdbm@1.18.1%gcc
t54jzdy readline@8.0%gcc
crhlefo ncurses@6.2%gcc
4sh6pym pkgconf@1.7.3%gcc
t54jzdy readline@8.0%gcc
crhlefo ncurses@6.2%gcc
xthyjrq tcl@8.6.8%gcc
h6i53if zlib@1.2.8%gcc cppflags="-O3"
aszidzn tcl@8.6.8%gcc
smoyzzo zlib@1.2.11%gcc
cr3i7es texinfo@6.5%gcc
hyrsxn4 perl@5.30.3%gcc
4av4gyw gdbm@1.18.1%gcc
t54jzdy readline@8.0%gcc
crhlefo ncurses@6.2%gcc
gs6ag7k util-macros@1.19.1%gcc
6nxes4r xz@5.2.5%gcc
t4p5jnm zlib@1.2.8%gcc
h6i53if zlib@1.2.8%gcc cppflags="-O3"
smoyzzo zlib@1.2.11%gcc
Spack models the dependencies of packages as a directed acyclic graph
(DAG). The spack find -d
command shows the tree representation of
that graph. We can also use the spack graph
command to view the entire
DAG as a graph.
$ spack graph hdf5+hl+mpi ^mpich
o hdf5
|\
| o mpich
| |\
| | |\
| | | |\
| | | | |\
| | | | | |\
| | | | | | |\
| | | | | | | |\
| | | | | | | | |\
| | | | | | o | | | hwloc
| | |_|_|_|/| | | |
| |/| | |_|/| | | |
| | | |/| |/ / / /
| | | o | | | | | libxml2
| |_|/| | | | | |
|/| |/| | | | | |
| |/| | | | | | |
| | | |\ \ \ \ \ \
o | | | | | | | | | zlib
/ / / / / / / / /
| | o | | | | | | xz
| | / / / / / /
| | | | o | | | libpciaccess
| |_|_|/| | | |
|/| | |/| | | |
| | | | o | | | util-macros
| | | | / / /
| | | | o | | findutils
| | |_|/| | |
| |/| |/| | |
| | | | |\| |
| | | | |\ \ \
| | | | | | |/
| | | | | |/|
| | | | o | | texinfo
| | | | | | o automake
| | | | | |/|
| | | | |/|/
| | | | | o autoconf
| | |_|_|/|
| |/| | |/
| | | | o perl
| | | | o gdbm
| | | | o readline
| | | | o ncurses
| |_|_|/
|/| | |
o | | | pkgconf
/ / /
| | o libtool
| |/
|/|
o | m4
o | libsigsegv
/
o libiconv
You may also have noticed that there are some packages shown in the
spack find -d
output that we didn’t install explicitly. These are
dependencies that were installed implicitly. A few packages installed
implicitly are not shown as dependencies in the spack find -d
output. These are build dependencies. For example, libpciaccess
is a
dependency of openmpi and requires m4
to build. Spack will build m4
as
part of the installation of openmpi
, but it does not become a part of
the DAG because it is not linked in at run time. Spack handles build
dependencies differently because of their different (less strict)
consistency requirements. It is entirely possible to have two packages
using different versions of a dependency to build, which obviously cannot
be done with linked dependencies.
HDF5
is more complicated than our basic example of zlib and
openssl, but it’s still within the realm of software that an experienced
HPC user could reasonably expect to install given a bit of time. Now
let’s look at an even more complicated package.
$ spack install trilinos
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libiconv-1.16-jearpk4xci4zc7dkrza4fufaqfkq7rfl
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zlib-1.2.11-smoyzzo2qhzpn6mg6rd3l2p7b23enshg
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pkgconf-1.7.3-4sh6pymrm2ms4auu3ajbjjr6fiuhz5g7
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libsigsegv-2.12-lbrx7lnfz46ukewxbhxnucmx76g23c6q
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/util-macros-1.19.1-gs6ag7ktdoiirb62t7bcagjw62szrrg2
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/xz-5.2.5-6nxes4rhk52rhxj7dntwqa5nzou5sv2t
==> Installing openblas
==> Extracting openblas from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/openblas-0.3.10-m5gktgohkqi2znlic6cwpz5euhqdle3i
==> Installing diffutils
==> Extracting diffutils from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/diffutils-3.7-otkktenrrvcaf37a7zyeytmjuwsalvtr
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/ncurses-6.2-crhlefo3dv7lmsv5pf4icsy4gepkdorm
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/m4-1.4.18-mkc3u4x2p2wie6jfhuku7g5rkovcrxps
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libxml2-2.9.10-m3l53bhqaaznpmdxzs5jirieu4spdtyq
==> Installing bzip2
==> Extracting bzip2 from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/bzip2-1.0.8-fvfpt26p5divvq6344vojyn64enojlui
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/readline-8.0-t54jzdy2jj4snltjazlm3br2urcilc6v
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libtool-2.4.6-jdxbjftheiotj6solpomva7dowrhlerl
==> Installing boost
==> Extracting boost from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/boost-1.73.0-qzr23mk4jzlnkdfh4mrncz5lvpp67z2r
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/gdbm-1.18.1-4av4gywgpaspkhy3dvbb62nulqogtzbb
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libpciaccess-0.13.5-cmn6yii6vkzjrapeabvbcna3qqqx6web
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/perl-5.30.3-hyrsxn4yox7dp7sywfcs7lbknj45c5pq
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/autoconf-2.69-nwb3bf5ibencr3coo5kgkxa7tjrj7yfy
==> Installing openssl
==> Extracting openssl from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/openssl-1.1.1g-4dj34ywr6ytskzutiwgjrj66sryvav2q
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/automake-1.16.2-wdflovn6aocicngqouowxgj3pi3w7uoc
==> Installing cmake
==> Extracting cmake from binary cache
==> Warning: patchelf --print-rpath /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/cmake-3.17.3-thpwguiiywo7hewgnm76t7r6w53mt6cy/share/cmake-3.17/Modules/Internal/CPack/CPack.OSXScriptLauncher.in produced an error [Command exited with status 1:
'/home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/patchelf-0.10-2nj3vxxz5lwexpp5srseegxt7v6n4whp/bin/patchelf' '--print-rpath' '/home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/cmake-3.17.3-thpwguiiywo7hewgnm76t7r6w53mt6cy/share/cmake-3.17/Modules/Internal/CPack/CPack.OSXScriptLauncher.in'
patchelf: not an ELF executable
]
==> Warning: patchelf --force-rpath --set-rpath /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/cmake-3.17.3-thpwguiiywo7hewgnm76t7r6w53mt6cy/share/cmake-3.17/Modules/Internal/CPack/CPack.OSXScriptLauncher.in failed with error Command exited with status 1:
'/home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/patchelf-0.10-2nj3vxxz5lwexpp5srseegxt7v6n4whp/bin/patchelf' '--force-rpath' '--set-rpath' '' '/home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/cmake-3.17.3-thpwguiiywo7hewgnm76t7r6w53mt6cy/share/cmake-3.17/Modules/Internal/CPack/CPack.OSXScriptLauncher.in'
patchelf: not an ELF executable
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/cmake-3.17.3-thpwguiiywo7hewgnm76t7r6w53mt6cy
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/numactl-2.0.12-yvxocdy2kcxvvgatrrst3sqzyt7yxhgn
==> Installing metis
==> Extracting metis from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/metis-5.1.0-edcrft4l4szpqji2kowdkzq2ofueh3dr
==> Installing glm
==> Extracting glm from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/glm-0.9.7.1-c3mfw24ivgvgfwwxfia3ipk5lqlxdgcd
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/hwloc-1.11.11-ckxpgsn6uuptknjsle5cagqxpbo3b7uc
==> Installing suite-sparse
==> Extracting suite-sparse from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/suite-sparse-5.7.2-dgppz4n6wg4b42d4er5zovpefdywbuy3
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/openmpi-3.1.6-wudo6kygednztgzemlnq4l7rlwrwu3zw
==> Installing netlib-scalapack
==> Extracting netlib-scalapack from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/netlib-scalapack-2.1.0-bvapk5ozv46rizqyzb3tlra7jwxkj2ay
==> Installing parmetis
==> Extracting parmetis from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/parmetis-4.0.3-zdxekoefv7fk2qpoyv6xr26622tnosli
==> Installing hypre
==> Extracting hypre from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/hypre-2.18.2-dnwivcw3g3kjliygwa536iyaykvjfag6
==> Installing hdf5
==> Extracting hdf5 from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/hdf5-1.10.6-7r2lztqivzy6umgvnhihn4565whablho
==> Installing mumps
==> Extracting mumps from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/mumps-5.3.3-qb6yumyjj73wcewf4sa4wc2kc5kutswq
==> Installing netcdf-c
==> Extracting netcdf-c from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/netcdf-c-4.7.3-uctbd5yydaciec4ircts7prazhmpllj5
==> Installing matio
==> Extracting matio from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/matio-1.5.13-w3dbllqxjzh3xyc5hexo7jedowsixau5
==> Installing trilinos
=#=- #
==> Extracting trilinos from binary cache
ls
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/trilinos-12.18.1-j6dav6kowb2c4sfq36vpn7vfhn7es3zf
Now we’re starting to see the power of Spack. Trilinos in its default configuration has 23 top level dependencies, many of which have dependencies of their own. Installing more complex packages can take days or weeks even for an experienced user. Although we’ve done a binary installation for the tutorial, a source installation of trilinos using Spack takes about 3 hours (depending on the system), but only 20 seconds of programmer time.
Spack manages consistency of the entire DAG. Every MPI dependency will
be satisfied by the same configuration of MPI, etc. If we install
trilinos
again specifying a dependency on our previous HDF5 built
with mpich
:
$ spack install trilinos +hdf5 ^hdf5+hl+mpi ^mpich
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libiconv-1.16-jearpk4xci4zc7dkrza4fufaqfkq7rfl
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zlib-1.2.11-smoyzzo2qhzpn6mg6rd3l2p7b23enshg
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pkgconf-1.7.3-4sh6pymrm2ms4auu3ajbjjr6fiuhz5g7
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libsigsegv-2.12-lbrx7lnfz46ukewxbhxnucmx76g23c6q
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/util-macros-1.19.1-gs6ag7ktdoiirb62t7bcagjw62szrrg2
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/xz-5.2.5-6nxes4rhk52rhxj7dntwqa5nzou5sv2t
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/openblas-0.3.10-m5gktgohkqi2znlic6cwpz5euhqdle3i
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/diffutils-3.7-otkktenrrvcaf37a7zyeytmjuwsalvtr
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/ncurses-6.2-crhlefo3dv7lmsv5pf4icsy4gepkdorm
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/m4-1.4.18-mkc3u4x2p2wie6jfhuku7g5rkovcrxps
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libxml2-2.9.10-m3l53bhqaaznpmdxzs5jirieu4spdtyq
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/bzip2-1.0.8-fvfpt26p5divvq6344vojyn64enojlui
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/readline-8.0-t54jzdy2jj4snltjazlm3br2urcilc6v
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libtool-2.4.6-jdxbjftheiotj6solpomva7dowrhlerl
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/boost-1.73.0-qzr23mk4jzlnkdfh4mrncz5lvpp67z2r
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/gdbm-1.18.1-4av4gywgpaspkhy3dvbb62nulqogtzbb
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libpciaccess-0.13.5-cmn6yii6vkzjrapeabvbcna3qqqx6web
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/perl-5.30.3-hyrsxn4yox7dp7sywfcs7lbknj45c5pq
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/hwloc-2.2.0-luexnupqtztews7ilnpknxmtpu4itryb
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/texinfo-6.5-cr3i7estivhxruaqbm6s4osfsxtmbsoz
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/autoconf-2.69-nwb3bf5ibencr3coo5kgkxa7tjrj7yfy
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/openssl-1.1.1g-4dj34ywr6ytskzutiwgjrj66sryvav2q
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/automake-1.16.2-wdflovn6aocicngqouowxgj3pi3w7uoc
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/cmake-3.17.3-thpwguiiywo7hewgnm76t7r6w53mt6cy
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/findutils-4.6.0-hrv4dx5txigi2la7siu3qsa7cervn7tv
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/metis-5.1.0-edcrft4l4szpqji2kowdkzq2ofueh3dr
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/glm-0.9.7.1-c3mfw24ivgvgfwwxfia3ipk5lqlxdgcd
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/mpich-3.3.2-qrpxybcrx4nqqmkjq6osjdveojb2jfah
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/suite-sparse-5.7.2-dgppz4n6wg4b42d4er5zovpefdywbuy3
==> Installing parmetis
==> Extracting parmetis from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/parmetis-4.0.3-v42khiuvg4wkganqomimg5lkwa6npciz
==> Installing netlib-scalapack
==> Extracting netlib-scalapack from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/netlib-scalapack-2.1.0-i6dfzlyscmmwtbje2ch3a35mg4wzu2rd
==> Installing hypre
==> Extracting hypre from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/hypre-2.18.2-amfr6qprjdjtqa6ycuvahikrhubo2uf5
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/hdf5-1.10.6-znt7mfzon6fvsmwv7izlvq43stciepy3
==> Installing mumps
==> Extracting mumps from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/mumps-5.3.3-hbvf64obrjbrjtyc2vl5esz2kcxsjgcz
==> Installing matio
==> Extracting matio from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/matio-1.5.13-w6s7lu2mw6azw4beqimqkv2j5i2e2hlg
==> Installing netcdf-c
==> Extracting netcdf-c from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/netcdf-c-4.7.3-swympwh34zakphvluzh7sez2gznkcunf
==> Installing trilinos
==> Extracting trilinos from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/trilinos-12.18.1-rhmspsuhq6zv2c3vmpekaxugevlxcfh4
We see that every package in the trilinos DAG that depends on MPI now
uses mpich
.
$ spack find -d trilinos
==> 2 installed packages
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
trilinos@12.18.1
boost@1.73.0
bzip2@1.0.8
zlib@1.2.11
glm@0.9.7.1
hdf5@1.10.6
mpich@3.3.2
hwloc@2.2.0
libpciaccess@0.13.5
libxml2@2.9.10
libiconv@1.16
xz@5.2.5
hypre@2.18.2
openblas@0.3.10
matio@1.5.13
metis@5.1.0
mumps@5.3.3
netlib-scalapack@2.1.0
netcdf-c@4.7.3
parmetis@4.0.3
suite-sparse@5.7.2
trilinos@12.18.1
boost@1.73.0
bzip2@1.0.8
zlib@1.2.11
glm@0.9.7.1
hdf5@1.10.6
openmpi@3.1.6
hwloc@1.11.11
libpciaccess@0.13.5
libxml2@2.9.10
libiconv@1.16
xz@5.2.5
numactl@2.0.12
hypre@2.18.2
openblas@0.3.10
matio@1.5.13
metis@5.1.0
mumps@5.3.3
netlib-scalapack@2.1.0
netcdf-c@4.7.3
parmetis@4.0.3
suite-sparse@5.7.2
As we discussed before, the spack find -d
command shows the
dependency information as a tree. While that is often sufficient, many
complicated packages, including trilinos, have dependencies that
cannot be fully represented as a tree. Again, the spack graph
command shows the full DAG of the dependency information.
$ spack graph trilinos
o trilinos
|\
| |\
| | |\
| | | |\
| | | | |\
| | | | | |\
| | | | | | |\
| | | | | | | |\
| | | | | | | | |\
| | | | | | | | | |\
| | | | | | | | | | |\
| | | | | | | | | | | |\
| | | | | | | | | | | | |\
o | | | | | | | | | | | | | suite-sparse
|\ \ \ \ \ \ \ \ \ \ \ \ \ \
| |_|_|/ / / / / / / / / / /
|/| | | | | | | | | | | | |
| |\ \ \ \ \ \ \ \ \ \ \ \ \
| | |_|_|_|_|_|/ / / / / / /
| |/| | | | | | | | | | | |
| | |\ \ \ \ \ \ \ \ \ \ \ \
| | | | |_|_|_|_|_|_|_|_|/ /
| | | |/| | | | | | | | | |
| | | | o | | | | | | | | | parmetis
| | |_|/| | | | | | | | | |
| |/| |/| | | | | | | | | |
| | | | |/ / / / / / / / /
| | | | | | | o | | | | | mumps
| |_|_|_|_|_|/| | | | | |
|/| | | | |_|/| | | | | |
| | | | |/| |/ / / / / /
| | | | | |/| | | | | |
| | | | | o | | | | | | netlib-scalapack
| |_|_|_|/| | | | | | |
|/| | | |/| | | | | | |
| | | |/|/ / / / / / /
| o | | | | | | | | | metis
| | |/ / / / / / / /
| |/| | | | | | | |
| | | | | | | | o | glm
| | |_|_|_|_|_|/ /
| |/| | | | | | |
| o | | | | | | | cmake
| |\ \ \ \ \ \ \ \
| o | | | | | | | | openssl
| |\ \ \ \ \ \ \ \ \
| | | | | | o | | | | netcdf-c
| | |_|_|_|/| | | | |
| |/| | | |/| | | | |
| | | | |/|/| | | | |
| | | | | | | |_|/ /
| | | | | | |/| | |
| | | | | | | o | | matio
| | |_|_|_|_|/| | |
| |/| | | | |/ / /
| | | | | | | o | hypre
| |_|_|_|_|_|/| |
|/| | | | | |/ /
| | | | | |/| |
| | | | | | o | hdf5
| | |_|_|_|/| |
| |/| | | |/ /
| | | | | o | openmpi
| | |_|_|/| |
| |/| | | | |
| | | | | |\ \
| | | | | | |\ \
| | | | | | | o | hwloc
| | | | | | |/| |
| | | | | |/|/| |
| | | | | | | |\ \
| | | | | | | o | | libxml2
| | |_|_|_|_|/| | |
| |/| | | | |/| | |
| | | | | |/| | | |
| | | | | | | |\ \ \
| | | | | | | | | | o boost
| | |_|_|_|_|_|_|_|/|
| |/| | | | | | | | |
| o | | | | | | | | | zlib
| / / / / / / / / /
| | | | | | o | | | xz
| | | | | | / / /
| | | | | | | o | libpciaccess
| | | | | |_|/| |
| | | | |/| | | |
| | | | | | | |\ \
| | | | | | | o | | util-macros
| | | | | | | / /
| | | | | o | | | numactl
| | | | |/| | | |
| | | |/| | | | |
| | | | | |\ \ \ \
| | | | | | |_|/ /
| | | | | |/| | |
| | | | | | |\ \ \
| | | | | | o | | | automake
| | |_|_|_|/| | | |
| |/| | | | | | | |
| | | | | | |/ / /
| | | | | | o | | autoconf
| | |_|_|_|/| | |
| |/| | |_|/ / /
| | | |/| | | |
| o | | | | | | perl
| o | | | | | | gdbm
| o | | | | | | readline
| |/ / / / / /
| o | | | | | ncurses
| | |/ / / /
| |/| | | |
| o | | | | pkgconf
| / / / /
o | | | | openblas
/ / / /
| o | | libtool
|/ / /
o | | m4
o | | libsigsegv
/ /
| o bzip2
| o diffutils
|/
o libiconv
You can control how the output is displayed with a number of options.
The ASCII output from spack graph
can be difficult to parse for
complicated packages. The output can be changed to the graphviz
.dot
format using the --dot
flag.
$ spack graph --dot trilinos | dot -Tpdf > trilinos_graph.pdf
Uninstalling Packages¶
Earlier we installed many configurations each of zlib and tcl. Now we will go through and uninstall some of those packages that we didn’t really need.
$ spack find -d tcl
==> 3 installed packages
-- linux-ubuntu18.04-x86_64 / clang@6.0.0 -----------------------
tcl@8.6.8
zlib@1.2.8
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
tcl@8.6.8
zlib@1.2.8
tcl@8.6.8
zlib@1.2.11
$ spack find zlib
==> 6 installed packages
-- linux-ubuntu18.04-x86_64 / clang@6.0.0 -----------------------
zlib@1.2.8 zlib@1.2.11
-- linux-ubuntu18.04-x86_64 / gcc@6.5.0 -------------------------
zlib@1.2.11
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
zlib@1.2.8 zlib@1.2.8 zlib@1.2.11
We can uninstall packages by spec using the same syntax as install.
$ spack uninstall zlib %gcc@6.5.0
y
==> The following packages will be uninstalled:
-- linux-ubuntu18.04-x86_64 / gcc@6.5.0 -------------------------
qtrzwov zlib@1.2.11
==> Do you want to proceed? [y/N] ==> Successfully uninstalled zlib@1.2.11%gcc@6.5.0+optimize+pic+shared arch=linux-ubuntu18.04-x86_64/qtrzwov
$ spack find -lf zlib
==> 5 installed packages
-- linux-ubuntu18.04-x86_64 / clang@6.0.0 -----------------------
pdfmc5x zlib@1.2.8%clang 5qffmms zlib@1.2.11%clang
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
t4p5jnm zlib@1.2.8%gcc h6i53if zlib@1.2.8%gcc cppflags="-O3" smoyzzo zlib@1.2.11%gcc
We can also uninstall packages by referring only to their hash.
We can use either -f
(force) or -R
(remove dependents as well) to
remove packages that are required by another installed package.
$ spack uninstall zlib/pdf
==> Will not uninstall zlib@1.2.8%clang@6.0.0/pdfmc5x
The following packages depend on it:
-- linux-ubuntu18.04-x86_64 / clang@6.0.0 -----------------------
4ef57sw tcl@8.6.8
==> Error: There are still dependents.
use `spack uninstall --dependents` to remove dependents too
$ spack uninstall -R zlib/pdf
y
==> The following packages will be uninstalled:
-- linux-ubuntu18.04-x86_64 / clang@6.0.0 -----------------------
4ef57sw tcl@8.6.8
pdfmc5x zlib@1.2.8
==> Do you want to proceed? [y/N] ==> Successfully uninstalled tcl@8.6.8%clang@6.0.0 arch=linux-ubuntu18.04-x86_64/4ef57sw
==> Successfully uninstalled zlib@1.2.8%clang@6.0.0+optimize+pic+shared arch=linux-ubuntu18.04-x86_64/pdfmc5x
Spack will not uninstall packages that are not sufficiently
specified. The -a
(all) flag can be used to uninstall multiple
packages at once.
$ spack uninstall trilinos
==> Error: trilinos matches multiple packages:
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
rhmspsu trilinos@12.18.1 j6dav6k trilinos@12.18.1
==> Error: You can either:
a) use a more specific spec, or
b) specify the spec by its hash (e.g. `spack uninstall /hash`), or
c) use `spack uninstall --all` to uninstall ALL matching specs.
$ spack uninstall /j6d
y
==> The following packages will be uninstalled:
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
j6dav6k trilinos@12.18.1
==> Do you want to proceed? [y/N] ==> Successfully uninstalled trilinos@12.18.1%gcc@7.5.0~adios2~alloptpkgs+amesos+amesos2+anasazi+aztec+belos+boost~cgns~chaco~complex~debug~dtk+epetra+epetraext+exodus+explicit_template_instantiation~float+fortran~fortrilinos+glm+gtest+hdf5+hypre+ifpack+ifpack2~intrepid~intrepid2~isorropia+kokkos+matio~mesquite+metis~minitensor+ml+mpi+muelu+mumps+netcdf~nox~openmp~phalanx~piro~pnetcdf~python~rol~rythmos+sacado~shards+shared~shylu~stk~stratimikos+suite-sparse~superlu~superlu-dist~teko~tempus+teuchos+tpetra~x11~xsdkflags~zlib+zoltan+zoltan2 build_type=RelWithDebInfo gotype=long arch=linux-ubuntu18.04-x86_64/j6dav6k
Advanced spack find
Usage¶
We will go over some additional uses for the spack find
command not
already covered in the Installing Spack and
Uninstalling Packages sections.
The spack find
command can accept what we call “anonymous specs.”
These are expressions in spec syntax that do not contain a package
name. For example, spack find ^mpich
will return every installed
package that depends on mpich, and spack find cppflags="-O3"
will
return every package which was built with cppflags="-O3"
.
$ spack find ^mpich
==> 8 installed packages
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
hdf5@1.10.6 matio@1.5.13 netcdf-c@4.7.3 parmetis@4.0.3
hypre@2.18.2 mumps@5.3.3 netlib-scalapack@2.1.0 trilinos@12.18.1
$ spack find cppflags=-O3
==> 1 installed package
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
zlib@1.2.8
The find
command can also show which packages were installed
explicitly (rather than pulled in as a dependency) using the -x
flag. The -X
flag shows implicit installs only. The find
command can
also show the path to which a spack package was installed using the -p
command.
$ spack find -px
==> 11 installed packages
-- linux-ubuntu18.04-x86_64 / clang@6.0.0 -----------------------
zlib@1.2.11 /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/clang-6.0.0/zlib-1.2.11-5qffmms6gwykcikh6aag4h3z4scrfdla
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
hdf5@1.10.6 /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/hdf5-1.10.6-g2cmvjrggxk7cun53boavqgxcyqvd3dm
hdf5@1.10.6 /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/hdf5-1.10.6-pjpfy3sesp2y7rultzk32ppfy7tp27fa
hdf5@1.10.6 /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/hdf5-1.10.6-znt7mfzon6fvsmwv7izlvq43stciepy3
patchelf@0.10 /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/patchelf-0.10-2nj3vxxz5lwexpp5srseegxt7v6n4whp
tcl@8.6.8 /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/tcl-8.6.8-aszidznovy2kcbefk4dexwf5mlrjbbcw
tcl@8.6.8 /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/tcl-8.6.8-xthyjrqu2t7fz7vc3dx5hxuw2fhyol3e
trilinos@12.18.1 /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/trilinos-12.18.1-rhmspsuhq6zv2c3vmpekaxugevlxcfh4
zlib@1.2.8 /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zlib-1.2.8-t4p5jnme6csjrx4vbnla5za7ghcctg76
zlib@1.2.8 /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zlib-1.2.8-h6i53ifim7gcwnzo4s6thvcbe7nxybps
zlib@1.2.11 /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zlib-1.2.11-smoyzzo2qhzpn6mg6rd3l2p7b23enshg
Customizing Compilers¶
Spack manages a list of available compilers on the system, detected
automatically from from the user’s PATH
variable. The spack
compilers
command is an alias for the command spack compiler list
.
$ spack compilers
==> Available compilers
-- clang ubuntu18.04-x86_64 -------------------------------------
clang@6.0.0
-- gcc ubuntu18.04-x86_64 ---------------------------------------
gcc@7.5.0 gcc@6.5.0
The compilers are maintained in a YAML file. Later in the tutorial you will learn how to configure compilers by hand for special cases. Spack also has tools to add compilers, and compilers built with Spack can be added to the configuration.
$ spack install gcc @8.3.0
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libsigsegv-2.12-lbrx7lnfz46ukewxbhxnucmx76g23c6q
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pkgconf-1.7.3-4sh6pymrm2ms4auu3ajbjjr6fiuhz5g7
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zlib-1.2.11-smoyzzo2qhzpn6mg6rd3l2p7b23enshg
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/m4-1.4.18-mkc3u4x2p2wie6jfhuku7g5rkovcrxps
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/ncurses-6.2-crhlefo3dv7lmsv5pf4icsy4gepkdorm
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libtool-2.4.6-jdxbjftheiotj6solpomva7dowrhlerl
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/readline-8.0-t54jzdy2jj4snltjazlm3br2urcilc6v
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/gdbm-1.18.1-4av4gywgpaspkhy3dvbb62nulqogtzbb
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/perl-5.30.3-hyrsxn4yox7dp7sywfcs7lbknj45c5pq
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/autoconf-2.69-nwb3bf5ibencr3coo5kgkxa7tjrj7yfy
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/automake-1.16.2-wdflovn6aocicngqouowxgj3pi3w7uoc
==> Installing gmp
==> Extracting gmp from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/gmp-6.1.2-3ol3tldmm3oqflzrqonh6p2jmhgwsr4t
==> Installing isl
==> Extracting isl from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/isl-0.18-4lkvfkviv45b2htxuyfxbivafx4wajud
==> Installing mpfr
==> Extracting mpfr from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/mpfr-3.1.6-nwsubswuytvvsjtu3nuyuxquwyxyfebj
==> Installing mpc
==> Extracting mpc from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/mpc-1.1.0-uur2dd6aco22hxagwzxco23rvtyvqd7t
==> Installing gcc
==> Extracting gcc from binary cache
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/gcc-8.3.0-6hbkzolzshktgws6mz3f4s23v6sbkgnl
$ spack find -p gcc
==> 1 installed package
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
gcc@8.3.0 /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/gcc-8.3.0-6hbkzolzshktgws6mz3f4s23v6sbkgnl
We can add gcc to Spack as an available compiler using the spack
compiler add
command. This will allow future packages to build with
gcc @8.3.0.
$ spack compiler add $(spack location -i gcc@8.3.0)
==> Added 1 new compiler to /home/spack/.spack/linux/compilers.yaml
gcc@8.3.0
==> Compilers are defined in the following files:
/home/spack/.spack/linux/compilers.yaml
We can also remove compilers from our configuration using spack compiler remove <compiler_spec>
$ spack compiler remove gcc@8.3.0
==> Removed compiler gcc@8.3.0