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
I fixed typos and grammatical errors in your tutorial documentation. (#436)
I corrected various spelling and grammar mistakes in the following files:
- tutorial_advanced_packaging.rst
- tutorial_basics.rst
- tutorial_binary_cache.rst
- tutorial_buildsystems.rst
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Copy file name to clipboardExpand all lines: tutorial_advanced_packaging.rst
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,7 +66,7 @@ Now, you are ready to set your preferred ``EDITOR`` and continue with the rest o
66
66
Modifying a Package's Build Environment
67
67
---------------------------------------
68
68
69
-
Spack sets up several environment variables like ``PATH`` by default to aid in building a package, but many packages make use of environment variables which convey specific information about their dependencies (e.g., ``MPICC``).
69
+
Spack sets up several environment variables like ``PATH`` by default to aid in building a package, but many packages make use of environment variables that convey specific information about their dependencies (e.g., ``MPICC``).
70
70
This section covers how to update your Spack packages so that package-specific environment variables are defined at build-time.
These functions take as a parameter a :py:class:`EnvironmentModifications <spack.util.environment.EnvironmentModifications>` object, which includes convenience methods to update the environment.
83
83
For example, an MPI implementation can set ``MPICC`` for build-time use for packages that depend on it:
84
84
@@ -379,9 +379,9 @@ Other Packaging Topics
379
379
Attach attributes to other packages
380
380
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
381
381
382
-
Build tools usually also provide a set of executables that can be used when another package is being installed.
382
+
Build tools also usually provide a set of executables that can be used when another package is being installed.
383
383
Spack gives you the opportunity to monkey-patch dependent modules and attach attributes to them.
384
-
This helps make the packager experience as similar as possible to what would have been the manual installation of the same package.
384
+
This helps make the packager's experience as similar as possible to what would have been the manual installation of the same package.
385
385
386
386
An example here is the ``automake`` package, which overrides
Spack will not uninstall packages that are not sufficiently specified specified (i.e., if the spec is ambiguous and matches multiple installed packages).
282
+
Spack will not uninstall packages that are not sufficiently specified (i.e., if the spec is ambiguous and matches multiple installed packages).
283
283
The ``--all`` (or ``-a``) flag can be used to uninstall all packages matching an ambiguous spec.
looks very similar to a container image --- we will get to that in a bit.
112
+
look very similar to a container image --- we will get to that in a bit.
113
113
114
114
.. note ::
115
115
@@ -207,7 +207,7 @@ We can already attempt to run the image associated with the ``julia`` package th
207
207
exec /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/julia-1.9.3-dfzhutfh3s2ekaltdmujjn575eip5uhl/bin/julia: no such file or directory
208
208
209
209
but immediately we see it fails.
210
-
The reason is that one crucial part is missing, and that is a ``glibc``, which Spack always treats as an external package.
210
+
The reason is that one crucial part is missing, and that is ``glibc``, which Spack always treats as an external package.
211
211
212
212
To fix this, we force push to the registry again, but this time we specify a base image with a recent version of ``glibc``, for example from ``ubuntu:24.04``:
213
213
@@ -231,7 +231,7 @@ This time it works!
231
231
The minimal ``ubuntu:24.04`` image provides us not only with ``glibc``, but also other utilities like a shell.
232
232
233
233
Notice that you can use any base image of choice, like ``fedora`` or ``rockylinux``.
234
-
The only constraint is that it has a ``libc`` compatible with the external in the Spack built the binaries.
234
+
The only constraint is that it has a ``libc`` compatible with the external ``libc`` Spack used to build the binaries.
235
235
Spack does not validate this.
236
236
237
237
--------------------------------------
@@ -243,7 +243,7 @@ If you've paid attention to the output of some of the commands we have run so fa
243
243
Every Spack package corresponds to a single layer in each image, and the layers are shared across the different image tags.
244
244
245
245
Because Spack installs every package into a unique prefix, it is incredibly easy to compose multiple packages into a container image.
246
-
In contrast to Docker images built from commands in a ``Dockerfile`` where each command is run in order, Spack package layers are independent, and can in principle be combined in any order.
246
+
In contrast to Docker images built from commands in a ``Dockerfile`` where each command is run in sequence, Spack package layers are independent, and can in principle be combined in any order.
247
247
248
248
Let's add a simple text editor like ``vim`` to our previous environment next to ``julia``, so that we could both edit and run Julia code.
249
249
@@ -309,7 +309,7 @@ The downside is that sharing binaries is more complicated, as binaries may conta
309
309
Fortunately Spack handles this automatically upon install from a binary cache.
310
310
But when you build binaries that are intended to be shared, there is one thing you have to keep in mind: Spack can relocate hard-coded paths in binaries *provided that the target prefix is shorter than the prefix used during the build*.
311
311
312
-
The reason is that binaries typically embed these absolute paths in string tables, which is a list of nullterminated strings, to which the program stores offsets.
312
+
The reason is that binaries typically embed these absolute paths in string tables, which is a list of null-terminated strings, to which the program stores offsets.
313
313
That means we can only modify strings in-place, and if the new path is longer than the old one, we would overwrite the next string in the table.
314
314
315
315
To maximize the chances of successful relocation, you should build your binaries in a relatively long path.
Copy file name to clipboardExpand all lines: tutorial_buildsystems.rst
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,8 +41,8 @@ Package Class Hierarchy
41
41
}
42
42
43
43
The above diagram gives a high-level view of the class hierarchy and how each package relates.
44
-
Each build system specific class inherits from the ``PackageBaseClass`` superclass.
45
-
The bulk of the common work is done in this superclass which includes fetching, extracting to a staging directory and installing.
44
+
Each build system specific class inherits from the ``PackageBase`` superclass.
45
+
The bulk of the common work is done in this superclass which includes fetching, extracting to a staging directory and the install process.
46
46
Each subclass then adds additional build-system-specific functionality.
47
47
In the following sections, we will go over examples of how to utilize each subclass and see how powerful these abstractions are when packaging.
48
48
@@ -80,7 +80,7 @@ The ``AutotoolsPackage`` subclass aims to simplify writing package files for Aut
80
80
4. ``install()``
81
81
82
82
83
-
Each of these phases have sensible defaults.
83
+
Each of these phases has sensible defaults.
84
84
Let's take a quick look at some of the internals of the ``Autotools`` class:
85
85
86
86
.. code-block:: console
@@ -103,7 +103,7 @@ This will open the ``AutotoolsPackage`` file in your text editor.
103
103
104
104
Important to note are the highlighted lines.
105
105
These properties allow the packager to set what build targets and install targets they want for their package.
106
-
If, for example, we wanted to add as our build target ``foo`` then we can append to our ``build_targets`` property:
106
+
If, for example, we wanted to add as our build target ``foo`` then we can append to our ``build_targets`` list:
107
107
108
108
.. code-block:: python
109
109
@@ -151,16 +151,16 @@ In fact, the only thing that needs to be overridden is ``configure_args()``.
151
151
:linenos:
152
152
153
153
Since Spack's ``AutotoolsPackage`` takes care of setting the prefix for us, we can exclude that as an argument to ``configure``.
154
-
Our package file looks simpler, and we don't not need to worry about whether we have properly included ``configure`` and ``make``.
154
+
Our package file looks simpler, and we don't need to worry about whether we have properly included ``configure`` and ``make``.
155
155
156
156
This version of the ``mpileaks`` package installs the same as the previous, but the ``AutotoolsPackage`` class lets us do it with a cleaner looking package file.
157
157
158
158
-----------------
159
159
Makefile
160
160
-----------------
161
161
162
-
Packages that utilize ``Make`` or a ``Makefile`` usually require you to edit a ``Makefile`` to set up platform and compilerspecific variables.
163
-
These packages are handled by the ``Makefile`` subclass which provides convenience methods to help write these types of packages.
162
+
Packages that utilize ``Make`` or a ``Makefile`` usually require you to edit a ``Makefile`` to set up platform and compiler-specific variables.
163
+
These packages are handled by the ``MakefilePackage`` subclass which provides convenience methods to help write these types of packages.
164
164
165
165
A ``MakefilePackage`` build has three phases that can be overridden by the packager:
166
166
@@ -217,16 +217,16 @@ Once the fetching is completed, Spack will open up your text editor in the usual
217
217
:language: python
218
218
:linenos:
219
219
220
-
Spack was successfully able to detect that ``Bowtie`` uses ``Make``.
220
+
Spack was successfully able to detect that ``Bowtie`` uses ``Makefiles``.
221
221
Let's add in the rest of our details for our package:
As we mentioned earlier, most packages using a ``Makefile`` have hard-coded variables that must be edited.
229
-
These variables are fine if you happen to not care about setup or types of compilers used but Spack is designed to work with any compiler.
228
+
As we mentioned earlier, most packages using a ``Makefile`` have hardcoded variables that must be edited.
229
+
These variables are fine if you happen to not care about setup or types of compilers used, but Spack is designed to work with any compiler.
230
230
The ``MakefilePackage`` subclass makes it easy to edit these ``Makefiles`` by having an ``edit()`` method that can be overridden.
231
231
232
232
Let's take a look at the default ``Makefile`` that ``Bowtie`` provides.
@@ -275,7 +275,7 @@ Let's change the build and install phases of our package:
275
275
276
276
Here we demonstrate another strategy that we can use to manipulate our package's build.
277
277
We can provide command-line arguments to ``make()``.
278
-
Since ``Bowtie`` can use ``tbb`` we can either add ``NO_TBB=1`` as a argument to prevent ``tbb`` support, or we can invoke ``make`` with no arguments if EBB is desired and found by its build system.
278
+
Since ``Bowtie`` can use ``tbb`` we can either add ``NO_TBB=1`` as a argument to prevent ``tbb`` support, or we can invoke ``make`` with no arguments if TBB is desired and found by its build system.
279
279
280
280
``Bowtie`` requires our ``install_target`` to provide a path to the install directory.
281
281
We can do this by providing ``prefix=`` as a command line argument to ``make()``.
@@ -472,7 +472,7 @@ Options include:
472
472
473
473
With these options you can specify whether you want your executable to have the debug version only, release version or the release with debug information.
474
474
Release executables tend to be more optimized than Debug versions.
475
-
In Spack, we set the default as Release unless otherwise specified through a variant (e.g., ``build_type=Debug``).
475
+
In Spack, we set the default as `Release` unless otherwise specified through a variant (e.g., ``build_type=Debug``).
476
476
477
477
Spack then automatically sets up the ``-DCMAKE_INSTALL_PREFIX`` path, appends the build type (defaulting to ``RelWithDebInfo``), and enables a verbose ``Makefile`` output by default.
478
478
@@ -527,7 +527,7 @@ Again we fill in the details:
527
527
:linenos:
528
528
:emphasize-lines: 9,13,14,18,19,20,21,22,23
529
529
530
-
As mentioned earlier, Spack's ``CMakePackage`` uses sensible defaults to reduce biolerplate and simplify writing package files for ``CMake``-based software.
530
+
As mentioned earlier, Spack's ``CMakePackage`` uses sensible defaults to reduce boilerplate and simplify writing package files for ``CMake``-based software.
531
531
532
532
In ``callpath``, we want to control options like ``CALLPATH_WALKER`` or add specific compiler flags.
533
533
We can return these options from ``cmake_args()`` like so:
@@ -621,7 +621,7 @@ And we are left with the following template:
621
621
:linenos:
622
622
623
623
As you can see this is not any different than any package template that we have written.
624
-
We have the choice of providing build options or using the sensible defaults
624
+
We have the choice of providing build options or using the sensible defaults.
625
625
626
626
Luckily for us, there is no need to provide build args.
627
627
@@ -683,7 +683,7 @@ Although we won't get in depth with any of the other build systems that Spack su
683
683
684
684
685
685
Each of these classes have their own abstractions to help assist in writing package files.
686
-
For whatever doesn't fit nicely into the other build-systems, you can use the ``Package`` class.
686
+
For whatever doesn't fit nicely into the other buildsystems, you can use the ``Package`` class.
687
687
688
688
Hopefully by now you can see how we aim to make packaging simple and robust through these classes.
689
689
If you want to learn more about these build systems, check out `Implementing the installation procedure <https://spack.readthedocs.io/en/latest/packaging_guide.html#installation-procedure>`_ in the Packaging Guide.
0 commit comments