Skip to content

Commit 7b5f367

Browse files
committed
environments: update for pearc25
1 parent 80b9105 commit 7b5f367

2 files changed

Lines changed: 36 additions & 45 deletions

File tree

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-edit-1 'cat "$(spack location -e)/spack.yaml"'
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 & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -167,38 +167,6 @@ Let's now confirm the contents of the environment using ``spack find``:
167167

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

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/packaging_guide.html#install-level-build-parallelism>`_.
201-
202170
^^^^^^^^^^^^^^
203171
Using Packages
204172
^^^^^^^^^^^^^^
@@ -299,9 +267,14 @@ In this section, we'll learn how to enforce that all the packages in our environ
299267

300268
We can customize the selection of the ``mpi`` provider using `concretization preferences <https://spack.readthedocs.io/en/latest/build_settings.html#concretization-preferences>`_ to change the behavior of the concretizer.
301269

302-
Let's start by examining our environment's configuration using ``spack config get``:
270+
.. note::
271+
272+
Before proceeding, make sure your ``EDITOR`` environment variable
273+
is set to the path of your preferred text editor.
274+
275+
Let's start by examining our environment's configuration using ``spack config edit``:
303276

304-
.. literalinclude:: outputs/environments/config-get-1.out
277+
.. literalinclude:: outputs/environments/config-edit-1.out
305278
:emphasize-lines: 8-13
306279

307280
The output shows the special ``spack.yaml`` configuration file that Spack uses to store environment configurations.
@@ -331,14 +304,9 @@ The ``concretizer:unify:true`` setting controls how Spack resolves dependencies
331304
Editing environment configuration
332305
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
333306

334-
.. note::
307+
Let's edit ``spack.yaml`` to *require* ``mpich`` as our ``mpi`` provider.
335308

336-
Before proceeding, make sure your ``EDITOR`` environment variable
337-
is set to the path of your preferred text editor.
338-
339-
Let's edit ``spack.yaml`` to *require* ``mpich`` as our ``mpi`` provider using ``spack config edit``.
340-
341-
You should now have the above file open in your editor.
309+
You should have the above file open in your editor.
342310
Change it to include the ``packages:mpi:require`` entry below:
343311

344312
.. code-block:: yaml
@@ -388,10 +356,23 @@ Let's run ``spack concretize --force`` (or ``-f`` in short) to make Spack re-con
388356

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

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.
393359

394-
Adding and installing specs one by one leads to greedy concretization.
360+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
361+
Creating an environment incrementally
362+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
363+
364+
We can also add and install specs to an environment incrementally. For example:
365+
366+
.. code-block:: console
367+
368+
$ spack install --add python
369+
$ spack install --add py-numpy@1.20
370+
371+
If we create environments incrementally, Spack ensures that already installed roots are not re-concretized.
372+
So, adding specs to an environment at a later point in time will not cause existing packages to rebuild.
373+
374+
Adding and installing specs incrementally leads to greedy concretization, meaning that the environment may concain different package versions compared to an environment created all at once.
375+
395376
When you first install ``python`` in an environment, Spack will pick a recent version for it.
396377
If you then add ``py-numpy``, it may be in conflict with the ``python`` version already installed, and fail to concretize:
397378

@@ -403,6 +384,16 @@ The solution is to re-concretize the environment as a whole, which causes ``pyth
403384
.. literalinclude:: outputs/environments/incremental-2.out
404385
:language: console
405386

387+
.. note::
388+
There are advantages to concretizing and installing an environment all at once:
389+
390+
* If you have a number of specs that can be installed together,
391+
adding them first and installing them together enables them to
392+
share dependencies and reduces total installation time.
393+
394+
* You can launch all builds in parallel by taking advantage of Spack's
395+
`install-level build parallelism <https://spack.readthedocs.io/en/latest/packaging_guide.html#install-level-build-parallelism>`_.
396+
406397
------------------------
407398
Building in environments
408399
------------------------

0 commit comments

Comments
 (0)