Tutorial setup

If you have not done the prior sections, you’ll need to start the docker image:

docker run -it ghcr.io/spack/tutorial:cineca23

and then set Spack up like this:

git clone --depth=100 --branch=releases/v0.19 https://github.com/spack/spack
. spack/share/spack/setup-env.sh
spack tutorial -y
spack bootstrap now
spack compiler find

See the Basic Installation Tutorial for full details on setup. For more help, join us in the #tutorial channel on Slack – get an invitation at spackpm.herokuapp.com

Environments Tutorial

We’ve covered how to install, remove, and list packages with Spack using the commands:

This section of the tutorial introduces Spack Environments, which allow you to work with independent groups of packages separately, in a reproducible way. In some ways, Spack environments are similar to virtual environments in other systems (e.g., Python venv), but they are based around file formats (spack.yaml and spack.lock) that can be shared easily and re-used by others across systems.

Administering properly configured software involving lots of packages and/or varying configuration requirements (e.g., different implementations of mpi) for multiple projects and efforts can be overwhelming. Spack environments allow you to readily:

  • establish standard software requirements for your project(s);
  • set up run environments for users;
  • support your usual development environment(s);
  • set up packages for CI/CD;
  • reproduce builds (approximately or exactly) on other machines; and
  • much more.

This tutorial introduces the basics of creating and using environments, then explains how to expand, configure, and build software in them. We will start with the command line interface, then cover editing key environment file directly. We will describe the difference between Spack-managed and independent environments, then finish with a section on reproducible builds.

Environment Basics

Let’s look at the output of spack find at this point in the tutorial.

$ spack find
-- linux-ubuntu18.04-x86_64 / clang@7.0.0 -----------------------
zlib@1.2.13

-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
autoconf@2.69	     ca-certificates-mozilla@2022-10-11	 gdbm@1.23	 hwloc@2.8.0	       libfabric@1.16.1	  libsigsegv@2.13  ncurses@6.3	    openssl@1.1.1s  python@3.10.8   tcl@8.6.12		    yaksa@0.2
automake@1.16.5	     cmake@3.24.3			 gettext@0.21.1	 krb5@1.19.3	       libffi@3.4.2	  libtool@2.4.7	   numactl@2.0.14   perl@5.36.0	    readline@8.1.2  trilinos@13.0.1	    zlib@1.2.8
berkeley-db@18.1.40  diffutils@3.8			 hdf5@1.12.2	 libbsd@0.11.5	       libiconv@1.16	  libxml2@2.10.1   openblas@0.3.21  pigz@2.7	    sqlite@3.39.4   util-linux-uuid@2.38.1  zlib@1.2.8
bison@3.8.2	     expat@2.4.8			 hdf5@1.12.2	 libedit@3.1-20210216  libmd@1.0.4	  m4@1.4.19	   openmpi@4.1.4    pkgconf@1.8.0   tar@1.34	    util-macros@1.19.3	    zlib@1.2.13
bzip2@1.0.8	     findutils@4.9.0			 hdf5@1.12.2	 libevent@2.1.12       libpciaccess@0.16  mpich@4.0.2	   openssh@9.1p1    pmix@4.1.2	    tcl@8.6.12	    xz@5.2.7		    zstd@1.5.2
==> 56 installed packages

This is a complete, but cluttered list of the installed packages and their dependencies. It contains packages built with both openmpi and mpich, as well as multiple variants of other packages, like hdf5 and zlib. The query mechanism we learned about with spack find can help, but it would be nice if we could start from a clean slate without losing what we’ve already installed.

Creating and activating environments

The spack env command can help. Let’s create a new environment called myproject:

$ spack env create myproject
==> Created environment 'myproject' in /home/spack/spack/var/spack/environments/myproject
==> You can activate this environment with:
==>   spack env activate myproject

An environment is like a virtualized Spack instance that you can use to aggregate package installations for a project or other purpose. It has an associated view, which is a single prefix where all packages from the environment are linked.

You can see the environments we’ve created so far using the spack env list command:

$ spack env list
==> 1 environments
    myproject

Now let’s activate our environment. You can use spack env activate command:

$ spack env activate myproject

You can also use the spacktivate alias for short.

Note

If you use the -p option for spack env activate, Spack will prepend the environment name to the prompt. This is a handy way to be reminded if and which environment you are in.

Once you activate an environment, spack find only shows what is in the current environment. We just created this environment, so it does not contain any installed packages.

$ spack find
==> In environment myproject
==> No root specs
==> 0 installed packages

The output from spack find is now slightly different. It tells you that you’re in the myproject environment, so there is no need to panic when you see that none of the previously installed packages are available. It also states that there are no root specs. We’ll get back to what that means later.

If you only want to check what environment you are in, you can use spack env status:

$ spack env status
==> In environment myproject

If you want to leave this environment, you can use spack env deactivate or the despacktivate alias for short.

After deactivating, we can see everything installed in this Spack instance:

$ despacktivate	   # short alias for 'spack env deactivate'
$ spack env status
==> No active environment
$ spack find
-- linux-ubuntu18.04-x86_64 / clang@7.0.0 -----------------------
zlib@1.2.13

-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
autoconf@2.69	     ca-certificates-mozilla@2022-10-11	 gdbm@1.23	 hwloc@2.8.0	       libfabric@1.16.1	  libsigsegv@2.13  ncurses@6.3	    openssl@1.1.1s  python@3.10.8   tcl@8.6.12		    yaksa@0.2
automake@1.16.5	     cmake@3.24.3			 gettext@0.21.1	 krb5@1.19.3	       libffi@3.4.2	  libtool@2.4.7	   numactl@2.0.14   perl@5.36.0	    readline@8.1.2  trilinos@13.0.1	    zlib@1.2.8
berkeley-db@18.1.40  diffutils@3.8			 hdf5@1.12.2	 libbsd@0.11.5	       libiconv@1.16	  libxml2@2.10.1   openblas@0.3.21  pigz@2.7	    sqlite@3.39.4   util-linux-uuid@2.38.1  zlib@1.2.8
bison@3.8.2	     expat@2.4.8			 hdf5@1.12.2	 libedit@3.1-20210216  libmd@1.0.4	  m4@1.4.19	   openmpi@4.1.4    pkgconf@1.8.0   tar@1.34	    util-macros@1.19.3	    zlib@1.2.13
bzip2@1.0.8	     findutils@4.9.0			 hdf5@1.12.2	 libevent@2.1.12       libpciaccess@0.16  mpich@4.0.2	   openssh@9.1p1    pmix@4.1.2	    tcl@8.6.12	    xz@5.2.7		    zstd@1.5.2
==> 56 installed packages

Notice that we are no longer in an environment and all our packages are still installed.

Installing packages

Now that we understand how creation and activation work, let’s go back to myproject and install a couple of packages, specifically, tcl and trilinos.

Try the usual install command first:

$ spack install tcl
==> Error: Cannot install 'tcl' because it is not in the current environment. You can add it to the environment with 'spack add tcl', or as part of the install command with 'spack install --add tcl'

Environments are special in that you must add specs to them before installing. spack add allows us to do queue up several specs to be installed together. Let’s try it:

$ spack add tcl
==> Adding tcl to environment myproject
$ spack add trilinos
==> Adding trilinos to environment myproject
$ spack find
==> In environment myproject
==> Root specs
tcl  trilinos

==> 0 installed packages

Now, tcl and trilinos have been registered as root specs in this environment. That is because we explicitly asked for them to be installed, so they are the roots of the combined graph of all packages we’ll install.

Now, let’s install:

$ spack env activate myproject
$ spack install
==> Concretized tcl
[+]  v63n6wx  tcl@8.6.12%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  2hfr5rb	  ^zlib@1.2.13%gcc@7.5.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu18.04-x86_64

==> Concretized trilinos
 -   brfmaty  trilinos@13.0.1%gcc@7.5.0~adelus~adios2+amesos+amesos2+anasazi+aztec~basker+belos~boost~chaco~complex~cuda~cuda_rdc~debug~dtk+epetra+epetraext~epetraextbtf~epetraextexperimental~epetraextgraphreorderings~exodus+explicit_template_instantiation~float+fortran~gtest~hdf5~hypre+ifpack+ifpack2~intrepid~intrepid2~ipo~isorropia+kokkos~mesquite~minitensor+ml+mpi+muelu~mumps~nox~openmp~panzer~phalanx~piro~python~rocm~rocm_rdc~rol~rythmos+sacado~scorec~shards+shared~shylu~stk~stokhos~stratimikos~strumpack~suite-sparse~superlu~superlu-dist~teko~tempus~thyra+tpetra~trilinoscouplings~wrapper~x11~zoltan~zoltan2 build_system=cmake build_type=RelWithDebInfo cxxstd=14 gotype=long_long arch=linux-ubuntu18.04-x86_64
[+]  stszbns	  ^cmake@3.24.3%gcc@7.5.0~doc+ncurses+ownlibs~qt build_system=generic build_type=Release arch=linux-ubuntu18.04-x86_64
[+]  zcuawli	      ^ncurses@6.3%gcc@7.5.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  yr4z2pt	      ^openssl@1.1.1s%gcc@7.5.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu18.04-x86_64
[+]  aurd37j		  ^ca-certificates-mozilla@2022-10-11%gcc@7.5.0 build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  5yywrk2	  ^hwloc@2.8.0%gcc@7.5.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  p7f5n6q	      ^libpciaccess@0.16%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  bdxu4wn		  ^libtool@2.4.7%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ao5w53r		  ^util-macros@1.19.3%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  4aq5aj2	      ^libxml2@2.10.1%gcc@7.5.0~python build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ltvovvv		  ^libiconv@1.16%gcc@7.5.0 build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  nrwxyth		  ^xz@5.2.7%gcc@7.5.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  k2lfw6f	      ^pkgconf@1.8.0%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  3db4ryr	  ^openblas@0.3.21%gcc@7.5.0~bignuma~consistent_fpcsr+fortran~ilp64+locking+pic+shared build_system=makefile patches=d3d9b15 symbol_suffix=none threads=none arch=linux-ubuntu18.04-x86_64
[+]  eydiwim	      ^perl@5.36.0%gcc@7.5.0+cpanm+shared+threads build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  53fb72w		  ^berkeley-db@18.1.40%gcc@7.5.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu18.04-x86_64
[+]  cxcreln		  ^bzip2@1.0.8%gcc@7.5.0~debug~pic+shared build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  c3uhkcj		      ^diffutils@3.8%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  cpmynty		  ^gdbm@1.23%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kgyvtw5		      ^readline@8.1.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  mfxvu5f	  ^openmpi@4.1.4%gcc@7.5.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics=none schedulers=none arch=linux-ubuntu18.04-x86_64
[+]  qbwqmk6	      ^numactl@2.0.14%gcc@7.5.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-ubuntu18.04-x86_64
[+]  btoteei		  ^autoconf@2.69%gcc@7.5.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu18.04-x86_64
[+]  rxjqnjw		  ^automake@1.16.5%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  z7d5q4f		  ^m4@1.4.19%gcc@7.5.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu18.04-x86_64
[+]  e262sf6		      ^libsigsegv@2.13%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  xevso22	      ^openssh@9.1p1%gcc@7.5.0+gssapi build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  y6ek4vz		  ^krb5@1.19.3%gcc@7.5.0+shared build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  wobmzgv		      ^bison@3.8.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  hj6szik		      ^gettext@0.21.1%gcc@7.5.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kawegoy			  ^tar@1.34%gcc@7.5.0 build_system=autotools zip=pigz arch=linux-ubuntu18.04-x86_64
[+]  wod35ny			      ^pigz@2.7%gcc@7.5.0 build_system=makefile arch=linux-ubuntu18.04-x86_64
[+]  fprmzmo			      ^zstd@1.5.2%gcc@7.5.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  6pzeykr		  ^libedit@3.1-20210216%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  76ul6un	      ^pmix@4.1.2%gcc@7.5.0~docs+pmi_backwards_compatibility~restful build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  nblr6w4		  ^libevent@2.1.12%gcc@7.5.0+openssl build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  2hfr5rb	      ^zlib@1.2.13%gcc@7.5.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu18.04-x86_64

