Skip to content

Commit 1340c76

Browse files
authored
environments: update for pearc25 (#458)
* environments: update for pearc25 * undo changes to output to get docs to build? * space * outputs * try using outputs workflow * recomment * spelling * test building outputs * revert output changes * use head -12 instead of cat for spack config get * rm extra newline
1 parent 8fdedf0 commit 1340c76

File tree

2 files changed

+36
-38
lines changed

2 files changed

+36
-38
lines changed

outputs/environments.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ example --tee environments/env-swap-1 "spack env activate myproject"
9191
spack env activate myproject
9292
example environments/env-swap-1 "spack find"
9393

94-
example environments/config-get-1 "spack config get"
94+
example environments/config-get-1 "spack config get | head -12"
9595

9696
# The file is edited by hand here
9797
# We mock that by using `spack config add`

tutorial_environments.rst

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,18 @@ Goals of this Tutorial
5252
----------------------
5353

5454
This tutorial will teach you the fundamentals of creating and using Spack environments.
55+
5556
We'll cover:
57+
5658
1. Command line basics -- Creating and managing environments with Spack commands.
59+
5760
2. Configuration files -- Editing ``spack.yaml`` and understanding ``spack.lock``.
61+
5862
3. Environment types -- Understanding Spack-managed vs. independent environments.
63+
5964
4. Reproducible builds -- Sharing and recreating environments across systems.
6065

66+
6167
-------------------
6268
Environment Basics
6369
-------------------
@@ -70,6 +76,7 @@ Let's look at the output of ``spack find`` at this point in the tutorial.
7076

7177
This is a complete, but cluttered list of all our installed packages and their dependencies.
7278
It contains packages built with both ``openmpi`` and ``mpich``, as well as multiple variants of other packages, like ``hdf5`` and ``zlib-ng``.
79+
7380
The query mechanism we learned about with ``spack find`` can help, but it would be nice if we could see only the software that is relevant to our current project instead of seeing everything on the machine.
7481

7582
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -149,6 +156,7 @@ Let's try it:
149156
:language: console
150157

151158
Now, ``tcl`` and ``trilinos`` have been registered as **root specs** in our environment. **Root specs** are packages that we've explicitly requested to be installed in an environment.
159+
152160
They're called **"roots"** because they sit at the top of the dependency graph---when Spack installs these packages, with their respective dependency packages sitting below them.
153161

154162
Now, let's install:
@@ -167,38 +175,6 @@ Let's now confirm the contents of the environment using ``spack find``:
167175

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

170-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
171-
Creating an environment incrementally
172-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
173-
174-
We can also add and install specs to an environment incrementally. For example:
175-
176-
.. code-block:: console
177-
178-
$ spack install --add tcl
179-
$ spack install --add trilinos
180-
181-
If we create environments incrementally, Spack ensures that already installed roots are not re-concretized.
182-
So, adding specs to an environment at a later point in time will not cause existing packages to rebuild.
183-
184-
.. note::
185-
186-
Incrementally creating an environment may give us different package
187-
versions from an environment created all at once.
188-
We'll cover this later in the tutorial after we've discussed different
189-
concretization strategies.
190-
191-
Further, there are two other advantages of concretizing and installing an
192-
environment all at once:
193-
194-
195-
* If you have a number of specs that can be installed together,
196-
adding them first and installing them together enables them to
197-
share dependencies and reduces total installation time.
198-
199-
* You can launch all builds in parallel by taking advantage of Spack's
200-
`install-level build parallelism <https://spack.readthedocs.io/en/latest/config_yaml.html#build-jobs>`_.
201-
202178
^^^^^^^^^^^^^^
203179
Using Packages
204180
^^^^^^^^^^^^^^
@@ -302,7 +278,6 @@ We can customize the selection of the ``mpi`` provider using `concretization pre
302278
Let's start by examining our environment's configuration using ``spack config get``:
303279

304280
.. literalinclude:: outputs/environments/config-get-1.out
305-
:emphasize-lines: 8-13
306281

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

@@ -388,11 +363,24 @@ Let's run ``spack concretize --force`` (or ``-f`` in short) to make Spack re-con
388363

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

391-
Re-concretization is sometimes also necessary when creating an environment *incrementally* with unification enabled.
392-
Spack makes sure that already concretized specs in the environment are not modified when adding something new.
393366

394-
Adding and installing specs one by one leads to greedy concretization.
395-
When you first install ``python`` in an environment, Spack will pick a recent version for it.
367+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
368+
Creating an environment incrementally
369+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
370+
371+
We can also add and install specs to an environment incrementally. For example:
372+
373+
.. code-block:: console
374+
375+
$ spack install --add python
376+
$ spack install --add [email protected]
377+
378+
If we create environments incrementally, Spack ensures that already installed roots are not re-concretized.
379+
So, adding specs to an environment at a later point in time will not cause existing packages to rebuild.
380+
381+
Adding and installing specs incrementally leads to greedy concretization, meaning that the environment may have different package versions compared to an environment created all at once.
382+
383+
When you first install ``python`` in an environment, Spack will pick a recent version.
396384
If you then add ``py-numpy``, it may be in conflict with the ``python`` version already installed, and fail to concretize:
397385

398386
.. literalinclude:: outputs/environments/incremental-1.out
@@ -403,6 +391,16 @@ The solution is to re-concretize the environment as a whole, which causes ``pyth
403391
.. literalinclude:: outputs/environments/incremental-2.out
404392
:language: console
405393

394+
.. note::
395+
There are other advantages to concretizing and installing an environment all at once:
396+
397+
* If you have a number of specs that can be installed together,
398+
adding them first and installing them together enables them to
399+
share dependencies and reduces total installation time.
400+
401+
* You can launch all builds in parallel by taking advantage of Spack's
402+
`install-level build parallelism <https://spack.readthedocs.io/en/latest/config_yaml.html#build-jobs>`_.
403+
406404
------------------------
407405
Building in environments
408406
------------------------

0 commit comments

Comments
 (0)