Skip to content

Commit c522c4d

Browse files
authored
Environments: minor updates to tutorial (#153)
1 parent fabf1d5 commit c522c4d

File tree

3 files changed

+29
-27
lines changed

3 files changed

+29
-27
lines changed

outputs/env.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ echo "y
5252
" | example environments/env-uninstall-1 "spack uninstall trilinos"
5353
example environments/env-uninstall-1 "spack find"
5454

55-
example -tee environments/env-swap-1 "despacktivate"
56-
spack env deactivate
5755
example -tee environments/env-swap-1 "spack env activate myproject"
5856
spack env activate myproject
5957
example environments/env-swap-1 "spack find"
@@ -77,6 +75,7 @@ spack config add packages:all:providers:mpi:[mpich]
7775
example environments/spec-2 "spack spec hypre"
7876

7977
example environments/concretize-f-1 "spack concretize --force"
78+
spack install
8079

8180
example environments/show-mpicc-1 "spack env status"
8281
example environments/show-mpicc-1 "which mpicc"

outputs/environments/env-swap-1.out

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
$ despacktivate
21
$ spack env activate myproject
32
$ spack find
43
==> In environment myproject

tutorial_environments.rst

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ commands:
1818
* `spack uninstall <https://spack.readthedocs.io/en/latest/basic_usage.html#cmd-spack-uninstall>`_ to remove them; and
1919
* `spack find <https://spack.readthedocs.io/en/latest/basic_usage.html#cmd-spack-find>`_ to look at and query what is installed.
2020

21-
.. Customizing Spack's installation with configuration files, like
21+
.. Customizing Spack's installation with configuration files, like
2222
`packages.yaml <https://spack.readthedocs.io/en/latest/build_settings.html#build-settings>`_, was also discussed.
2323
2424
This section of the tutorial introduces **Spack Environments**, which
@@ -43,7 +43,7 @@ environments allow you to readily:
4343

4444
This tutorial introduces the basics of creating and using environments,
4545
then explains how to expand, configure, and build software in them.
46-
We will start with the command line interface then cover editing key
46+
We will start with the command line interface, then cover editing key
4747
environment file directly. We will describe the difference between
4848
Spack-managed and independent environments, then finish with a section
4949
on reproducible builds.
@@ -78,7 +78,7 @@ called ``myproject``:
7878
:emphasize-lines: 1
7979

8080

81-
An environment is like a virtualized ``spack`` instance that you can
81+
An environment is like a virtualized Spack instance that you can
8282
use to aggregate package installations for a project or other purpose.
8383
It has an associated *view*, which is a single prefix where all packages
8484
from the environment are linked.
@@ -186,7 +186,7 @@ its dependencies).
186186
When you install packages into an environment, they are, by default,
187187
linked into a single prefix, or *view*. Activating the environment
188188
with ``spack env activate`` results in subdirectories from the view
189-
being added to ``PATH``, ``LD_LIBRARY_PATH``, ``CMAKE_PREFIX_PATH``
189+
being added to ``PATH``, ``LD_LIBRARY_PATH``, ``CMAKE_PREFIX_PATH``,
190190
and other environment variables. This makes the environment easier to use.
191191

192192
Let's try it out. We just installed ``tcl`` into our ``myproject``
@@ -246,7 +246,7 @@ contents of the environment:
246246

247247
.. literalinclude:: outputs/environments/env-uninstall-1.out
248248
:language: console
249-
:emphasize-lines: 1,10
249+
:emphasize-lines: 1,11
250250

251251

252252
The result is that the environment now has only one root spec, ``hdf5
@@ -258,7 +258,7 @@ in that environment.
258258

259259
.. literalinclude:: outputs/environments/env-swap-1.out
260260
:language: console
261-
:emphasize-lines: 1-3
261+
:emphasize-lines: 1-2
262262

263263

264264
Phew! We see that ``myproject`` still has ``trilinos`` as a root
@@ -292,7 +292,7 @@ large build of many packages in parallel by taking advantage of
292292
Spack's `install-level build parallelism
293293
<https://spack.readthedocs.io/en/latest/packaging_guide.html#install-level-build-parallelism>`_.
294294

295-
This section focused on two ways to add specs to the environment before
295+
This section focuses on two ways to add specs to the environment before
296296
installing them.
297297

298298
^^^^^^^^^^^^^
@@ -399,8 +399,8 @@ to include the ``packages:all:providers:mpi:`` entry below:
399399

400400
This setting only defines the **default** ``mpi`` provider.
401401
You can still override the provider on the command line, e.g.,
402-
with`spack install hdf5 ^openmpi`.
403-
402+
with ``spack install hdf5 ^openmpi``.
403+
404404
We introduce this here to show you how environment configuration
405405
can affect concretization. Configuration options are covered in much
406406
more detail in the :ref:`configuration tutorial <configs-tutorial>`.
@@ -420,13 +420,13 @@ the ``mpi`` provider for packages depending on ``mpi``. There
420420
are many other customizations you can make to an environment.
421421
Refer to the links at the end of this section for more information.
422422