==> Installing environment myproject
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pkgconf-1.8.0-k2lfw6fht6zvsfihvx3avihboi3uv455
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/ca-certificates-mozilla-2022-10-11-aurd37jjebxaqzs73saip5v6hgfu3foj
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/berkeley-db-18.1.40-53fb72wziswrec6tkbjpowshkul2nsk4
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libiconv-1.16-ltvovvvjgmlvy4m2pn365cy6p5dysajq
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zlib-1.2.13-2hfr5rbzefrxf6t6kv4trbsl63puaza6
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libsigsegv-2.13-e262sf6ptgnmyu7zkflzp3ycbdfqz7hf
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/util-macros-1.19.3-ao5w53rpwhgfruk2zrqcehlov5slestd
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/xz-5.2.7-nrwxythffgfumjv7skmgdjtxaunlmqau
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zstd-1.5.2-fprmzmoubdjdr663rprctp2tuqiv5apu
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/ncurses-6.3-zcuawlif55qhuknvbk4jez7xjcxhnydf
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/diffutils-3.8-c3uhkcjt7tagz2djrd6r2b6b3c2tia3s
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pigz-2.7-wod35nye4qcrkbopr23zoy5qb3ywp3v3
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libxml2-2.10.1-4aq5aj2n5u2n3dbrb76pnhoil6tv3e4e
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/readline-8.1.2-kgyvtw5h6mi5nms32x3vzgbw32ymmfwa
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libedit-3.1-20210216-6pzeykrtvrkpbw6u3mq6likd4ktvah76
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/bzip2-1.0.8-cxcrelnw64jh6lvhzb6pfar7nijv6us6
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/m4-1.4.19-z7d5q4f2qzxejx4xxdrj45q5gxur6q7b
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/gdbm-1.23-cpmyntybsnm3se7lfnvqosbiqzrcg2kq
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/tar-1.34-kawegoyhusotpo5mlsqnjqf6ngrjyj2w
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libtool-2.4.7-bdxu4wnbhlmvj6sh5y7uynrldzepiilz
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/perl-5.36.0-eydiwimku2cctu6dsom3yvfxxjmqyr4w
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/gettext-0.21.1-hj6szikaqzdpxa36gk4w72m4czhwd6gu
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libpciaccess-0.16-p7f5n6q6kwnzq7syvqbslnotl72yxs23
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/openssl-1.1.1s-yr4z2pt4jnp5fltumr2my3badazsarz2
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/openblas-0.3.21-3db4ryrsdfg5b7wzxeruwdhhx3lt7uux
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/autoconf-2.69-btoteeiz74epw4kulm7aecae4cxraxua
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/bison-3.8.2-wobmzgvlc235muaaxwehzblkgcnhvwtn
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/hwloc-2.8.0-5yywrk2zoib75deet4eu4ocxim2ldngq
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/cmake-3.24.3-stszbnscxrtgzqrwmx2wfwsuntf47mpy
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libevent-2.1.12-nblr6w4gwbdyhjz2z5lg5pseztxnb7gh
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/automake-1.16.5-rxjqnjw5jkrbym5x4yshogm3f262crre
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/krb5-1.19.3-y6ek4vz7ntj6qw26jv2trb3ok4m5koxy
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pmix-4.1.2-76ul6unbdppxalfkkxjqzoky7lu4jqpo
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/numactl-2.0.14-qbwqmk6qylskqtyrfuyfp36f465bxrrk
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/openssh-9.1p1-xevso22q5f5fb2bqp5lhuutgvrqtiolo
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/openmpi-4.1.4-mfxvu5fnaac33f4pw25rjrojafbbupwb
==> Installing trilinos-13.0.1-brfmatydwbrssme6d6bnwcsh5spxv7zz
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-trilinos-13.0.1-brfmatydwbrssme6d6bnwcsh5spxv7zz.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/trilinos-13.0.1/linux-ubuntu18.04-x86_64-gcc-7.5.0-trilinos-13.0.1-brfmatydwbrssme6d6bnwcsh5spxv7zz.spack
==> Extracting trilinos-13.0.1-brfmatydwbrssme6d6bnwcsh5spxv7zz from binary cache
==> trilinos: Successfully installed trilinos-13.0.1-brfmatydwbrssme6d6bnwcsh5spxv7zz
  Fetch: 0.48s.	 Build: 6.23s.	Total: 6.71s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/trilinos-13.0.1-brfmatydwbrssme6d6bnwcsh5spxv7zz
==> Updating view at /home/spack/spack/var/spack/environments/myproject/.spack-env/view

We see that tcl and the dependencies of trilinos are already installed, and that trilinos was newly installed. We also see that the environment’s view was updated to include the new installations.

Now confirm the contents of the environment using spack find:

$ spack find
==> In environment myproject
==> Root specs
tcl  trilinos

==> Installed packages
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
autoconf@2.69	     bison@3.8.2			 cmake@3.24.3	gettext@0.21.1	libedit@3.1-20210216  libpciaccess@0.16	 libxml2@2.10.1	 numactl@2.0.14	  openssh@9.1p1	  pigz@2.7	 readline@8.1.2	 trilinos@13.0.1     zlib@1.2.13
automake@1.16.5	     bzip2@1.0.8			 diffutils@3.8	hwloc@2.8.0	libevent@2.1.12	      libsigsegv@2.13	 m4@1.4.19	 openblas@0.3.21  openssl@1.1.1s  pkgconf@1.8.0	 tar@1.34	 util-macros@1.19.3  zstd@1.5.2
berkeley-db@18.1.40  ca-certificates-mozilla@2022-10-11	 gdbm@1.23	krb5@1.19.3	libiconv@1.16	      libtool@2.4.7	 ncurses@6.3	 openmpi@4.1.4	  perl@5.36.0	  pmix@4.1.2	 tcl@8.6.12	 xz@5.2.7
==> 38 installed packages

We can see that the roots and all their dependencies have been installed.

Using packages

Environments provide a convenient way for using installed packages. Running spack env activate gives you everything in the environment on your PATH. Otherwise, you would need to use spack load or module load for each package in order to set up the environment for the package (and its dependencies).

When you install packages into an environment, they are, by default, linked into a single prefix, or view. Activating the environment with spack env activate results in subdirectories from the view being added to PATH, LD_LIBRARY_PATH, CMAKE_PREFIX_PATH, and other environment variables. This makes the environment easier to use.

Let’s try it out. We just installed tcl into our myproject environment. Tcl includes a shell-like application called tclsh. You can see the path to tclsh using which:

$ which tclsh
/home/spack/spack/var/spack/environments/myproject/.spack-env/view/bin/tclsh

Notice its path includes the name of our environment and a view subdirectory.

You can now run tclsh like you would any other program that is in your path:

$ tclsh
% echo "hello world!"
hello world!
% exit

Uninstalling packages

We can uninstall packages from an environment without affecting other environments. This is possible since, while Spack shares common installations, environments only link to those installations.

Let’s demonstrate this feature by creating another environment. Suppose myproject requires trilinos but we have another project that has it installed but no longer requires it.

Start by creating a myproject2 environment with the installed packages scr and trilinos.

$ spack env create myproject2
==> Created environment 'myproject2' in /home/spack/spack/var/spack/environments/myproject2
==> You can activate this environment with:
==>   spack env activate myproject2
$ spack env activate myproject2
$ spack add scr trilinos
==> Adding scr to environment myproject2
==> Adding trilinos to environment myproject2
$ spack install
==> Concretized scr
 -   nwawfek  scr@2.0.0%gcc@7.5.0+dtcmp~fortran~ipo+libyogrt async_api=NONE build_system=cmake build_type=RelWithDebInfo cache_base=/dev/shm cntl_base=/dev/shm copy_config=none file_lock=FLOCK resource_manager=SLURM scr_config=scr.conf arch=linux-ubuntu18.04-x86_64
[+]  stszbns	  ^cmake@3.24.3%gcc@7.5.0~doc+ncurses+ownlibs~qt build_system=generic build_type=Release arch=linux-ubuntu18.04-x86_64
[+]  zcuawli	      ^ncurses@6.3%gcc@7.5.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  yr4z2pt	      ^openssl@1.1.1s%gcc@7.5.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu18.04-x86_64
[+]  aurd37j		  ^ca-certificates-mozilla@2022-10-11%gcc@7.5.0 build_system=generic arch=linux-ubuntu18.04-x86_64
 -   jpa7i2q	  ^dtcmp@1.1.4%gcc@7.5.0+shared build_system=autotools arch=linux-ubuntu18.04-x86_64
 -   it5zkjf	      ^lwgrp@1.0.5%gcc@7.5.0+shared build_system=autotools arch=linux-ubuntu18.04-x86_64
 -   kv6hvaf	  ^libyogrt@1.27%gcc@7.5.0~static build_system=autotools scheduler=slurm arch=linux-ubuntu18.04-x86_64
 -   p2tmqkb	      ^slurm@21-08-8-2%gcc@7.5.0~gtk~hdf5~hwloc~mariadb~pmix+readline~restd build_system=autotools sysconfdir=PREFIX/etc arch=linux-ubuntu18.04-x86_64
 -   wc2juod		  ^curl@7.85.0%gcc@7.5.0~gssapi~ldap~libidn2~librtmp~libssh~libssh2~nghttp2 build_system=autotools libs=shared,static tls=openssl arch=linux-ubuntu18.04-x86_64
 -   z5u7d3q		  ^glib@2.74.1%gcc@7.5.0~libmount build_system=generic tracing=none arch=linux-ubuntu18.04-x86_64
[+]  hj6szik		      ^gettext@0.21.1%gcc@7.5.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kawegoy			  ^tar@1.34%gcc@7.5.0 build_system=autotools zip=pigz arch=linux-ubuntu18.04-x86_64
[+]  wod35ny			      ^pigz@2.7%gcc@7.5.0 build_system=makefile arch=linux-ubuntu18.04-x86_64
[+]  fprmzmo			      ^zstd@1.5.2%gcc@7.5.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  qzq4b7h		      ^libffi@3.4.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ltvovvv		      ^libiconv@1.16%gcc@7.5.0 build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
 -   z43z3fa		      ^meson@0.63.3%gcc@7.5.0 build_system=python_pip patches=aa6c50d arch=linux-ubuntu18.04-x86_64
 -   bfqiunh			  ^py-pip@22.2.2%gcc@7.5.0 build_system=generic arch=linux-ubuntu18.04-x86_64
 -   xik3yv6			  ^py-setuptools@65.5.0%gcc@7.5.0 build_system=generic arch=linux-ubuntu18.04-x86_64
 -   4yhmu3f			  ^py-wheel@0.37.1%gcc@7.5.0 build_system=generic arch=linux-ubuntu18.04-x86_64
 -   ml4nwp3		      ^ninja@1.11.1%gcc@7.5.0 build_system=generic arch=linux-ubuntu18.04-x86_64
 -   gtbod2d		      ^pcre2@10.39%gcc@7.5.0~jit+multibyte build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  cyf55fe		      ^python@3.10.8%gcc@7.5.0+bz2+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tix~tkinter~ucs4+uuid+zlib build_system=generic patches=0d98e93,7d40923,f2fd060 arch=linux-ubuntu18.04-x86_64
