You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All compilers that Spack found will be configured as external packages -- we'll talk more about externals in the "Spack Concepts" slides and in :ref:`Configuration Tutorial <configs-tutorial>` later on.
79
88
80
89
Spack can install software either from source or from a binary cache.
81
90
Packages in the binary cache are signed with GPG for security.
82
-
For this tutorial, we've prepared a binary cache so we don't have to wait for slow compilation from source.
83
-
84
-
To enable installation from the binary cache, we'll need to configure Spack with the location of the cache and trust the GPG key that the cache was signed with.
91
+
For this tutorial we have prepared a binary cache so we don't have to wait for slow compilation from source.
92
+
To enable installation from the binary cache, we'll need to configure Spack with the location of the cache and trust the GPG key that the binaries were signed with.
85
93
86
94
.. literalinclude:: outputs/basics/mirror.out
87
95
:language: console
@@ -92,7 +100,7 @@ By default, this will install the binary cached version if it exists and fall ba
92
100
Now that we understand how Spack handles installations, let's explore how we can customize what gets installed.
93
101
Spack's "spec" syntax is the interface by which we can request specific configurations of a package.
94
102
The ``%`` sigil is used to specify direct dependencies like a package's compiler.
95
-
For example, we can install zlib (a commonly used compression library), but instead of building it with the GCC compiler as we did for gmake previously, we'll install it with ``%clang`` to build it on top of the clang compiler.
103
+
For example, we can install zlib (a commonly used compression library), but instead of building it with the GCC compiler as we did for gmake previously, we'll install it with ``%clang`` to build it with the clang compiler.
96
104
97
105
.. literalinclude:: outputs/basics/zlib-clang.out
98
106
:language: console
@@ -107,11 +115,13 @@ Let's check what versions of zlib-ng are available, and then we'll install a dif
@@ -134,7 +144,7 @@ Additionally, if we include the ``-f`` flag, Spack will show any non-empty compi
134
144
.. literalinclude:: outputs/basics/find-lf.out
135
145
:language: console
136
146
137
-
Spack generates a unique hash for each spec we define.
147
+
Spack generates a unique hash for each spec.
138
148
This hash reflects the complete provenance of the package, so any change to the spec—such as compiler version, build options, or dependencies—will result in a different hash.
139
149
Spack uses these hashes both to compare specs and to create unique installation directories for every possible configuration.
140
150
@@ -145,7 +155,9 @@ This approach helps us avoid unnecessary rebuilds of common dependencies, which
145
155
.. literalinclude:: outputs/basics/tcl.out
146
156
:language: console
147
157
148
-
When we need to specify dependencies explicitly, we use the ``^`` sigil in the spec syntax. The syntax is recursive, meaning that anything we can specify for the top-level package can also be specified for a dependency using ``^``. This allows us to precisely control the configuration of both packages and their dependencies.
158
+
Sometimes it is simpler to specify dependencies without caring whether they are direct or transitive dependencies.
159
+
To do that, use the ``^`` sigil.
160
+
Note that a dependency specified by ``^`` is always applied to the root package, whereas a direct dependency specified by ``%`` is applied to either the root or any intervening dependency specified by ``^``.
@@ -207,9 +219,25 @@ Spack also supports versioning of virtual dependencies.
207
219
A package can depend on the MPI interface at version 3 (e.g., ``hdf5 ^mpi@3``), and provider packages specify what version of the interface *they* provide.
208
220
The partial spec ``^mpi@3`` can be satisfied by any of several MPI implementation packages that provide MPI version 3.
209
221
222
+
We've actually already been using virtual packages when we changed compilers earlier.
223
+
Compilers are providers for virtual packages like ``c``, ``cxx``, and ``fortran``.
224
+
Because these are often provided by the same package but we might want to use C and C++ from one compiler and Fortran from another, we need a syntax to specify which virtual a package provides.
225
+
We call this "virtual assignment", and can be specified by ``%virtual=provider`` or ``^virtual=provider``.
226
+
227
+
We will now install HDF5 with MPI support provided by MPICH, ensuring that the C and C++ components of HDF5 are compiled with ``gcc``.
228
+
We could use the same syntax for ``^mpi=mpich``, but there's no need because the only way for ``hdf5`` to depend on ``mpich`` is to provide ``mpi``.
229
+
This is also why we didn't care to specify which virtuals ``gcc`` and ``clang`` provided earlier when building simpler packages.
It is frequently sufficient to specify ``%gcc`` even for packages
237
+
that use multiple languages, because Spack prefers to minimize the
238
+
number of packages needed for a build. Later on we will discuss
239
+
more complex compiler requests, and how and when they are useful.
240
+
213
241
We'll do a quick check in on what we have installed so far.
214
242
215
243
.. literalinclude:: outputs/basics/find-ldf-2.out
@@ -222,7 +250,7 @@ Now let's look at an even more complicated package.
222
250
:language: console
223
251
224
252
Now we're starting to see the power of Spack.
225
-
Trilinos in its default configuration has 23 direct dependencies, many of which have dependencies of their own.
253
+
Depending on the spec, Trilinos can have over 30 direct dependencies, many of which have dependencies of their own.
226
254
Installing more complex packages can take days or weeks even for an experienced user.
227
255
Although we've done a binary installation for the tutorial, a source installation of Trilinos using Spack takes about 3 hours (depending on the system), but only 20 seconds of programmer time.
228
256
@@ -331,33 +359,28 @@ The ``spack compilers`` command is an alias for ``spack compiler list``.
331
359
.. literalinclude:: outputs/basics/compilers.out
332
360
:language: console
333
361
334
-
The compilers are maintained in a YAML file (``compilers.yaml``).
335
-
Later in the tutorial, you will learn how to configure compilers by hand for special cases.
336
-
Spack also has tools to add compilers, and compilers built with Spack can be added to the configuration.
362
+
These compilers are maintained in a YAML file.
363
+
Later in the tutorial we will discuss how to configure external compilers by hand for special cases.
364
+
Spack can also use compilersbuilt by Spack to compile later packages.
We can also remove compilers from our configuration using ``spack compiler remove <compiler_spec>``
379
+
For the test of the tutorial we will sometimes use this new compiler, and sometimes we want to demonstrate things without it. For now, we will uninstall it to avoid using it in the next section.
0 commit comments