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
Copy file name to clipboardExpand all lines: tutorial_basics.rst
+38-38Lines changed: 38 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,7 +75,7 @@ To install a software package, type:
75
75
Let's go ahead and install ``gmake``,
76
76
77
77
.. literalinclude:: outputs/basics/gmake.out
78
-
:language:console
78
+
:language:spec
79
79
80
80
You will see Spack installed ``gmake``, ``gcc``, ``gcc-runtime``, and ``glibc``.
81
81
The ``glibc`` and ``gcc-runtime`` packages are automatically tracked by Spack to manage consistency requirements among compiler runtimes.
@@ -108,7 +108,7 @@ The ``%`` sigil is used to specify direct dependencies like a package's compiler
108
108
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.
109
109
110
110
.. literalinclude:: outputs/basics/zlib-clang.out
111
-
:language:console
111
+
:language:spec
112
112
113
113
Notice that this installation is located separately from the previous one.
114
114
We'll explore this concept in more detail later, but this separation is fundamental to how Spack supports multiple configurations and versions of software packages simultaneously.
@@ -118,36 +118,36 @@ Before we install additional versions, we can check the versions available to us
118
118
Let's check what versions of zlib-ng are available, and then we'll install a different version to demonstrate Spack's flexibility in managing multiple package versions.
The spec syntax in Spack also supports compiler flags.
134
134
We can specify parameters such as ``cppflags``, ``cflags``, ``cxxflags``, ``fflags``, ``ldflags``, and ``ldlibs``.
135
135
If any of these values contain spaces, we'll need to enclose them in quotes on the command line.
136
136
Spack’s compiler wrappers will automatically inject these flags into the appropriate compilation commands.
137
137
138
138
.. literalinclude:: outputs/basics/zlib-O3.out
139
-
:language:console
139
+
:language:spec
140
140
141
141
After installing packages, we can use the ``spack find`` command to query which packages are installed.
142
142
Notice that by default, some installed packages appear identical in the output.
143
143
To help distinguish between them, we can add the ``-l`` flag to display each package’s unique hash.
144
144
Additionally, if we include the ``-f`` flag, Spack will show any non-empty compiler flags that were used during installation.
145
145
146
146
.. literalinclude:: outputs/basics/find.out
147
-
:language:console
147
+
:language:spec
148
148
149
149
.. literalinclude:: outputs/basics/find-lf.out
150
-
:language:console
150
+
:language:spec
151
151
152
152
Spack generates a unique hash for each spec.
153
153
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.
@@ -158,14 +158,14 @@ By default, Spack prioritizes reusing installations that already exist, whether
158
158
This approach helps us avoid unnecessary rebuilds of common dependencies, which is especially valuable if we update Spack frequently.
159
159
160
160
.. literalinclude:: outputs/basics/tcl.out
161
-
:language:console
161
+
:language:spec
162
162
163
163
Sometimes it is simpler to specify dependencies without caring whether they are direct or transitive dependencies.
164
164
To do that, use the ``^`` sigil.
165
165
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 ``^``.
We can also refer to packages from the command line by their package hash.
171
171
Earlier, when we used the ``spack find -lf`` command, we saw that the hash for our optimized installation of zlib-ng (with ``cflags="-O3"``) began with ``umrbkwv``.
@@ -175,20 +175,20 @@ Similar to tools like Git, we do not need to enter the entire hash on the comman
175
175
If the prefix we provide matches more than one installed package, Spack will report an error and prompt us to be more specific.
@@ -252,13 +252,13 @@ This is also why we didn't care to specify which virtuals ``gcc`` and ``clang``
252
252
We'll do a quick check in on what we have installed so far.
253
253
254
254
.. literalinclude:: outputs/basics/find-ldf-2.out
255
-
:language:console
255
+
:language:spec
256
256
257
257
HDF5 is more complicated than our basic example of zlib-ng and Tcl, but it's still within the realm of software that an experienced HPC user could reasonably expect to manually install given a bit of time.
258
258
Now let's look at an even more complicated package.
259
259
260
260
.. literalinclude:: outputs/basics/trilinos.out
261
-
:language:console
261
+
:language:spec
262
262
263
263
Now we're starting to see the power of Spack.
264
264
Depending on the spec, Trilinos can have over 30 direct dependencies, many of which have dependencies of their own.
@@ -270,19 +270,19 @@ Every MPI dependency will be satisfied by the same configuration of MPI, etc.
270
270
If we install Trilinos again specifying a dependency on our previous HDF5 built with MPICH:
@@ -348,17 +348,17 @@ The ``spack find`` command can accept what we call "anonymous specs." These are
348
348
For example, ``spack find ^mpich`` will return every installed package that depends on MPICH, and ``spack find cflags="-O3"`` will return every package which was built with ``cflags="-O3"``.
Because this compiler is a newer version than the external compilers Spack knows about, it will be the new default compiler.
384
384
We will discuss changing these defaults in a later section.
385
385
We can check that this compiler is preferred by looking at the install plan for a package that isn't being reused from binary.
386
386
387
387
.. literalinclude:: outputs/basics/spec-zziplib
388
-
:language:console
388
+
:language:spec
389
389
390
390
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