[+]  j5k5nzg			  ^expat@2.4.8%gcc@7.5.0+libbsd build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  qieib3t			      ^libbsd@0.11.5%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  miq3rrs				  ^libmd@1.0.4%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  vmf7qax			  ^sqlite@3.39.4%gcc@7.5.0+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  eayyoxj			  ^util-linux-uuid@2.38.1%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
 -   wwi7hmc		  ^json-c@0.16%gcc@7.5.0~ipo build_system=cmake build_type=RelWithDebInfo arch=linux-ubuntu18.04-x86_64
 -   grcwjnc		  ^lz4@1.9.4%gcc@7.5.0 build_system=makefile libs=shared,static arch=linux-ubuntu18.04-x86_64
 -   llrb4kh		  ^munge@0.5.15%gcc@7.5.0 build_system=autotools localstatedir=PREFIX/var arch=linux-ubuntu18.04-x86_64
 -   xnc35ij		      ^libgcrypt@1.10.1%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
 -   m6alhez			  ^libgpg-error@1.46%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
 -   nybpksa			      ^gawk@5.1.1%gcc@7.5.0~nls build_system=autotools arch=linux-ubuntu18.04-x86_64
 -   iowhen4				  ^gmp@6.2.1%gcc@7.5.0 build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
 -   h4tcmq3				  ^mpfr@4.1.0%gcc@7.5.0 build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
 -   rolnbco				      ^autoconf-archive@2022.02.11%gcc@7.5.0 build_system=autotools patches=139214f arch=linux-ubuntu18.04-x86_64
 -   hdyi7fu				      ^texinfo@6.5%gcc@7.5.0 build_system=autotools patches=12f6edb,1732115 arch=linux-ubuntu18.04-x86_64
[+]  kgyvtw5		  ^readline@8.1.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  mfxvu5f	  ^openmpi@4.1.4%gcc@7.5.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics=none schedulers=none arch=linux-ubuntu18.04-x86_64
[+]  5yywrk2	      ^hwloc@2.8.0%gcc@7.5.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  p7f5n6q		  ^libpciaccess@0.16%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ao5w53r		      ^util-macros@1.19.3%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  4aq5aj2		  ^libxml2@2.10.1%gcc@7.5.0~python build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  nrwxyth		      ^xz@5.2.7%gcc@7.5.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  qbwqmk6	      ^numactl@2.0.14%gcc@7.5.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-ubuntu18.04-x86_64
[+]  btoteei		  ^autoconf@2.69%gcc@7.5.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu18.04-x86_64
[+]  rxjqnjw		  ^automake@1.16.5%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  bdxu4wn		  ^libtool@2.4.7%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  z7d5q4f		  ^m4@1.4.19%gcc@7.5.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu18.04-x86_64
[+]  c3uhkcj		      ^diffutils@3.8%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  e262sf6		      ^libsigsegv@2.13%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  xevso22	      ^openssh@9.1p1%gcc@7.5.0+gssapi build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  y6ek4vz		  ^krb5@1.19.3%gcc@7.5.0+shared build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  wobmzgv		      ^bison@3.8.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  6pzeykr		  ^libedit@3.1-20210216%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  eydiwim	      ^perl@5.36.0%gcc@7.5.0+cpanm+shared+threads build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  53fb72w		  ^berkeley-db@18.1.40%gcc@7.5.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu18.04-x86_64
[+]  cxcreln		  ^bzip2@1.0.8%gcc@7.5.0~debug~pic+shared build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  cpmynty		  ^gdbm@1.23%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  k2lfw6f	      ^pkgconf@1.8.0%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  76ul6un	      ^pmix@4.1.2%gcc@7.5.0~docs+pmi_backwards_compatibility~restful build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  nblr6w4		  ^libevent@2.1.12%gcc@7.5.0+openssl build_system=autotools arch=linux-ubuntu18.04-x86_64
 -   2uj3346	  ^pdsh@2.31%gcc@7.5.0+ssh+static_modules build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  2hfr5rb	  ^zlib@1.2.13%gcc@7.5.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu18.04-x86_64

==> Concretized trilinos
[+]  brfmaty  trilinos@13.0.1%gcc@7.5.0~adelus~adios2+amesos+amesos2+anasazi+aztec~basker+belos~boost~chaco~complex~cuda~cuda_rdc~debug~dtk+epetra+epetraext~epetraextbtf~epetraextexperimental~epetraextgraphreorderings~exodus+explicit_template_instantiation~float+fortran~gtest~hdf5~hypre+ifpack+ifpack2~intrepid~intrepid2~ipo~isorropia+kokkos~mesquite~minitensor+ml+mpi+muelu~mumps~nox~openmp~panzer~phalanx~piro~python~rocm~rocm_rdc~rol~rythmos+sacado~scorec~shards+shared~shylu~stk~stokhos~stratimikos~strumpack~suite-sparse~superlu~superlu-dist~teko~tempus~thyra+tpetra~trilinoscouplings~wrapper~x11~zoltan~zoltan2 build_system=cmake build_type=RelWithDebInfo cxxstd=14 gotype=long_long arch=linux-ubuntu18.04-x86_64
[+]  stszbns	  ^cmake@3.24.3%gcc@7.5.0~doc+ncurses+ownlibs~qt build_system=generic build_type=Release arch=linux-ubuntu18.04-x86_64
[+]  zcuawli	      ^ncurses@6.3%gcc@7.5.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  yr4z2pt	      ^openssl@1.1.1s%gcc@7.5.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu18.04-x86_64
[+]  aurd37j		  ^ca-certificates-mozilla@2022-10-11%gcc@7.5.0 build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  5yywrk2	  ^hwloc@2.8.0%gcc@7.5.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  p7f5n6q	      ^libpciaccess@0.16%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  bdxu4wn		  ^libtool@2.4.7%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ao5w53r		  ^util-macros@1.19.3%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  4aq5aj2	      ^libxml2@2.10.1%gcc@7.5.0~python build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ltvovvv		  ^libiconv@1.16%gcc@7.5.0 build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  nrwxyth		  ^xz@5.2.7%gcc@7.5.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  k2lfw6f	      ^pkgconf@1.8.0%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  3db4ryr	  ^openblas@0.3.21%gcc@7.5.0~bignuma~consistent_fpcsr+fortran~ilp64+locking+pic+shared build_system=makefile patches=d3d9b15 symbol_suffix=none threads=none arch=linux-ubuntu18.04-x86_64
[+]  eydiwim	      ^perl@5.36.0%gcc@7.5.0+cpanm+shared+threads build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  53fb72w		  ^berkeley-db@18.1.40%gcc@7.5.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu18.04-x86_64
[+]  cxcreln		  ^bzip2@1.0.8%gcc@7.5.0~debug~pic+shared build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  c3uhkcj		      ^diffutils@3.8%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  cpmynty		  ^gdbm@1.23%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kgyvtw5		      ^readline@8.1.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  mfxvu5f	  ^openmpi@4.1.4%gcc@7.5.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics=none schedulers=none arch=linux-ubuntu18.04-x86_64
[+]  qbwqmk6	      ^numactl@2.0.14%gcc@7.5.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-ubuntu18.04-x86_64
[+]  btoteei		  ^autoconf@2.69%gcc@7.5.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu18.04-x86_64
[+]  rxjqnjw		  ^automake@1.16.5%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  z7d5q4f		  ^m4@1.4.19%gcc@7.5.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu18.04-x86_64
[+]  e262sf6		      ^libsigsegv@2.13%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  xevso22	      ^openssh@9.1p1%gcc@7.5.0+gssapi build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  y6ek4vz		  ^krb5@1.19.3%gcc@7.5.0+shared build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  wobmzgv		      ^bison@3.8.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  hj6szik		      ^gettext@0.21.1%gcc@7.5.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kawegoy			  ^tar@1.34%gcc@7.5.0 build_system=autotools zip=pigz arch=linux-ubuntu18.04-x86_64
[+]  wod35ny			      ^pigz@2.7%gcc@7.5.0 build_system=makefile arch=linux-ubuntu18.04-x86_64
[+]  fprmzmo			      ^zstd@1.5.2%gcc@7.5.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  6pzeykr		  ^libedit@3.1-20210216%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  76ul6un	      ^pmix@4.1.2%gcc@7.5.0~docs+pmi_backwards_compatibility~restful build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  nblr6w4		  ^libevent@2.1.12%gcc@7.5.0+openssl build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  2hfr5rb	      ^zlib@1.2.13%gcc@7.5.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu18.04-x86_64

==> Installing environment myproject2
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pkgconf-1.8.0-k2lfw6fht6zvsfihvx3avihboi3uv455
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/ca-certificates-mozilla-2022-10-11-aurd37jjebxaqzs73saip5v6hgfu3foj
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/berkeley-db-18.1.40-53fb72wziswrec6tkbjpowshkul2nsk4
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libiconv-1.16-ltvovvvjgmlvy4m2pn365cy6p5dysajq
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zlib-1.2.13-2hfr5rbzefrxf6t6kv4trbsl63puaza6
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libsigsegv-2.13-e262sf6ptgnmyu7zkflzp3ycbdfqz7hf
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/util-macros-1.19.3-ao5w53rpwhgfruk2zrqcehlov5slestd
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/xz-5.2.7-nrwxythffgfumjv7skmgdjtxaunlmqau
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zstd-1.5.2-fprmzmoubdjdr663rprctp2tuqiv5apu
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libffi-3.4.2-qzq4b7hjmtrswtnnezcytreqg4vtsgi5
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libmd-1.0.4-miq3rrs534mewt3w5r3wd5jp3lkk7y25
==> Installing pcre2-10.39-gtbod2djn4h7cg7l6zq7kgmr3cvidirf
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-pcre2-10.39-gtbod2djn4h7cg7l6zq7kgmr3cvidirf.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/pcre2-10.39/linux-ubuntu18.04-x86_64-gcc-7.5.0-pcre2-10.39-gtbod2djn4h7cg7l6zq7kgmr3cvidirf.spack
==> Extracting pcre2-10.39-gtbod2djn4h7cg7l6zq7kgmr3cvidirf from binary cache
==> pcre2: Successfully installed pcre2-10.39-gtbod2djn4h7cg7l6zq7kgmr3cvidirf
  Fetch: 0.19s.	 Build: 0.29s.	Total: 0.48s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pcre2-10.39-gtbod2djn4h7cg7l6zq7kgmr3cvidirf
==> Installing lz4-1.9.4-grcwjnc4w2nzd3zc6dep44a4n5czwv6p
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-lz4-1.9.4-grcwjnc4w2nzd3zc6dep44a4n5czwv6p.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/lz4-1.9.4/linux-ubuntu18.04-x86_64-gcc-7.5.0-lz4-1.9.4-grcwjnc4w2nzd3zc6dep44a4n5czwv6p.spack
==> Extracting lz4-1.9.4-grcwjnc4w2nzd3zc6dep44a4n5czwv6p from binary cache
==> lz4: Successfully installed lz4-1.9.4-grcwjnc4w2nzd3zc6dep44a4n5czwv6p
  Fetch: 0.03s.	 Build: 0.25s.	Total: 0.28s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/lz4-1.9.4-grcwjnc4w2nzd3zc6dep44a4n5czwv6p
==> Installing autoconf-archive-2022.02.11-rolnbcory6fewimzpvvipa7jevkmizst
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-autoconf-archive-2022.02.11-rolnbcory6fewimzpvvipa7jevkmizst.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/autoconf-archive-2022.02.11/linux-ubuntu18.04-x86_64-gcc-7.5.0-autoconf-archive-2022.02.11-rolnbcory6fewimzpvvipa7jevkmizst.spack
==> Extracting autoconf-archive-2022.02.11-rolnbcory6fewimzpvvipa7jevkmizst from binary cache
==> autoconf-archive: Successfully installed autoconf-archive-2022.02.11-rolnbcory6fewimzpvvipa7jevkmizst
  Fetch: 0.03s.	 Build: 0.32s.	Total: 0.35s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/autoconf-archive-2022.02.11-rolnbcory6fewimzpvvipa7jevkmizst
