Skip to content

Commit 8423edc

Browse files
authored
Add docs. (#269)
1 parent b385a06 commit 8423edc

22 files changed

+1862
-0
lines changed

.github/workflows/docs.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Exawind-Manager Docs
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
concurrency:
10+
group: ${{github.ref}}-${{github.head_ref}}-docs
11+
cancel-in-progress: true
12+
13+
jobs:
14+
docs:
15+
runs-on: ubuntu-24.04
16+
steps:
17+
- name: Clone
18+
uses: actions/checkout@v4
19+
- name: Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: '3.12'
23+
- name: Dependencies
24+
run: |
25+
sudo apt-get update
26+
python3 -m pip install --upgrade pip
27+
pip3 install sphinx sphinx_rtd_theme myst-parser
28+
- name: Build
29+
run: |
30+
echo "::add-matcher::.github/problem-matchers/sphinx.json"
31+
sphinx-build -M html ./docs ./build_docs/manual 2>&1 | tee -a build-output.txt
32+
mv ./build_docs/manual/html ./documentation
33+
touch ./documentation/.nojekyll
34+
- name: Report
35+
run: |
36+
echo "::add-matcher::.github/problem-matchers/sphinx.json"
37+
egrep "WARNING:|Warning:|warning:|ERROR:|Error:|error:" build-output.txt | sort | uniq | \
38+
awk 'BEGIN{i=0}{print $0}{i++}END{print "Warnings: "i}' > build-output-warnings.txt
39+
cat build-output-warnings.txt
40+
exit $(tail -n 1 build-output-warnings.txt | awk '{print $2}')
41+
- name: Deploy
42+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
43+
uses: JamesIves/github-pages-deploy-action@releases/v4
44+
with:
45+
token: ${{secrets.GITHUB_TOKEN}}
46+
branch: gh-pages
47+
folder: documentation
48+
single-commit: true

docs/ProfilePyramids.png

181 KB
Loading

docs/Spack-To-Applications.png

982 KB
Loading

docs/conf.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
extensions = ["myst_parser"]
2+
myst_heading_anchors = 3
3+
templates_path = ["_templates"]
4+
master_doc = "index"
5+
project = "Spack-Manager"
6+
copyright = "Phil Sakievich"
7+
author = "Phil Sakievich"
8+
version = "0.1"
9+
release = "0.1"
10+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
11+
pygments_style = "sphinx"
12+
todo_include_todos = False
13+
numfig = True
14+
numfig_format = {"figure": "%s", "table": "%s", "code-block": "%s"}
15+
html_theme = "sphinx_rtd_theme"
16+
html_static_path = []
17+
html_theme_options = {"navigation_depth": 5}
18+
html_show_sourcelink = True
19+
html_show_copyright = False
20+
htmlhelp_basename = "spack-manager-doc"
21+
latex_elements = {}
22+
latex_documents = [
23+
(master_doc, "spack-manager.tex", "Spack-Manager Documentation", author, "manual")
24+
]
25+
man_pages = [(master_doc, "spack-manager", "Spack-Manager Documentation", [author], 1)]
26+
texinfo_documents = [
27+
(
28+
master_doc,
29+
"spack-manager",
30+
"Spack-Manager Documentation",
31+
author,
32+
"Spack-Manager",
33+
"One line description of project.",
34+
"Miscellaneous",
35+
)
36+
]
37+
source_suffix = {".rst": "restructuredtext", ".txt": "markdown", ".md": "markdown"}

docs/general/ApplicationSpace.png

331 KB
Loading

docs/general/Spack-Manager-Org.png

333 KB
Loading
455 KB
Loading

docs/general/general.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
General Information
2+
===================
3+
4+
This section is for documenting the general concepts of how Spack-Manager works,
5+
and documentation that is applicable to all users of this software.
6+
7+
.. toctree::
8+
:glob:
9+
:maxdepth: 2
10+
11+
spack_manager_structure
12+
spack_features
13+
history

docs/general/history.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# History and inspirations for Spack-Manager
2+
3+
Spack-Manager was created due to the challenges of building the complicated [Exawind](https://github.com/Exawind) software stack.
4+
The Exawind codes have a relatively large number of TPL's and are designed to run on modern HPC architecture, which is currently a moving target.
5+
These factors naturally lead toward using [Spack](https://github.com/spack/spack) to manage the build dependencies.
6+
7+
Arguably the most common use case for Spack is software deployment.
8+
This was the original use for Exawind developers, and a few different extra scripts were maintained for managing the build process for Exawind software.
9+
However, during the Exawind project Spack also released features geared toward development.
10+
This sparked the idea for the central question behind Spack-Manager: **how much of our process can we reasonably extend into the Spack ecosystem?**
11+
12+
Initial evaluations of Spack's develop features were that there was potential, but also room to grow.
13+
These features have since improved, but the other tenant of Spack-Manager was determined from this trial period: **end products need to live as independent from Spack as possible**.
14+
This really comes down to the fact that Exawind stack was constantly changing and growing, along with Spack itself.
15+
In reality the entire HPC and computing landscape is changing dramatically, and so our development frameworks need to be moving together, but still have room to independently flex as thing evolve.
16+
In this sense Spack-Manager acts as a buffer in between the larger Spack project, and the invidual software projects that are using Spack-Manager to curate their development process.
17+
18+
Spack-Manager's development obtained a lot of inspiration from the [Exawind-Builder](https://github.com/Exawind/exawind-builder) project.
19+
Spack-Manager has sought to emulate some of the key features of Exawind-Builder such as the ability to use pre-configured binaries, and to allow users to quickly switch between caches.
20+
Exawind-Builder was a tool principly designed for developers, and Spack-Manager strives to extend that user scope to the entire range of software users.
21+
22+
Exawind-Builder is also another example of a tool built on-top of Spack.
23+
However, the strategies of Spack-Manager and Exawind-Builder differ slightly in that Exawind-Builder sought to go around Spack's missing features through additional bash scripting and environment configurations, while Spack-Manager seeks to predominately extend Spack using the Spack ecosystem for these scenarios.
24+
Both sides have pro's and con's.
25+
Choosing to go around Spack makes it easier to customize things with fewer limitations, but it also requires additional code, interfaces and maintenance.
26+
Choosing to conform to Spack infrastructure means accepting some of the limitations and growing pains of the Spack API, but also reducing the amount of infrastructure that needs to be maintained.
27+
This is constantly becoming less of a sacrifice due to the quality of work done by the Spack development team.
28+
29+
Spack-Manager is intended to be agile, and adapt to changes in Spack by embracing new features in Spack, and contributing back everything it can to the Spack project.
30+
In this sense we are able to harness the pro's of Spack, while still customizing our workflow and influencing the growth of Spack in the future.
31+
32+
33+
34+

docs/general/spack_features.md

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# Important Spack Features
2+
3+
## Spack Specs
4+
5+
In Spack the idea of a _spec_ is very important. Specs are descriptors of particular aspects or configurations of a package or packages.
6+
Specs can completely general, merely denoted the name of a package, or they can very specific such as specifying the name of the package with a particular version, with a particular compiler and compiler version, with specific options called _variants_, as well as constraints on dependencies of the package.
7+
Spack's documentation has much more information on specs [here](https://spack.readthedocs.io/en/latest/basic_usage.html#specs-dependencies), but we summarize them here as it is important to utilizing Spack.
8+
Specs are a loose or general form of a configuration for a package. However, Spack is very exact it how it will build and satisfy your requested spec.
9+
It does this through the process of _concretization_. Concretization maps a spec, no matter how general or specific, into an _exact_ graph of
10+
how Spack will build and fulfill the spec. A command for understanding this process is the `spack spec` command. Using `spack spec`
11+
will report to the user how Spack will create a concrete graph or DAG of the package on its dependencies. For example:
12+
13+
```
14+
% spack spec zlib
15+
Input spec
16+
--------------------------------
17+
zlib
18+
19+
Concretized
20+
--------------------------------
21+
zlib@1.2.11%apple-clang@12.0.0+optimize+pic+shared arch=darwin-catalina-skylake
22+
```
23+
24+
Here we intend to install the zlib package which has no dependencies. If we specify nothing but `zlib`, this is the configuration Spack has solved
25+
in which it will fulfill the installation of zlib. We can be more specific about our request. Looking at what compilers are available for us in Spack
26+
we can use:
27+
```
28+
% spack compilers
29+
==> Available compilers
30+
-- apple-clang catalina-x86_64 ----------------------------------
31+
apple-clang@12.0.0
32+
33+
-- gcc catalina-x86_64 ------------------------------------------
34+
gcc@11.2.0
35+
```
36+
37+
Here we are on a MacOS computer and we have two compilers available. If I prefer `zlib` be installed using gcc, one can use:
38+
```
39+
% spack spec zlib%gcc
40+
Input spec
41+
--------------------------------
42+
zlib%gcc
43+
44+
Concretized
45+
--------------------------------
46+
zlib@1.2.11%gcc@11.2.0+optimize+pic+shared arch=darwin-catalina-skylake
47+
```
48+
49+
Notice Spack honored our compiler constraint request. Spack reports the concretized spec in a manner that continues to itself be a spec:
50+
```
51+
% spack spec zlib@1.2.11%gcc@11.2.0+optimize+pic+shared arch=darwin-catalina-skylake
52+
Input spec
53+
--------------------------------
54+
zlib@1.2.11%gcc@11.2.0+optimize+pic+shared arch=darwin-catalina-skylake
55+
56+
Concretized
57+
--------------------------------
58+
zlib@1.2.11%gcc@11.2.0+optimize+pic+shared arch=darwin-catalina-skylake
59+
```
60+
61+
Therefore using the `spec` command helps us to understand specs and what Spack will do with a spec before we use them in other commands.
62+
Here is an example of a more complicated package:
63+
```
64+
% spack spec amr-wind
65+
Input spec
66+
--------------------------------
67+
amr-wind
68+
69+
Concretized
70+
--------------------------------
71+
amr-wind@main%apple-clang@12.0.0~cuda~fortran+hypre+internal-amrex~ipo~masa+mpi+netcdf~openfast~openmp~rocm+shared+tests+unit build_type=Release arch=darwin-catalina-skylake
72+
^cmake@3.22.2%apple-clang@12.0.0~doc+ncurses+openssl+ownlibs~qt build_type=Release arch=darwin-catalina-skylake
73+
^ncurses@6.2%apple-clang@12.0.0~symlinks+termlib abi=none arch=darwin-catalina-skylake
74+
^pkgconf@1.8.0%apple-clang@12.0.0 arch=darwin-catalina-skylake
75+
^openssl@1.1.1m%apple-clang@12.0.0~docs certs=system arch=darwin-catalina-skylake
76+
^perl@5.34.0%apple-clang@12.0.0+cpanm+shared+threads arch=darwin-catalina-skylake
77+
^berkeley-db@18.1.40%apple-clang@12.0.0+cxx~docs+stl patches=b231fcc4d5cff05e5c3a4814f6a5af0e9a966428dc2176540d2c05aff41de522 arch=darwin-catalina-skylake
78+
^bzip2@1.0.8%apple-clang@12.0.0~debug~pic+shared arch=darwin-catalina-skylake
79+
^diffutils@3.8%apple-clang@12.0.0 arch=darwin-catalina-skylake
80+
^libiconv@1.16%apple-clang@12.0.0 libs=shared,static arch=darwin-catalina-skylake
81+
^gdbm@1.19%apple-clang@12.0.0 arch=darwin-catalina-skylake
82+
^readline@8.1%apple-clang@12.0.0 arch=darwin-catalina-skylake
83+
^zlib@1.2.11%apple-clang@12.0.0+optimize+pic+shared arch=darwin-catalina-skylake
84+
^hypre@2.23.0%apple-clang@12.0.0~complex~cuda~debug+int64~internal-superlu~mixedint+mpi~openmp+shared~superlu-dist~unified-memory arch=darwin-catalina-skylake
85+
^netlib-lapack@3.9.1%apple-clang@12.0.0~external-blas~ipo+lapacke+shared~xblas build_type=Release arch=darwin-catalina-skylake
86+
^openmpi@4.1.2%apple-clang@12.0.0~atomics~cuda~cxx~cxx_exceptions+gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker~pmi~pmix+romio~singularity~sqlite3+static~thread_multiple+vt+wrapper-rpath fabrics=none schedulers=none arch=darwin-catalina-skylake
87+
^hwloc@2.7.0%apple-clang@12.0.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~opencl~pci~rocm+shared arch=darwin-catalina-skylake
88+
^libxml2@2.9.12%apple-clang@12.0.0~python arch=darwin-catalina-skylake
89+
^xz@5.2.5%apple-clang@12.0.0~pic libs=shared,static arch=darwin-catalina-skylake
90+
^libevent@2.1.12%apple-clang@12.0.0+openssl arch=darwin-catalina-skylake
91+
^openssh@8.8p1%apple-clang@12.0.0 arch=darwin-catalina-skylake
92+
^libedit@3.1-20210216%apple-clang@12.0.0 arch=darwin-catalina-skylake
93+
^netcdf-c@4.7.4%apple-clang@12.0.0~dap~fsync~hdf4~jna+mpi+parallel-netcdf+pic+shared patches=2c88dfbd6d339a0336a43b14a65a1d1df995b853b645e4af612617612a642a53 arch=darwin-catalina-skylake
94+
^hdf5@1.10.7%apple-clang@12.0.0+cxx~fortran+hl~ipo~java+mpi+shared~szip~threadsafe+tools api=default build_type=RelWithDebInfo patches=2a1e3118d7d3d7411820e567b03530de96a46385304017f8e548408aa1cfbfc0 arch=darwin-catalina-skylake
95+
^m4@1.4.19%apple-clang@12.0.0+sigsegv patches=9dc5fbd0d5cb1037ab1e6d0ecc74a30df218d0a94bdd5a02759a97f62daca573,bfdffa7c2eb01021d5849b36972c069693654ad826c1a20b53534009a4ec7a89 arch=darwin-catalina-skylake
96+
^libsigsegv@2.13%apple-clang@12.0.0 arch=darwin-catalina-skylake
97+
^parallel-netcdf@1.12.2%apple-clang@12.0.0~burstbuffer+cxx+fortran+pic+shared arch=darwin-catalina-skylake
98+
```
99+
100+
It is obvious concretized specs can get large quite quickly. However, Spack is very good at standing on it's own without requirements
101+
from the existing system. Therefore it can be quite straightforward to build complicated packages on many machines. However, it can also be argued
102+
that this situation involves many packages with Spack will build that may already exist on the machine. While this is fair, we typically solve
103+
this by specifying `externals` which make Spack aware of packages already existing on the system and utilizing them in its DAG. Spack-manager
104+
has machine-specific configurations provided by its contributors for this purpose. Obtaining a configuration for Spack for the specific machine
105+
and specific project will save the user of Spack a lot of time.
106+
107+
In our previous concretized DAG, `amr-wind` has dependencies on packages. Dependencies in specs are denoted with `^`. We can use this to constrain dependencies we would like to request.
108+
For example here we put a constraint on the cmake version:
109+
```
110+
% spack spec amr-wind ^cmake@3.17.0
111+
Input spec
112+
--------------------------------
113+
amr-wind
114+
^cmake@3.17.0
115+
116+
Concretized
117+
--------------------------------
118+
amr-wind@main%apple-clang@12.0.0~cuda~fortran+hypre+internal-amrex~ipo~masa+mpi+netcdf~openfast~openmp~rocm+shared+tests+unit build_type=Release arch=darwin-catalina-skylake
119+
^cmake@3.17.0%apple-clang@12.0.0~doc+ncurses+openssl+ownlibs~qt build_type=Release patches=1c540040c7e203dd8e27aa20345ecb07fe06570d56410a24a266ae570b1c4c39,bf695e3febb222da2ed94b3beea600650e4318975da90e4a71d6f31a6d5d8c3d,e51119dd387aa3eb2f21fee730d3aa8b5480301c5e2e3a33bd86f4f7d8903861 arch=darwin-catalina-skylake
120+
^ncurses@6.2%apple-clang@12.0.0~symlinks+termlib abi=none arch=darwin-catalina-skylake
121+
...
122+
```
123+
Concretization is an NP-hard problem, so solving the DAG is not instantaneous, and it is very much an active area of research. Spack has
124+
gone through one iteration thus far of updating its concretization strategy. This is the difference between the "original" concretizer and the newer clingo concretizer.
125+
126+
Another important idea in Spack is describing the configuration of a particular package involving a complicated DAG into a succint string for the installation directory of the package for example. To do this, Spack collapses several properties of the DAG into a _hash_. Spack then uses this hash to provide a short form mapping for a particular package and its full description. Spack is a very powerful database of software installations and can be queried to understand the exact state of each package and pinpointing a specific package in which the user is interested. We leave these to the Spack documentation to continue.
127+
128+
129+
## Spack Commands
130+
131+
Spack has many commands, many of which have great information when adding `-h` to them. Here we list a few of the most important commands for using within Spack-Manager.
132+
133+
- `spack spec -I <spec> `: solve the DAG for the spec and show packages in the DAG that are already installed
134+
- `spack location -i <spec> `: used for finding the specific location of an installed package
135+
- `spack concretize -f `: force an activated environment to undergo concretization
136+
- `spack install `: install all packages listed in an environment's `spack.yaml` file
137+
- `spack uninstall <spec>`: uninstall specific spec
138+
- `spack uninstall --dependencies -a -y <spec>`: uninstall everything related to a general spec (`-a`) and all its dependencies without confirming
139+
- `spack cd -b <spec> `: change to build directory of package
140+
- `spack env activate -d <path> ` or `spacktivate -d <path>`: activate a Spack environment at specified path
141+
- `spack develop <spec> `: develop source code in a package locally
142+
- `spack help --all `: list all available Spack commands
143+
- `spack list <string>`: list all available Spack packages matching the string
144+
- `spack find <spec>`: query Spack's database of installed packages
145+
- `spack find -Lvd <spec>`: list the hashes, variants, and dependencies of the provided spec
146+
- `spack stage <spec> && spack cd <spec>`: download the package's source code and extract it for browsing
147+
- `spack docs`: open the online spack documentation in a browser
148+
- `spack -d <spack subcommand>`: get debug info on exactly what Spack is doing when it fails
149+
- `spack config blame packages`: show exactly where Spack is obtaining its preferences for things like concretization
150+
- `spack compilers`: list the compilers in which Spack is aware
151+
152+
153+
## Spack Knowledgebase
154+
155+
In each package installation directory in `spack/opt` Spack keeps a `.spack` directory which contains information on exactly how the package was built.

0 commit comments

Comments
 (0)