423-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
424-
Reconcretizing the environment
425-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
423+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
424+
Re-concretizing the environment
425+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
426426

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

432432
For example, the packages installed in our ``myproject`` environment
@@ -446,6 +446,10 @@ All the specs are now concrete **and** ready to be installed with
446446
``mpich`` as the MPI implementation. You can now re-run ``spack
447447
install`` to finish the process.
448448

449+
.. code-block:: console
450+
451+
$ spack install
452+
449453
------------------------
450454
Building in environments
451455
------------------------
@@ -537,7 +541,7 @@ similar to `Python venv <https://docs.python.org/3/library/venv.html>`_
537541
and `Conda environments
538542
<https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#>`_). The goal is to ensure packages in one environment
539543
are kept separate from those of another. These environments can
540-
be managed by spack or independent. In either case, their environment
544+
be managed by Spack or independent. In either case, their environment
541545
files can be used to reproduce builds by other users and on other machines.
542546
Since those files are key to reproducing builds, let's start with them.
543547

@@ -571,7 +575,7 @@ re-use later.
571575
Managed versus independent environments
572576
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
573577

574-
Environments are either spack-managed or independent. Both types
578+
Environments are either Spack-managed or independent. Both types
575579
of environments are defined by their environment files. So far
576580
we have only created managed environments. This section describes
577581
their differences.
@@ -581,7 +585,7 @@ They are automatically created in the ``var/spack/environments``
581585
subdirectory and can be referenced by their names.
582586

583587
*Independent environments* can be created in one of two ways. First,
584-
the Spack's environment file(s) can be placed in any directory
588+
the Spack environment file(s) can be placed in any directory
585589
(other than ``var/spack/environments``). Alternatively, you can
586590
use ``spack env create -d <directory>`` to specify the directory
587591
(``<directory>``) in which the files should reside. Independent
@@ -604,7 +608,7 @@ can change to the directory containing the file using ``spack cd``:
604608
:emphasize-lines: 1-2,4
605609

606610

607-
Notice ``myproject`` is a subdirectory of ``var/spack/environments``
611+
Notice that ``myproject`` is a subdirectory of ``var/spack/environments``
608612
within the Spack installation making it a *managed* environment.
609613
Consequently, it can be referenced by name. It will also show up
610614
when running ``spack env list``:
@@ -647,7 +651,7 @@ project:
647651
:emphasize-lines: 1-4
648652

649653

650-
Notice the command shows Spack created the environment, updated
654+
Notice that the command shows Spack created the environment, updated
651655
the view, and printed the command needed to activate it. As we
652656
can see in the activation command, since the environment is independent,
653657
it must be referenced by its directory path.
@@ -660,7 +664,7 @@ directory contents and looking at the configuration file:
660664
:emphasize-lines: 1,3
661665

662666

663-
Notice Spack created a ``spack.yaml`` file in the *code* directory.
667+
Notice that Spack created a ``spack.yaml`` file in the *code* directory.
664668
Also note that the configuration file has an empty spec list (i.e.,
665669
``[]``). That list is intended to contain only the *root specs* of
666670
the environment.
@@ -700,7 +704,7 @@ Now activate the environment and install the packages:
700704
:emphasize-lines: 1-2,64-65
701705

702706

703-
Notice Spack concretized the specs before installing them and
707+
Notice that Spack concretized the specs before installing them and
704708
their dependencies. It also updated the environment's view. Since
705709
we already installed all these packages outside of the environment,
706710
their links were simply added to it.
@@ -720,7 +724,7 @@ For example, let's add ``hdf5`` and look at our file:
720724
:emphasize-lines: 1,3
721725

722726

723-
Notice ``spack add`` added the package to our active environment and
727+
Notice that ``spack add`` added the package to our active environment and
724728
it appears in the configuration file's spec list.
725729

726730
.. note::
@@ -735,7 +739,7 @@ Now use ``spack remove`` to remove the spec from the configuration:
735739
:language: console
736740
:emphasize-lines: 1,3
737741

738-
and we see the spec *was* removed from the spec list of our
742+
and we see that the spec *was* removed from the spec list of our
739743
environment.
740744

741745
.. note::
@@ -813,7 +817,7 @@ And, since it is a newly created environment, it does not have any
813817
:language: console
814818
:emphasize-lines: 1-2
815819

816-
Notice we have the same root specs as were listed in the ``spack.yaml``
820+
Notice that we have the same root specs as were listed in the ``spack.yaml``
817821
file.
818822

819823
""""""""""""""""""""
@@ -835,7 +839,7 @@ Here we see that Spack again created a managed environment with the
835839
provided name.
836840

837841
Since we created the environment from our ``spack.lock`` file,
838-
not only do we get the same root specs, all of the packages are
842+
not only do we get the same root specs, all of the packages are
839843
installed in the environment as we can see from calling
840844
``spack find`` **after** activating the environment:
841845

0 commit comments

Comments
 (0)