==> Installing pdsh-2.31-2uj33464g4syt2zl7xjzs7srr2pbcugv
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-pdsh-2.31-2uj33464g4syt2zl7xjzs7srr2pbcugv.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/pdsh-2.31/linux-ubuntu18.04-x86_64-gcc-7.5.0-pdsh-2.31-2uj33464g4syt2zl7xjzs7srr2pbcugv.spack
==> Extracting pdsh-2.31-2uj33464g4syt2zl7xjzs7srr2pbcugv from binary cache
==> pdsh: Successfully installed pdsh-2.31-2uj33464g4syt2zl7xjzs7srr2pbcugv
  Fetch: 0.03s.	 Build: 0.24s.	Total: 0.27s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pdsh-2.31-2uj33464g4syt2zl7xjzs7srr2pbcugv
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/ncurses-6.3-zcuawlif55qhuknvbk4jez7xjcxhnydf
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/util-linux-uuid-2.38.1-eayyoxjdfrc2wivabs5jbipcofeluyyo
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/diffutils-3.8-c3uhkcjt7tagz2djrd6r2b6b3c2tia3s
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pigz-2.7-wod35nye4qcrkbopr23zoy5qb3ywp3v3
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libxml2-2.10.1-4aq5aj2n5u2n3dbrb76pnhoil6tv3e4e
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libbsd-0.11.5-qieib3tiyp74ps4kn3jail7bot35t7hp
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libedit-3.1-20210216-6pzeykrtvrkpbw6u3mq6likd4ktvah76
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/readline-8.1.2-kgyvtw5h6mi5nms32x3vzgbw32ymmfwa
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/bzip2-1.0.8-cxcrelnw64jh6lvhzb6pfar7nijv6us6
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/m4-1.4.19-z7d5q4f2qzxejx4xxdrj45q5gxur6q7b
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/expat-2.4.8-j5k5nzgsbhue6ylglt4gtrnm6okuvsj6
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/gdbm-1.23-cpmyntybsnm3se7lfnvqosbiqzrcg2kq
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/sqlite-3.39.4-vmf7qax3kowjkec5bzohcqvo5rqgm3xx
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/tar-1.34-kawegoyhusotpo5mlsqnjqf6ngrjyj2w
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libtool-2.4.7-bdxu4wnbhlmvj6sh5y7uynrldzepiilz
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/perl-5.36.0-eydiwimku2cctu6dsom3yvfxxjmqyr4w
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/gettext-0.21.1-hj6szikaqzdpxa36gk4w72m4czhwd6gu
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libpciaccess-0.16-p7f5n6q6kwnzq7syvqbslnotl72yxs23
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/autoconf-2.69-btoteeiz74epw4kulm7aecae4cxraxua
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/bison-3.8.2-wobmzgvlc235muaaxwehzblkgcnhvwtn
==> Installing texinfo-6.5-hdyi7fuh542t3qqvlg54vyuzde2pxdf4
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-texinfo-6.5-hdyi7fuh542t3qqvlg54vyuzde2pxdf4.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/texinfo-6.5/linux-ubuntu18.04-x86_64-gcc-7.5.0-texinfo-6.5-hdyi7fuh542t3qqvlg54vyuzde2pxdf4.spack
==> Extracting texinfo-6.5-hdyi7fuh542t3qqvlg54vyuzde2pxdf4 from binary cache
==> texinfo: Successfully installed texinfo-6.5-hdyi7fuh542t3qqvlg54vyuzde2pxdf4
  Fetch: 0.04s.	 Build: 0.37s.	Total: 0.41s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/texinfo-6.5-hdyi7fuh542t3qqvlg54vyuzde2pxdf4
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/openssl-1.1.1s-yr4z2pt4jnp5fltumr2my3badazsarz2
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/hwloc-2.8.0-5yywrk2zoib75deet4eu4ocxim2ldngq
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/automake-1.16.5-rxjqnjw5jkrbym5x4yshogm3f262crre
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/cmake-3.24.3-stszbnscxrtgzqrwmx2wfwsuntf47mpy
==> Installing curl-7.85.0-wc2juodapwp4gefbkhbidihvu3ujxrkr
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-curl-7.85.0-wc2juodapwp4gefbkhbidihvu3ujxrkr.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/curl-7.85.0/linux-ubuntu18.04-x86_64-gcc-7.5.0-curl-7.85.0-wc2juodapwp4gefbkhbidihvu3ujxrkr.spack
==> Extracting curl-7.85.0-wc2juodapwp4gefbkhbidihvu3ujxrkr from binary cache
==> curl: Successfully installed curl-7.85.0-wc2juodapwp4gefbkhbidihvu3ujxrkr
  Fetch: 0.03s.	 Build: 0.32s.	Total: 0.35s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/curl-7.85.0-wc2juodapwp4gefbkhbidihvu3ujxrkr
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/python-3.10.8-cyf55fezf7ib2o6wqflx2jo7xz6tobwh
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libevent-2.1.12-nblr6w4gwbdyhjz2z5lg5pseztxnb7gh
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/krb5-1.19.3-y6ek4vz7ntj6qw26jv2trb3ok4m5koxy
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/numactl-2.0.14-qbwqmk6qylskqtyrfuyfp36f465bxrrk
==> Installing gmp-6.2.1-iowhen4zynaexq7iy4m2hiifo5mrzbrd
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-gmp-6.2.1-iowhen4zynaexq7iy4m2hiifo5mrzbrd.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/gmp-6.2.1/linux-ubuntu18.04-x86_64-gcc-7.5.0-gmp-6.2.1-iowhen4zynaexq7iy4m2hiifo5mrzbrd.spack
==> Extracting gmp-6.2.1-iowhen4zynaexq7iy4m2hiifo5mrzbrd from binary cache
==> gmp: Successfully installed gmp-6.2.1-iowhen4zynaexq7iy4m2hiifo5mrzbrd
  Fetch: 0.04s.	 Build: 0.26s.	Total: 0.29s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/gmp-6.2.1-iowhen4zynaexq7iy4m2hiifo5mrzbrd
==> Installing json-c-0.16-wwi7hmc7ocqwnpa3dobrfdnditsw7ru6
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-json-c-0.16-wwi7hmc7ocqwnpa3dobrfdnditsw7ru6.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/json-c-0.16/linux-ubuntu18.04-x86_64-gcc-7.5.0-json-c-0.16-wwi7hmc7ocqwnpa3dobrfdnditsw7ru6.spack
==> Extracting json-c-0.16-wwi7hmc7ocqwnpa3dobrfdnditsw7ru6 from binary cache
==> json-c: Successfully installed json-c-0.16-wwi7hmc7ocqwnpa3dobrfdnditsw7ru6
  Fetch: 0.03s.	 Build: 0.25s.	Total: 0.28s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/json-c-0.16-wwi7hmc7ocqwnpa3dobrfdnditsw7ru6
==> Installing ninja-1.11.1-ml4nwp3v4s6q54gcsoc53wutn3raowvk
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-ninja-1.11.1-ml4nwp3v4s6q54gcsoc53wutn3raowvk.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/ninja-1.11.1/linux-ubuntu18.04-x86_64-gcc-7.5.0-ninja-1.11.1-ml4nwp3v4s6q54gcsoc53wutn3raowvk.spack
==> Extracting ninja-1.11.1-ml4nwp3v4s6q54gcsoc53wutn3raowvk from binary cache
==> ninja: Successfully installed ninja-1.11.1-ml4nwp3v4s6q54gcsoc53wutn3raowvk
  Fetch: 0.04s.	 Build: 0.29s.	Total: 0.33s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/ninja-1.11.1-ml4nwp3v4s6q54gcsoc53wutn3raowvk
==> Installing py-pip-22.2.2-bfqiunh7k42vvq43y5lujt5zuuc3lcvi
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-py-pip-22.2.2-bfqiunh7k42vvq43y5lujt5zuuc3lcvi.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/py-pip-22.2.2/linux-ubuntu18.04-x86_64-gcc-7.5.0-py-pip-22.2.2-bfqiunh7k42vvq43y5lujt5zuuc3lcvi.spack
==> Extracting py-pip-22.2.2-bfqiunh7k42vvq43y5lujt5zuuc3lcvi from binary cache
==> py-pip: Successfully installed py-pip-22.2.2-bfqiunh7k42vvq43y5lujt5zuuc3lcvi
  Fetch: 0.04s.	 Build: 0.45s.	Total: 0.49s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/py-pip-22.2.2-bfqiunh7k42vvq43y5lujt5zuuc3lcvi
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pmix-4.1.2-76ul6unbdppxalfkkxjqzoky7lu4jqpo
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/openssh-9.1p1-xevso22q5f5fb2bqp5lhuutgvrqtiolo
==> Installing mpfr-4.1.0-h4tcmq3wd42mfqs6tjbnxdfmcqclhnja
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-mpfr-4.1.0-h4tcmq3wd42mfqs6tjbnxdfmcqclhnja.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/mpfr-4.1.0/linux-ubuntu18.04-x86_64-gcc-7.5.0-mpfr-4.1.0-h4tcmq3wd42mfqs6tjbnxdfmcqclhnja.spack
==> Extracting mpfr-4.1.0-h4tcmq3wd42mfqs6tjbnxdfmcqclhnja from binary cache
==> mpfr: Successfully installed mpfr-4.1.0-h4tcmq3wd42mfqs6tjbnxdfmcqclhnja
  Fetch: 0.03s.	 Build: 0.31s.	Total: 0.34s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/mpfr-4.1.0-h4tcmq3wd42mfqs6tjbnxdfmcqclhnja
==> Installing py-setuptools-65.5.0-xik3yv6hrn34w2uxyoziewydq5ghsvct
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-py-setuptools-65.5.0-xik3yv6hrn34w2uxyoziewydq5ghsvct.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/py-setuptools-65.5.0/linux-ubuntu18.04-x86_64-gcc-7.5.0-py-setuptools-65.5.0-xik3yv6hrn34w2uxyoziewydq5ghsvct.spack
==> Extracting py-setuptools-65.5.0-xik3yv6hrn34w2uxyoziewydq5ghsvct from binary cache
==> py-setuptools: Successfully installed py-setuptools-65.5.0-xik3yv6hrn34w2uxyoziewydq5ghsvct
  Fetch: 0.03s.	 Build: 0.36s.	Total: 0.39s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/py-setuptools-65.5.0-xik3yv6hrn34w2uxyoziewydq5ghsvct
==> Installing py-wheel-0.37.1-4yhmu3f525p7z3hgjwd52wvrt2cf5csp
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-py-wheel-0.37.1-4yhmu3f525p7z3hgjwd52wvrt2cf5csp.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/py-wheel-0.37.1/linux-ubuntu18.04-x86_64-gcc-7.5.0-py-wheel-0.37.1-4yhmu3f525p7z3hgjwd52wvrt2cf5csp.spack
==> Extracting py-wheel-0.37.1-4yhmu3f525p7z3hgjwd52wvrt2cf5csp from binary cache
==> py-wheel: Successfully installed py-wheel-0.37.1-4yhmu3f525p7z3hgjwd52wvrt2cf5csp
  Fetch: 0.03s.	 Build: 0.26s.	Total: 0.29s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/py-wheel-0.37.1-4yhmu3f525p7z3hgjwd52wvrt2cf5csp
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/openmpi-4.1.4-mfxvu5fnaac33f4pw25rjrojafbbupwb
==> Installing gawk-5.1.1-nybpksaml4vhocx5bgf6gjkdhhgv7s5m
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-gawk-5.1.1-nybpksaml4vhocx5bgf6gjkdhhgv7s5m.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/gawk-5.1.1/linux-ubuntu18.04-x86_64-gcc-7.5.0-gawk-5.1.1-nybpksaml4vhocx5bgf6gjkdhhgv7s5m.spack
==> Extracting gawk-5.1.1-nybpksaml4vhocx5bgf6gjkdhhgv7s5m from binary cache
==> gawk: Successfully installed gawk-5.1.1-nybpksaml4vhocx5bgf6gjkdhhgv7s5m
  Fetch: 0.04s.	 Build: 0.30s.	Total: 0.34s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/gawk-5.1.1-nybpksaml4vhocx5bgf6gjkdhhgv7s5m
==> Installing meson-0.63.3-z43z3fayvyu6rvyli4vckls6fmzj7rkm
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-meson-0.63.3-z43z3fayvyu6rvyli4vckls6fmzj7rkm.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/meson-0.63.3/linux-ubuntu18.04-x86_64-gcc-7.5.0-meson-0.63.3-z43z3fayvyu6rvyli4vckls6fmzj7rkm.spack
==> Extracting meson-0.63.3-z43z3fayvyu6rvyli4vckls6fmzj7rkm from binary cache
==> meson: Successfully installed meson-0.63.3-z43z3fayvyu6rvyli4vckls6fmzj7rkm
  Fetch: 0.04s.	 Build: 0.36s.	Total: 0.40s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/meson-0.63.3-z43z3fayvyu6rvyli4vckls6fmzj7rkm
==> Installing lwgrp-1.0.5-it5zkjffs6k5h2w2b5edd435hh5q7rb4
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-lwgrp-1.0.5-it5zkjffs6k5h2w2b5edd435hh5q7rb4.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/lwgrp-1.0.5/linux-ubuntu18.04-x86_64-gcc-7.5.0-lwgrp-1.0.5-it5zkjffs6k5h2w2b5edd435hh5q7rb4.spack
==> Extracting lwgrp-1.0.5-it5zkjffs6k5h2w2b5edd435hh5q7rb4 from binary cache
==> lwgrp: Successfully installed lwgrp-1.0.5-it5zkjffs6k5h2w2b5edd435hh5q7rb4
  Fetch: 0.03s.	 Build: 0.29s.	Total: 0.32s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/lwgrp-1.0.5-it5zkjffs6k5h2w2b5edd435hh5q7rb4
==> Installing libgpg-error-1.46-m6alhezor6no6rchjv3tarea5uwiyrcq
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-libgpg-error-1.46-m6alhezor6no6rchjv3tarea5uwiyrcq.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/libgpg-error-1.46/linux-ubuntu18.04-x86_64-gcc-7.5.0-libgpg-error-1.46-m6alhezor6no6rchjv3tarea5uwiyrcq.spack
==> Extracting libgpg-error-1.46-m6alhezor6no6rchjv3tarea5uwiyrcq from binary cache
==> libgpg-error: Successfully installed libgpg-error-1.46-m6alhezor6no6rchjv3tarea5uwiyrcq
  Fetch: 0.03s.	 Build: 0.29s.	Total: 0.32s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libgpg-error-1.46-m6alhezor6no6rchjv3tarea5uwiyrcq
==> Installing glib-2.74.1-z5u7d3qcayzgiie4wm67sfwgxb5qegzg
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-glib-2.74.1-z5u7d3qcayzgiie4wm67sfwgxb5qegzg.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/glib-2.74.1/linux-ubuntu18.04-x86_64-gcc-7.5.0-glib-2.74.1-z5u7d3qcayzgiie4wm67sfwgxb5qegzg.spack
==> Extracting glib-2.74.1-z5u7d3qcayzgiie4wm67sfwgxb5qegzg from binary cache
==> glib: Successfully installed glib-2.74.1-z5u7d3qcayzgiie4wm67sfwgxb5qegzg
  Fetch: 0.04s.	 Build: 0.47s.	Total: 0.50s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/glib-2.74.1-z5u7d3qcayzgiie4wm67sfwgxb5qegzg
==> Installing dtcmp-1.1.4-jpa7i2qvbaekm7brfqrtc4tzjmn5v2fa
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-dtcmp-1.1.4-jpa7i2qvbaekm7brfqrtc4tzjmn5v2fa.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/dtcmp-1.1.4/linux-ubuntu18.04-x86_64-gcc-7.5.0-dtcmp-1.1.4-jpa7i2qvbaekm7brfqrtc4tzjmn5v2fa.spack
==> Extracting dtcmp-1.1.4-jpa7i2qvbaekm7brfqrtc4tzjmn5v2fa from binary cache
==> dtcmp: Successfully installed dtcmp-1.1.4-jpa7i2qvbaekm7brfqrtc4tzjmn5v2fa
  Fetch: 0.03s.	 Build: 0.29s.	Total: 0.33s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/dtcmp-1.1.4-jpa7i2qvbaekm7brfqrtc4tzjmn5v2fa
==> Installing libgcrypt-1.10.1-xnc35ijqqovpmtjpvpkrvfgfmyvzh6e5
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-libgcrypt-1.10.1-xnc35ijqqovpmtjpvpkrvfgfmyvzh6e5.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/libgcrypt-1.10.1/linux-ubuntu18.04-x86_64-gcc-7.5.0-libgcrypt-1.10.1-xnc35ijqqovpmtjpvpkrvfgfmyvzh6e5.spack
==> Extracting libgcrypt-1.10.1-xnc35ijqqovpmtjpvpkrvfgfmyvzh6e5 from binary cache
==> libgcrypt: Successfully installed libgcrypt-1.10.1-xnc35ijqqovpmtjpvpkrvfgfmyvzh6e5
  Fetch: 0.03s.	 Build: 0.29s.	Total: 0.32s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libgcrypt-1.10.1-xnc35ijqqovpmtjpvpkrvfgfmyvzh6e5
==> Installing munge-0.5.15-llrb4khbp62lfrziksu2jc5j7sgbpmnf
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-munge-0.5.15-llrb4khbp62lfrziksu2jc5j7sgbpmnf.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/munge-0.5.15/linux-ubuntu18.04-x86_64-gcc-7.5.0-munge-0.5.15-llrb4khbp62lfrziksu2jc5j7sgbpmnf.spack
==> Extracting munge-0.5.15-llrb4khbp62lfrziksu2jc5j7sgbpmnf from binary cache
==> munge: Successfully installed munge-0.5.15-llrb4khbp62lfrziksu2jc5j7sgbpmnf
  Fetch: 0.04s.	 Build: 0.28s.	Total: 0.31s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/munge-0.5.15-llrb4khbp62lfrziksu2jc5j7sgbpmnf
==> Installing slurm-21-08-8-2-p2tmqkbc2bel3xhzdsn7mviotgnidho7
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-slurm-21-08-8-2-p2tmqkbc2bel3xhzdsn7mviotgnidho7.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/slurm-21-08-8-2/linux-ubuntu18.04-x86_64-gcc-7.5.0-slurm-21-08-8-2-p2tmqkbc2bel3xhzdsn7mviotgnidho7.spack
==> Extracting slurm-21-08-8-2-p2tmqkbc2bel3xhzdsn7mviotgnidho7 from binary cache
==> slurm: Successfully installed slurm-21-08-8-2-p2tmqkbc2bel3xhzdsn7mviotgnidho7
  Fetch: 0.12s.	 Build: 2.57s.	Total: 2.69s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/slurm-21-08-8-2-p2tmqkbc2bel3xhzdsn7mviotgnidho7
==> Installing libyogrt-1.27-kv6hvafkm2l7ela2ozmz3zobwggljy6t
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-libyogrt-1.27-kv6hvafkm2l7ela2ozmz3zobwggljy6t.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/libyogrt-1.27/linux-ubuntu18.04-x86_64-gcc-7.5.0-libyogrt-1.27-kv6hvafkm2l7ela2ozmz3zobwggljy6t.spack
==> Extracting libyogrt-1.27-kv6hvafkm2l7ela2ozmz3zobwggljy6t from binary cache
==> libyogrt: Successfully installed libyogrt-1.27-kv6hvafkm2l7ela2ozmz3zobwggljy6t
  Fetch: 0.04s.	 Build: 0.30s.	Total: 0.33s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libyogrt-1.27-kv6hvafkm2l7ela2ozmz3zobwggljy6t
==> Installing scr-2.0.0-nwawfeki3hmft535gghknc57fooy4axu
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-scr-2.0.0-nwawfeki3hmft535gghknc57fooy4axu.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/scr-2.0.0/linux-ubuntu18.04-x86_64-gcc-7.5.0-scr-2.0.0-nwawfeki3hmft535gghknc57fooy4axu.spack
==> Extracting scr-2.0.0-nwawfeki3hmft535gghknc57fooy4axu from binary cache
==> scr: Successfully installed scr-2.0.0-nwawfeki3hmft535gghknc57fooy4axu
  Fetch: 0.04s.	 Build: 0.90s.	Total: 0.93s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/scr-2.0.0-nwawfeki3hmft535gghknc57fooy4axu
==> Updating view at /home/spack/spack/var/spack/environments/myproject2/.spack-env/view
$ spack find
==> In environment myproject2
==> Root specs
scr  trilinos

==> Installed packages
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
autoconf@2.69		     ca-certificates-mozilla@2022-10-11	 gawk@5.1.1	 json-c@0.16	       libgcrypt@1.10.1	  libtool@2.4.7	  meson@0.63.3	  openblas@0.3.21  perl@5.36.0		 py-wheel@0.37.1  tar@1.34		  zlib@1.2.13
autoconf-archive@2022.02.11  cmake@3.24.3			 gdbm@1.23	 krb5@1.19.3	       libgpg-error@1.46  libxml2@2.10.1  mpfr@4.1.0	  openmpi@4.1.4	   pigz@2.7		 python@3.10.8	  texinfo@6.5		  zstd@1.5.2
automake@1.16.5		     curl@7.85.0			 gettext@0.21.1	 libbsd@0.11.5	       libiconv@1.16	  libyogrt@1.27	  munge@0.5.15	  openssh@9.1p1	   pkgconf@1.8.0	 readline@8.1.2	  trilinos@13.0.1
berkeley-db@18.1.40	     diffutils@3.8			 glib@2.74.1	 libedit@3.1-20210216  libmd@1.0.4	  lwgrp@1.0.5	  ncurses@6.3	  openssl@1.1.1s   pmix@4.1.2		 scr@2.0.0	  util-linux-uuid@2.38.1
bison@3.8.2		     dtcmp@1.1.4			 gmp@6.2.1	 libevent@2.1.12       libpciaccess@0.16  lz4@1.9.4	  ninja@1.11.1	  pcre2@10.39	   py-pip@22.2.2	 slurm@21-08-8-2  util-macros@1.19.3
bzip2@1.0.8		     expat@2.4.8			 hwloc@2.8.0	 libffi@3.4.2	       libsigsegv@2.13	  m4@1.4.19	  numactl@2.0.14  pdsh@2.31	   py-setuptools@65.5.0	 sqlite@3.39.4	  xz@5.2.7
==> 68 installed packages

Now we have two environments. The myproject environment has tcl and trilinos while the myproject2 environment has scr and trilinos.

Now let’s uninstall trilinos from myproject2 and review the contents of the environment:

$ spack uninstall -y trilinos
==> Will not uninstall trilinos@13.0.1%gcc@7.5.0/brfmaty
It is used by the following other environments:
    myproject

==> Error: There are still dependents.
  use `spack env remove` to remove from environments
$ spack find
==> In environment myproject2
==> Root specs
scr  trilinos

==> Installed packages
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
autoconf@2.69		     ca-certificates-mozilla@2022-10-11	 gawk@5.1.1	 json-c@0.16	       libgcrypt@1.10.1	  libtool@2.4.7	  meson@0.63.3	  openblas@0.3.21  perl@5.36.0		 py-wheel@0.37.1  tar@1.34		  zlib@1.2.13
autoconf-archive@2022.02.11  cmake@3.24.3			 gdbm@1.23	 krb5@1.19.3	       libgpg-error@1.46  libxml2@2.10.1  mpfr@4.1.0	  openmpi@4.1.4	   pigz@2.7		 python@3.10.8	  texinfo@6.5		  zstd@1.5.2
automake@1.16.5		     curl@7.85.0			 gettext@0.21.1	 libbsd@0.11.5	       libiconv@1.16	  libyogrt@1.27	  munge@0.5.15	  openssh@9.1p1	   pkgconf@1.8.0	 readline@8.1.2	  trilinos@13.0.1
berkeley-db@18.1.40	     diffutils@3.8			 glib@2.74.1	 libedit@3.1-20210216  libmd@1.0.4	  lwgrp@1.0.5	  ncurses@6.3	  openssl@1.1.1s   pmix@4.1.2		 scr@2.0.0	  util-linux-uuid@2.38.1
bison@3.8.2		     dtcmp@1.1.4			 gmp@6.2.1	 libevent@2.1.12       libpciaccess@0.16  lz4@1.9.4	  ninja@1.11.1	  pcre2@10.39	   py-pip@22.2.2	 slurm@21-08-8-2  util-macros@1.19.3
bzip2@1.0.8		     expat@2.4.8			 hwloc@2.8.0	 libffi@3.4.2	       libsigsegv@2.13	  m4@1.4.19	  numactl@2.0.14  pdsh@2.31	   py-setuptools@65.5.0	 sqlite@3.39.4	  xz@5.2.7
==> 68 installed packages

We can see that trilinos no longer appears in the list of installed specs. However, it is still listed as a root in the environment. If we want to remove it from the roots list we need to use spack remove:

$ spack remove trilinos
==> Removing trilinos from environment myproject2
$ spack find
==> In environment myproject2
==> Root specs
scr

==> Installed packages
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
autoconf@2.69		     ca-certificates-mozilla@2022-10-11	 gawk@5.1.1	 json-c@0.16	       libgcrypt@1.10.1	  libtool@2.4.7	  meson@0.63.3	  openblas@0.3.21  perl@5.36.0		 py-wheel@0.37.1  tar@1.34		  zlib@1.2.13
autoconf-archive@2022.02.11  cmake@3.24.3			 gdbm@1.23	 krb5@1.19.3	       libgpg-error@1.46  libxml2@2.10.1  mpfr@4.1.0	  openmpi@4.1.4	   pigz@2.7		 python@3.10.8	  texinfo@6.5		  zstd@1.5.2
automake@1.16.5		     curl@7.85.0			 gettext@0.21.1	 libbsd@0.11.5	       libiconv@1.16	  libyogrt@1.27	  munge@0.5.15	  openssh@9.1p1	   pkgconf@1.8.0	 readline@8.1.2	  trilinos@13.0.1
berkeley-db@18.1.40	     diffutils@3.8			 glib@2.74.1	 libedit@3.1-20210216  libmd@1.0.4	  lwgrp@1.0.5	  ncurses@6.3	  openssl@1.1.1s   pmix@4.1.2		 scr@2.0.0	  util-linux-uuid@2.38.1
bison@3.8.2		     dtcmp@1.1.4			 gmp@6.2.1	 libevent@2.1.12       libpciaccess@0.16  lz4@1.9.4	  ninja@1.11.1	  pcre2@10.39	   py-pip@22.2.2	 slurm@21-08-8-2  util-macros@1.19.3
bzip2@1.0.8		     expat@2.4.8			 hwloc@2.8.0	 libffi@3.4.2	       libsigsegv@2.13	  m4@1.4.19	  numactl@2.0.14  pdsh@2.31	   py-setuptools@65.5.0	 sqlite@3.39.4	  xz@5.2.7
==> 68 installed packages

Now, it is no longer a root and will need to be re-added before being installed as part of this environment.

We know trilinos is still needed for the myproject environment, so let’s switch back to confirm that it is still installed in that environment.

$ spack env activate myproject
$ spack find
==> In environment myproject
==> Root specs
tcl  trilinos

==> Installed packages
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
autoconf@2.69	     bison@3.8.2			 cmake@3.24.3	gettext@0.21.1	libedit@3.1-20210216  libpciaccess@0.16	 libxml2@2.10.1	 numactl@2.0.14	  openssh@9.1p1	  pigz@2.7	 readline@8.1.2	 trilinos@13.0.1     zlib@1.2.13
automake@1.16.5	     bzip2@1.0.8			 diffutils@3.8	hwloc@2.8.0	libevent@2.1.12	      libsigsegv@2.13	 m4@1.4.19	 openblas@0.3.21  openssl@1.1.1s  pkgconf@1.8.0	 tar@1.34	 util-macros@1.19.3  zstd@1.5.2
berkeley-db@18.1.40  ca-certificates-mozilla@2022-10-11	 gdbm@1.23	krb5@1.19.3	libiconv@1.16	      libtool@2.4.7	 ncurses@6.3	 openmpi@4.1.4	  perl@5.36.0	  pmix@4.1.2	 tcl@8.6.12	 xz@5.2.7
==> 38 installed packages
$ spack env activate myproject2

Phew! We see that myproject still has trilinos as a root spec. Spack uses reference counting to ensure that we don’t remove trilinos when it is still needed by myproject.

Note

Trilinos would only have been uninstalled by Spack if it were no longer needed by any environments or their package dependencies.

Shorthand for add and remove

We’ve seen how to use add and remove to add and remove roots from an environment, and we’ve seen how to install all of the roots at once, and how to uninstall particular packages.

It may seem tedious to have to add then install (or uninstall then remove) every spec in an environment. You can combine these steps into single commands if you want:

  • spack install --add: add and install a package
  • spack uninstall --remove uninstall and remove a package

However, there are are advantages to processing all the specs of an environment at once:

  • If you have a number of specs that can be installed together, adding them first and installing them together enables them to share dependencies and reduces total installation time.
  • You can launch all builds in parallel by taking advantage of Spack’s install-level build parallelism.

The spack.yaml file

An environment is more than just a list of root specs. It includes configuration settings that affect the way Spack behaves when the environment is activated. So far, myproject relies on configuration defaults that can be overridden. Here we’ll look at how to add specs and ensure all the packages depending on mpi build with mpich. We can customize the selection of the mpi provider using concretization preferences to change the behavior of the concretizer.

Let’s start by looking at the configuration of our environment using spack config get:

$ spack config get
# This is a Spack Environment file.
#
# It describes a set of packages to be installed, along with
# configuration settings.
spack:
  # add package specs to the `specs` list
  specs: [tcl, trilinos]
  view: true
  concretizer:
    unify: true

The output shows the special spack.yaml configuration file that Spack uses to store the environment configuration.

There are several important parts of this file:

  • specs:: the list of specs to install
  • view:: this controls whether the environment has a view. You can set it to false to disable view generation.
  • concretizer:unify:: This controls how the specs in the environment are concretized.

The specs list should look familiar; these are the specs we’ve been modifying with spack add.

concretizer:unify:true, the default, means that they are concretized together, so that there is only one version of any package in the environment. We’ll cover unify:false and unify:when_possible later, in the Stacks tutorial.

Editing environment configuration

Note

Before proceeding, make sure your EDITOR environment variable is set to the path of your preferred text editor.

Let’s edit spack.yaml to prefer mpich as our mpi provider using spack config edit.

You should now have the above file open in your editor. Change it to include the packages:all:providers:mpi: entry below:

# This is a Spack Environment file.
#
# It describes a set of packages to be installed, along with
# configuration settings.
spack:
  packages:
    all:
      providers:
        mpi: [mpich]

  # add package specs to the `specs` list
  specs: [tcl, trilinos]

Note

This setting only defines the default mpi provider. You can still override the provider on the command line, e.g., with spack install trilinos ^openmpi.

We introduce this here to show you how environment configuration can affect concretization. Configuration options are covered in much more detail in the configuration tutorial.

We’ve only scratched the surface here by changing the default of the mpi provider for packages depending on mpi. There are many other customizations you can make to an environment. Refer to the links at the end of this section for more information.

Re-concretizing the environment

You may need to re-install packages in the environment after making significant changes to the configuration, such as changing virtual providers. This can be accomplished by forcing Spack to re-concretize the environment and re-install the specs.

For example, the packages installed in our myproject environment are now out of sync with our new configuration since we already installed part of the environment with openmpi. Suppose we want to install everything in myproject with mpich.

Let’s run spack concretize --force --fresh to make Spack re-concretize all the environment’s specs:

$ spack concretize --force --fresh
==> Concretized tcl
[+]  v63n6wx  tcl@8.6.12%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  2hfr5rb	  ^zlib@1.2.13%gcc@7.5.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu18.04-x86_64

==> Concretized trilinos
 -   penzjd3  trilinos@13.0.1%gcc@7.5.0~adelus~adios2+amesos+amesos2+anasazi+aztec~basker+belos~boost~chaco~complex~cuda~cuda_rdc~debug~dtk+epetra+epetraext~epetraextbtf~epetraextexperimental~epetraextgraphreorderings~exodus+explicit_template_instantiation~float+fortran~gtest~hdf5~hypre+ifpack+ifpack2~intrepid~intrepid2~ipo~isorropia+kokkos~mesquite~minitensor+ml+mpi+muelu~mumps~nox~openmp~panzer~phalanx~piro~python~rocm~rocm_rdc~rol~rythmos+sacado~scorec~shards+shared~shylu~stk~stokhos~stratimikos~strumpack~suite-sparse~superlu~superlu-dist~teko~tempus~thyra+tpetra~trilinoscouplings~wrapper~x11~zoltan~zoltan2 build_system=cmake build_type=RelWithDebInfo cxxstd=14 gotype=long_long arch=linux-ubuntu18.04-x86_64
[+]  stszbns	  ^cmake@3.24.3%gcc@7.5.0~doc+ncurses+ownlibs~qt build_system=generic build_type=Release arch=linux-ubuntu18.04-x86_64
[+]  zcuawli	      ^ncurses@6.3%gcc@7.5.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  yr4z2pt	      ^openssl@1.1.1s%gcc@7.5.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu18.04-x86_64
[+]  aurd37j		  ^ca-certificates-mozilla@2022-10-11%gcc@7.5.0 build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  2hfr5rb		  ^zlib@1.2.13%gcc@7.5.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu18.04-x86_64
[+]  5yywrk2	  ^hwloc@2.8.0%gcc@7.5.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  p7f5n6q	      ^libpciaccess@0.16%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  bdxu4wn		  ^libtool@2.4.7%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ao5w53r		  ^util-macros@1.19.3%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  4aq5aj2	      ^libxml2@2.10.1%gcc@7.5.0~python build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ltvovvv		  ^libiconv@1.16%gcc@7.5.0 build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  nrwxyth		  ^xz@5.2.7%gcc@7.5.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  k2lfw6f	      ^pkgconf@1.8.0%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  vbkcftf	  ^mpich@4.0.2%gcc@7.5.0~argobots~cuda+fortran+hwloc+hydra+libxml2+pci~rocm+romio~slurm~two_level_namespace~vci~verbs+wrapperrpath build_system=autotools datatype-engine=auto device=ch4 netmod=ofi patches=d4c0e99 pmi=pmi arch=linux-ubuntu18.04-x86_64
[+]  fxoomyc	      ^findutils@4.9.0%gcc@7.5.0 build_system=autotools patches=440b954 arch=linux-ubuntu18.04-x86_64
[+]  u2kjaxd	      ^libfabric@1.16.1%gcc@7.5.0~debug~kdreg build_system=autotools fabrics=sockets,tcp,udp arch=linux-ubuntu18.04-x86_64
[+]  tlfr5qw	      ^yaksa@0.2%gcc@7.5.0~cuda~rocm build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  btoteei		  ^autoconf@2.69%gcc@7.5.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu18.04-x86_64
[+]  rxjqnjw		  ^automake@1.16.5%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  z7d5q4f		  ^m4@1.4.19%gcc@7.5.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu18.04-x86_64
[+]  c3uhkcj		      ^diffutils@3.8%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  e262sf6		      ^libsigsegv@2.13%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  cyf55fe		  ^python@3.10.8%gcc@7.5.0+bz2+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tix~tkinter~ucs4+uuid+zlib build_system=generic patches=0d98e93,7d40923,f2fd060 arch=linux-ubuntu18.04-x86_64
[+]  j5k5nzg		      ^expat@2.4.8%gcc@7.5.0+libbsd build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  qieib3t			  ^libbsd@0.11.5%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  miq3rrs			      ^libmd@1.0.4%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  hj6szik		      ^gettext@0.21.1%gcc@7.5.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kawegoy			  ^tar@1.34%gcc@7.5.0 build_system=autotools zip=pigz arch=linux-ubuntu18.04-x86_64
[+]  wod35ny			      ^pigz@2.7%gcc@7.5.0 build_system=makefile arch=linux-ubuntu18.04-x86_64
[+]  fprmzmo			      ^zstd@1.5.2%gcc@7.5.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  qzq4b7h		      ^libffi@3.4.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kgyvtw5		      ^readline@8.1.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  vmf7qax		      ^sqlite@3.39.4%gcc@7.5.0+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  eayyoxj		      ^util-linux-uuid@2.38.1%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  3db4ryr	  ^openblas@0.3.21%gcc@7.5.0~bignuma~consistent_fpcsr+fortran~ilp64+locking+pic+shared build_system=makefile patches=d3d9b15 symbol_suffix=none threads=none arch=linux-ubuntu18.04-x86_64
[+]  eydiwim	      ^perl@5.36.0%gcc@7.5.0+cpanm+shared+threads build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  53fb72w		  ^berkeley-db@18.1.40%gcc@7.5.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu18.04-x86_64
[+]  cxcreln		  ^bzip2@1.0.8%gcc@7.5.0~debug~pic+shared build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  cpmynty		  ^gdbm@1.23%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64

==> Updating view at /home/spack/spack/var/spack/environments/myproject/.spack-env/view

All the specs are now concrete and ready to be installed with mpich as the MPI implementation.

Building in environments

Activated environments allow you to invoke any programs installed in them as if they were installed on the system. In this section we will take advantage of that feature.

Suppose you want to compile some MPI programs. We have an MPI implementation installed in our myproject2 environment, so mpicc is available in our path. We can confirm this using which:

$ spack env status
==> In environment myproject2
$ which mpicc
/home/spack/spack/var/spack/environments/myproject2/.spack-env/view/bin/mpicc

As mentioned before, activating the environment sets a number of environment variables. That includes variables like PATH, LIBRARY_PATH, and LD_LIBRARY_PATH, which allows you to easily find package executables and libraries installed in the environment.

Let’s look specifically at path-related environment variables using env | grep PATH:

$ env | grep PATH=
PKG_CONFIG_PATH=/home/spack/spack/var/spack/environments/myproject2/.spack-env/view/lib/pkgconfig:/home/spack/spack/var/spack/environments/myproject2/.spack-env/view/share/pkgconfig:/home/spack/spack/var/spack/environments/myproject2/.spack-env/view/lib64/pkgconfig
ACLOCAL_PATH=/home/spack/spack/var/spack/environments/myproject2/.spack-env/view/share/aclocal
PATH=/home/spack/spack/var/spack/environments/myproject2/.spack-env/view/bin:/home/spack/spack/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MANPATH=/home/spack/spack/var/spack/environments/myproject2/.spack-env/view/share/man:/home/spack/spack/var/spack/environments/myproject2/.spack-env/view/man:.:
CMAKE_PREFIX_PATH=/home/spack/spack/var/spack/environments/myproject2/.spack-env/view

We can demonstrate use of these environment settings by building a really simple MPI program.

Let’s create a program called mpi-hello.c that contains the following code:

#include <stdio.h>
#include <mpi.h>
#include <zlib.h>

int main(int argc, char **argv) {
  int rank;
  MPI_Init(&argc, &argv);

  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  printf("Hello world from rank %d\n", rank);

  if (rank == 0) {
    printf("zlib version: %s\n", ZLIB_VERSION);
  }

  MPI_Finalize();
}

This program includes headers from mpi and zlib. It also prints out a message from each MPI rank and the version of zlib.

Let’s build and run our program:

$ mpicc ./mpi-hello.c -I$(spack location -i zlib)/include
$ mpirun -n 4 ./a.out
Hello world from rank 1
Hello world from rank 0
zlib version: 1.2.13
Hello world from rank 2
Hello world from rank 3

Notice that we only needed to pass the include path to the compiler. We also see that Hello world is output for each of the ranks and the version of zlib used to build the program is printed.

We can confirm the version of zlib used to build the program is in our environment using spack find:

$ spack find zlib
==> In environment myproject
==> Root specs
gmp   hdf5 +hl  tcl   trilinos

==> 1 installed package
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 ----------------
zlib@1.2.12

Note that the reported version does match that of our installation.

Reproducing builds

Spack environments provide users with virtual environments similar to Python venv and Conda environments). The goal is to ensure packages in one environment are kept separate from those of another. These environments can be managed by Spack or independent. In either case, their environment files can be used to reproduce builds by other users and on other machines. Since those files are key to reproducing builds, let’s start with them.

Environment files

There are two key files tracking the contents of environments: spack.yaml and spack.lock. The spack.yaml file holds the environment configuration that we previously edited through spack config edit. The spack.lock file is automatically generated during concretization.

The two files represent two fundamental concepts:

  • spack.yaml: abstract specs and configuration to install; and
  • spack.lock: all fully concrete specs.

These files are intended to be used by developers and administrators to manage the environments in a reproducible way. We will cover their re-use later.

Note

Both environment files can be versioned in repositories, shared, and used to install the same set of software by different users and on other machines.

Managed versus independent environments

Environments are either Spack-managed or independent. Both types of environments are defined by their environment files. So far we have only created managed environments. This section describes their differences.

Managed environments are created using spack env create <name>. They are automatically created in the var/spack/environments subdirectory and can be referenced by their names.

Independent environments can be created in one of two ways. First, the Spack environment file(s) can be placed in any directory (other than var/spack/environments). Alternatively, you can use spack env create -d <directory> to specify the directory (<directory>) in which the files should reside. Independent environments are not named.

Reviewing a managed environment

We created our currently active environment, myproject, earlier using spack env create myproject so let’s mainly focus on its environment files in this section.

Earlier, when we changed our environment’s configuration using spack config edit, we were actually editing its spack.yaml file. We can change to the directory containing the file using spack cd:

$ spack cd -e myproject
$ pwd
/home/spack/spack/var/spack/environments/myproject
$ ls
spack.lock  spack.yaml

Notice that myproject is a subdirectory of var/spack/environments within the Spack installation making it a managed environment. Consequently, it can be referenced by name. It will also show up when running spack env list:

$ spack env list
==> 2 environments
    myproject  myproject2

You can see that myproject is active because it is highlighted in green.

We can also see from the listing that the environment directory contains both of the environment files: spack.yaml and spack.lock. This is because spack.lock was generated when we concretized the environment.

If we cat the spack.yaml file, we’ll see the same specs and view options previously shown by spack config get:

$ cat spack.yaml
#  This is a Spack Environment file.
#
#  It describes a set of packages to be installed, along with
#  configuration settings.
spack:
  packages:
    all:
      providers:
        mpi: [mpich]
  specs: [tcl, trilinos, hdf5+hl ^mpich, gmp]
  view: true

Creating an independent environment

Environments do not have to be created in or managed by a Spack instance. Rather, their environment files can be placed in any directory. This feature can be quite helpful for use cases such as environment-based software releases and CI/CD.

Let’s create an independent environment from scratch for a simple project:

$ cd
$ mkdir code
$ cd code
$ spack env create -d .
==> Created environment in /home/spack/code
==> You can activate this environment with:
==>   spack env activate /home/spack/code

Notice that the command shows Spack created the environment, updated the view, and printed the command needed to activate it. As we can see in the activation command, since the environment is independent, it must be referenced by its directory path.

Let’s see what really happened with this command by listing the directory contents and looking at the configuration file:

$ ls
spack.yaml
$ cat spack.yaml
# This is a Spack Environment file.
#
# It describes a set of packages to be installed, along with
# configuration settings.
spack:
  # add package specs to the `specs` list
  specs: []
  view: true
  concretizer:
    unify: true

Notice that Spack created a spack.yaml file in the code directory. Also note that the configuration file has an empty spec list (i.e., []). That list is intended to contain only the root specs of the environment.

We can confirm that it is not a managed environment by running spack env list:

$ spack env list
==> 2 environments
    myproject  myproject2

and noting that the path does not appear in the output.

Now let’s add some specs to the environment. Suppose your project depends on trilinos and openmpi. Add these packages to the spec list using your favorite text editor. The dash syntax for a YAML list is used in our example. Your package should now contain the following entries:

# This is a Spack Environment file.
#
# It describes a set of packages to be installed, along with
# configuration settings.
spack:
  # add package specs to the `specs` list
  specs:
  - trilinos
  - openmpi
  view: true

Now activate the environment and install the packages:

$ spack env activate .
$ spack install
==> Concretized trilinos
[+]  brfmaty  trilinos@13.0.1%gcc@7.5.0~adelus~adios2+amesos+amesos2+anasazi+aztec~basker+belos~boost~chaco~complex~cuda~cuda_rdc~debug~dtk+epetra+epetraext~epetraextbtf~epetraextexperimental~epetraextgraphreorderings~exodus+explicit_template_instantiation~float+fortran~gtest~hdf5~hypre+ifpack+ifpack2~intrepid~intrepid2~ipo~isorropia+kokkos~mesquite~minitensor+ml+mpi+muelu~mumps~nox~openmp~panzer~phalanx~piro~python~rocm~rocm_rdc~rol~rythmos+sacado~scorec~shards+shared~shylu~stk~stokhos~stratimikos~strumpack~suite-sparse~superlu~superlu-dist~teko~tempus~thyra+tpetra~trilinoscouplings~wrapper~x11~zoltan~zoltan2 build_system=cmake build_type=RelWithDebInfo cxxstd=14 gotype=long_long arch=linux-ubuntu18.04-x86_64
[+]  stszbns	  ^cmake@3.24.3%gcc@7.5.0~doc+ncurses+ownlibs~qt build_system=generic build_type=Release arch=linux-ubuntu18.04-x86_64
[+]  zcuawli	      ^ncurses@6.3%gcc@7.5.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  yr4z2pt	      ^openssl@1.1.1s%gcc@7.5.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu18.04-x86_64
[+]  aurd37j		  ^ca-certificates-mozilla@2022-10-11%gcc@7.5.0 build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  5yywrk2	  ^hwloc@2.8.0%gcc@7.5.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  p7f5n6q	      ^libpciaccess@0.16%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  bdxu4wn		  ^libtool@2.4.7%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ao5w53r		  ^util-macros@1.19.3%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  4aq5aj2	      ^libxml2@2.10.1%gcc@7.5.0~python build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ltvovvv		  ^libiconv@1.16%gcc@7.5.0 build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  nrwxyth		  ^xz@5.2.7%gcc@7.5.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  k2lfw6f	      ^pkgconf@1.8.0%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  3db4ryr	  ^openblas@0.3.21%gcc@7.5.0~bignuma~consistent_fpcsr+fortran~ilp64+locking+pic+shared build_system=makefile patches=d3d9b15 symbol_suffix=none threads=none arch=linux-ubuntu18.04-x86_64
[+]  eydiwim	      ^perl@5.36.0%gcc@7.5.0+cpanm+shared+threads build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  53fb72w		  ^berkeley-db@18.1.40%gcc@7.5.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu18.04-x86_64
[+]  cxcreln		  ^bzip2@1.0.8%gcc@7.5.0~debug~pic+shared build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  c3uhkcj		      ^diffutils@3.8%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  cpmynty		  ^gdbm@1.23%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kgyvtw5		      ^readline@8.1.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  mfxvu5f	  ^openmpi@4.1.4%gcc@7.5.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics=none schedulers=none arch=linux-ubuntu18.04-x86_64
[+]  qbwqmk6	      ^numactl@2.0.14%gcc@7.5.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-ubuntu18.04-x86_64
[+]  btoteei		  ^autoconf@2.69%gcc@7.5.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu18.04-x86_64
[+]  rxjqnjw		  ^automake@1.16.5%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  z7d5q4f		  ^m4@1.4.19%gcc@7.5.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu18.04-x86_64
[+]  e262sf6		      ^libsigsegv@2.13%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  xevso22	      ^openssh@9.1p1%gcc@7.5.0+gssapi build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  y6ek4vz		  ^krb5@1.19.3%gcc@7.5.0+shared build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  wobmzgv		      ^bison@3.8.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  hj6szik		      ^gettext@0.21.1%gcc@7.5.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kawegoy			  ^tar@1.34%gcc@7.5.0 build_system=autotools zip=pigz arch=linux-ubuntu18.04-x86_64
[+]  wod35ny			      ^pigz@2.7%gcc@7.5.0 build_system=makefile arch=linux-ubuntu18.04-x86_64
[+]  fprmzmo			      ^zstd@1.5.2%gcc@7.5.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  6pzeykr		  ^libedit@3.1-20210216%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  76ul6un	      ^pmix@4.1.2%gcc@7.5.0~docs+pmi_backwards_compatibility~restful build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  nblr6w4		  ^libevent@2.1.12%gcc@7.5.0+openssl build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  2hfr5rb	      ^zlib@1.2.13%gcc@7.5.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu18.04-x86_64

==> Concretized openmpi
[+]  mfxvu5f  openmpi@4.1.4%gcc@7.5.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics=none schedulers=none arch=linux-ubuntu18.04-x86_64
[+]  5yywrk2	  ^hwloc@2.8.0%gcc@7.5.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  p7f5n6q	      ^libpciaccess@0.16%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ao5w53r		  ^util-macros@1.19.3%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  4aq5aj2	      ^libxml2@2.10.1%gcc@7.5.0~python build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ltvovvv		  ^libiconv@1.16%gcc@7.5.0 build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  nrwxyth		  ^xz@5.2.7%gcc@7.5.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  zcuawli	      ^ncurses@6.3%gcc@7.5.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  qbwqmk6	  ^numactl@2.0.14%gcc@7.5.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-ubuntu18.04-x86_64
[+]  btoteei	      ^autoconf@2.69%gcc@7.5.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu18.04-x86_64
[+]  rxjqnjw	      ^automake@1.16.5%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  bdxu4wn	      ^libtool@2.4.7%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  z7d5q4f	      ^m4@1.4.19%gcc@7.5.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu18.04-x86_64
[+]  c3uhkcj		  ^diffutils@3.8%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  e262sf6		  ^libsigsegv@2.13%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  xevso22	  ^openssh@9.1p1%gcc@7.5.0+gssapi build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  y6ek4vz	      ^krb5@1.19.3%gcc@7.5.0+shared build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  wobmzgv		  ^bison@3.8.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  hj6szik		  ^gettext@0.21.1%gcc@7.5.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kawegoy		      ^tar@1.34%gcc@7.5.0 build_system=autotools zip=pigz arch=linux-ubuntu18.04-x86_64
[+]  wod35ny			  ^pigz@2.7%gcc@7.5.0 build_system=makefile arch=linux-ubuntu18.04-x86_64
[+]  fprmzmo			  ^zstd@1.5.2%gcc@7.5.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  6pzeykr	      ^libedit@3.1-20210216%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  yr4z2pt	      ^openssl@1.1.1s%gcc@7.5.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu18.04-x86_64
[+]  aurd37j		  ^ca-certificates-mozilla@2022-10-11%gcc@7.5.0 build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  eydiwim	  ^perl@5.36.0%gcc@7.5.0+cpanm+shared+threads build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  53fb72w	      ^berkeley-db@18.1.40%gcc@7.5.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu18.04-x86_64
[+]  cxcreln	      ^bzip2@1.0.8%gcc@7.5.0~debug~pic+shared build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  cpmynty	      ^gdbm@1.23%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kgyvtw5		  ^readline@8.1.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  k2lfw6f	  ^pkgconf@1.8.0%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  76ul6un	  ^pmix@4.1.2%gcc@7.5.0~docs+pmi_backwards_compatibility~restful build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  nblr6w4	      ^libevent@2.1.12%gcc@7.5.0+openssl build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  2hfr5rb	  ^zlib@1.2.13%gcc@7.5.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu18.04-x86_64

==> Installing environment /home/spack/code
==> All of the packages are already installed
==> Updating view at /home/spack/code/.spack-env/view

Notice that Spack concretized the specs before installing them and their dependencies. It also updated the environment’s view. Since we already installed all these packages outside of the environment, their links were simply added to it.

Updating an installed environment

Spack supports tweaking an environment even after the initial specs are installed. You are free to add and remove specs just as you would outside of the environment using the command line interface as before.

For example, let’s add hdf5 and look at our file:

$ spack add hdf5@5.5.1
==> Adding hdf5@5.5.1 to environment /home/spack/code
$ cat spack.yaml
# This is a Spack Environment file.
#
# It describes a set of packages to be installed, along with
# configuration settings.
spack:
  # add package specs to the `specs` list
  specs: [trilinos, openmpi, hdf5@5.5.1]
  view: true
  concretizer:
    unify: true
$ spack remove hdf5
==> Removing hdf5 from environment /home/spack/code

Notice that spack add added the package to our active environment and it appears in the configuration file’s spec list.

Note

You’ll need to run spack install to install added packages in your environment because spack add only adds it to the configuration.

Now use spack remove to remove the spec from the configuration:

$ spack remove hdf5
==> Removing hdf5 from environment /home/spack/code
$ cat spack.yaml
#  This is a Spack Environment file.
#
#  It describes a set of packages to be installed, along with
#  configuration settings.
spack:
    add package specs to the `specs` list
  specs:
  - trilinos
  - openmpi
  view: true

and we see that the spec was removed from the spec list of our environment.

Note

You can also edit the spack.yaml file directly instead of using the spack add and spack remove commands.

Reviewing spack.lock

Now let’s turn our attention from the abstract to the concrete.

Our focus so far has been on the abstract environment configuration represented by the spack.yaml file. Once that file is concretized, Spack generates a corresponding spack.lock file representing the full concretized state of the environment.

This file is intended to be a machine-readable representation of the information needed to reproduce the build of an environment. As such, it is written in json, which is less readable than yaml.

Let’s look at the top 30 lines of our current environment:

$ head -30 spack.lock
{
  "_meta": {
    "file-type": "spack-lockfile",
    "lockfile-version": 4,
    "specfile-version": 3
  },
  "roots": [
    {
      "hash": "brfmatydwbrssme6d6bnwcsh5spxv7zz",
      "spec": "trilinos"
    },
    {
      "hash": "mfxvu5fnaac33f4pw25rjrojafbbupwb",
      "spec": "openmpi"
    }
  ],
  "concrete_specs": {
    "brfmatydwbrssme6d6bnwcsh5spxv7zz": {
      "name": "trilinos",
      "version": "13.0.1",
      "arch": {
	"platform": "linux",
	"platform_os": "ubuntu18.04",
	"target": "x86_64"
      },
      "compiler": {
	"name": "gcc",
	"version": "7.5.0"
      },
      "namespace": "builtin",

While it is still readable, it consists of over 1300 lines of information representing the actual configurations for each of the environment’s packages.

Reproducing an environment

Now that we’ve described the contents of the environment files we can discuss how they can be used to reproduce environments. You may want to do this yourself on a different machine, or use an environment built by someone else. The process is the same in either case.

You can recreate an environment by passing either of the environment files to spack env create. The file you choose depends on whether you want to approximate the build using the abstract specs or an exact build based on the concrete specs.

Using spack.yaml

An approximate build is created using the spack.yaml file. This approach is relevant when we want to build the same specs on a new platform, for example. It allows you to reproduce the environment by preserving the abstract requirements in the file. However, the software may actually build differently in part because the concretizer may choose different dependencies.

Let’s use spack env create to create an abstract environment from the file that we’ll call abstract:

$ spack env create abstract spack.yaml
==> Created environment 'abstract' in /home/spack/spack/var/spack/environments/abstract
==> You can activate this environment with:
==>   spack env activate abstract
$ spack env create concrete spack.lock
==> Updating view at /home/spack/spack/var/spack/environments/concrete/.spack-env/view
==> Created environment 'concrete' in /home/spack/spack/var/spack/environments/concrete
==> You can activate this environment with:
==>   spack env activate concrete

Here we see that Spack created a managed environment with the name we provided.

And, since it is a newly created environment, it does not have any installed specs yet as we can see from calling spack find after activating the environment:

$ spacktivate abstract
$ spack find
==> In environment abstract
==> Root specs
openmpi  trilinos

==> 0 installed packages

Notice that we have the same root specs as were listed in the spack.yaml file.

Using spack.lock

The spack.lock file is used for an exact reproduction of the original build. It can replicate the build because it contains the information for all the decisions made during concretization.

Now let’s create a concrete environment, called concrete, from the file:

$ spack env create concrete spack.lock
==> Updating view at /home/spack/spack/var/spack/environments/concrete/.spack-env/view
==> Created environment 'concrete' in /home/spack/spack/var/spack/environments/concrete
==> You can activate this environment with:
==>   spack env activate concrete

Here we see that Spack again created a managed environment with the provided name.

Since we created the environment from our spack.lock file, not only do we get the same root specs, all of the packages are installed in the environment as we can see from calling spack find after activating the environment:

$ spacktivate concrete
$ spack find
==> In environment concrete
==> Root specs
openmpi  trilinos

==> 30 installed packages
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
autoconf@2.69        libedit@3.1-20210216  ncurses@6.2      pmix@4.1.2
automake@1.16.5      libevent@2.1.12       numactl@2.0.14   readline@8.1
berkeley-db@18.1.40  libiconv@1.16         openblas@0.3.20  trilinos@13.0.1
bzip2@1.0.8          libpciaccess@0.16     openmpi@4.1.3    util-macros@1.19.3
cmake@3.23.1         libsigsegv@2.13       openssh@9.0p1    xz@5.2.5
diffutils@3.8        libtool@2.4.7         openssl@1.1.1o   zlib@1.2.12
gdbm@1.19            libxml2@2.9.13        perl@5.34.1
hwloc@2.7.1          m4@1.4.19             pkgconf@1.8.0

Note

Use of spack.lock to reproduce a build (currently) requires you to be on the same type of machine.

More information

This tutorial only scratches the surface of environments and what they can do. For more information, take a look at the Spack resources below.

Setting up and building environments

Using environments

Finding examples of environments