Skip to content

Commit 09663a8

Browse files
committed
Added initial Spack overview and link important docs
1 parent f6829ed commit 09663a8

File tree

2 files changed

+177
-8
lines changed

2 files changed

+177
-8
lines changed

docs/environment/spack.md

Lines changed: 174 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,102 @@
66

77
## Introduction to Spack
88

9+
<p style="text-align: justify;"> Spack is an open-source package manager designed for installing, building, and managing scientific software across a wide range of systems—from personal laptops to the world’s largest supercomputers. It supports multiple versions, compilers, and configurations of packages, all coexisting without conflict. Spack is especially popular in high-performance computing (HPC) environments due to its non-destructive installations, flexible dependency resolution, and robust support for complex software stacks. </p>
910

10-
A brief introduction to Spack will be added here.
11+
### Why spack ?
12+
13+
<p style="text-align: justify;">Spack simplifies the software installation process in scientific computing. It uses a concise <code>spec</code> syntax to let users define versions, compilers, build options, and dependencies in a readable format. Package recipes in Spack are written in pure Python, allowing contributors to manage many builds with a single file. With over 8,500 official packages available, Spack offers great flexibility—and it's not limited to pre-existing packages. Users can create custom ( e.g. <code>package.py</code> ) files for software not yet available in the Spack pre-defined packages. <a href="https://spack.readthedocs.io/en/latest/" target="_blank">[1]</a> </p>
14+
15+
### Key Features of Spack
16+
<ul style="text-align: justify;">
17+
18+
<li><strong>Multiple Versions & Configurations:</strong> Easily install multiple versions of the same software with different compilers or build options.</li>
19+
20+
<li><strong>Custom Dependencies:</strong> Flexibly control dependencies, even choosing between alternative implementations.</li>
21+
22+
<li><strong>Non-destructive Installs:</strong> New installations do not interfere with existing packages.</li>
23+
24+
<li><strong>Package Coexistence:</strong> Different builds of the same software can live side by side.</li>
25+
26+
<li><strong>Easy Package Creation:</strong> Write simple ( e.g. <code>package.py</code> ) files in Python to add new software to Spack.</li>
27+
28+
<li><strong>Virtual Environments:</strong> Create isolated environments for experiments or projects.</li>
29+
30+
</ul>
31+
32+
33+
### Key Resources
34+
35+
Below are essential resources including its official documentation, usage guides, packaging tutorials, and community links:
36+
37+
=== "Important Resources"
38+
39+
- <a href="https://spack.readthedocs.io/en/latest/" target="_blank">**Official Documentation**</a>
40+
41+
- <a href="https://spack-tutorial.readthedocs.io/en/latest/" target="_blank">**Spack Tutorial**</a>
42+
43+
- <a href="https://packages.spack.io/" target="_blank"> **Package Index** </a>
44+
45+
- <a href="https://spack.readthedocs.io/en/latest/package_fundamentals.html" target="_blank">**Package Fundamentals**</a>
46+
47+
- <a href="https://spack.readthedocs.io/en/latest/environments.html" target="_blank">**Spack Environments**</a>
48+
49+
- <a href="https://cache.spack.io/" target="_blank"> **Spack Build Cache** </a>
50+
51+
52+
=== "Additional Resources"
53+
54+
- <a href="https://spack.readthedocs.io/en/latest/configuration.html" target="_blank">**Spack Configuration file **</a>
55+
56+
- <a href="https://spack.readthedocs.io/en/latest/packaging_guide.html" target="_blank">**Advance Packaging Guide**</a>
57+
58+
- <a href="https://spack.readthedocs.io/en/latest/build_settings.html" target="_blank">**Concretization Settings**</a>
59+
60+
61+
- <a href="https://github.com/spack/spack/discussions" target="_blank">**Spack Community & Discussions**</a>
62+
63+
???+ tabs "Spack Resources"
64+
65+
=== "Important Resources"
66+
67+
- <a href="https://spack.readthedocs.io/en/latest/" target="_blank">**Official Documentation**</a>
68+
69+
- <a href="https://spack-tutorial.readthedocs.io/en/latest/" target="_blank">**Spack Tutorial**</a>
70+
71+
72+
- <a href="https://spack.readthedocs.io/en/latest/package_fundamentals.html" target="_blank">**Package Fundamentals**</a>
73+
74+
- <a href="https://packages.spack.io/" target="_blank"> **Package Index** </a>
75+
76+
- <a href="https://spack.readthedocs.io/en/latest/environments.html" target="_blank">**Spack Environments**</a>
77+
78+
79+
- <a href="https://cache.spack.io/" target="_blank"> **Spack Build Cache** </a>
80+
81+
82+
=== "Additional Resources"
83+
84+
- <a href="https://spack.readthedocs.io/en/latest/configuration.html" target="_blank">**Spack Configuration file **</a>
85+
86+
- <a href="https://spack.readthedocs.io/en/latest/packaging_guide.html" target="_blank">**Advance Packaging Guide**</a>
87+
88+
- <a href="https://spack.readthedocs.io/en/latest/build_settings.html" target="_blank">**Concretization Settings**</a>
89+
90+
- <a href="https://github.com/spack/spack/discussions" target="_blank">**Spack Community & Discussions**</a>
91+
92+
93+
94+
95+
96+
## Setting up Spack.
1197

12-
## Setting up Spack
1398

1499
!!! note
15100
The guide is also applicable to other HPC clusters where users need to manage components such as MPI libraries, compilers, and other software through the `module` system.
16101

17102

18103
### Connection to a compute node
19-
104+
For all tests and compilation with Spack, it is essential to run on a **compute node**, not in the login/access node. Here's an example of how to allocate an [interactive session](../jobs/interactive.md) in **Aion cluster**.
20105

21106
```{.sh .copy}
22107
si -N 1 -n 16 -c 1 -t 0-02:00:00 # on iris: -C broadwell or -C skylake
@@ -57,24 +142,106 @@ si -N 1 -n 16 -c 1 -t 0-02:00:00 # on iris: -C broadwell or -C skylake
57142

58143
### Clone & Setup Spack
59144

60-
Clone and setup spack in `$HOME` - it has better much better performance for
61-
small files than `$SCRATCH`
145+
Cloning and setting up Spack in `$HOME` directory is recommended, as it provides significantly better performance for handling small files compared to `$SCRATCH`.
146+
To clone the Spack Repository:
62147

63148
``` { .sh .copy }
64149
cd $HOME
65150
git clone --depth=2 https://github.com/spack/spack.git
66151
cd spack
67152
```
68-
To make Spack available in your shell session, source its environment setup script:
153+
To make Spack available in the shell session, source its environment setup script:
69154

70155
``` { .sh .copy }
71156
source $HOME/spack/share/spack/setup-env.sh
72157
```
73158
For convenience, this line can be added to the .`bashrc` file to make Spack automatically available in every new shell session.
74159

160+
??? note "Test some basic functionality"
161+
162+
Once Spack is sourced, the installation can be verified and basic functionality explored using the following commands:
163+
164+
**Check Spack Version:**
165+
```sh
166+
# Displays the currently installed version of Spack
167+
spack --version
168+
```
169+
**Search for Available Packages:**
170+
```sh
171+
# Lists all available packages in Spack
172+
spack list
173+
```
174+
175+
**Search for a specific one:**
176+
```sh
177+
# Shows all packages whose names contain "cmake"
178+
spack list cmake
179+
```
180+
181+
**Find Installed Packages:**
182+
```sh
183+
# Lists all currently installed packages
184+
spack find
185+
```
186+
!!! note
187+
188+
If Spack was just installed, this list will likely be empty. Installed packages will appear here after the first successful build.
189+
190+
For more details :
191+
192+
- <a href="https://spack-tutorial.readthedocs.io/en/latest/tutorial_basics.html#" target="_blank">**Spack Basic Tutorial.**</a>
193+
194+
### Useful Spack Commands.
195+
196+
197+
The following tables summarizes the basic commands for managing software packages with Spack, from searching and installation to managing the software environment.
198+
199+
| Spack Command | Description |
200+
|------------------------------|--------------------------------------------------------------|
201+
|`spack list`| Lists all available packages. |
202+
|`spack list <package>` | Searches for packages matching the name or keyword.|
203+
|` spack info <package>` | displays detailed information about that package|
204+
| `spack install <package>` | Installs a new package on the cluster. |
205+
| `spack uninstall <package>` | Removes an installed package from the cluster. |
206+
| `spack load <package>` | Makes a package ready for use in the current session. |
207+
| `spack unload <package>` | Removes a package from the current session's environment. |
208+
| `spack versions <package>` | Shows all available versions of a package for installation on the cluster. |
209+
| `spack help` | Displays general help and available subcommands. |
210+
| `spack help <subcommand>` | Shows help for a specific subcommand. |
211+
|`spack config get`| Shows current Spack configuration settings |
212+
|`spack compiler find `| Detects and registers available compilers on the system |
213+
|`spack dependencies <package>`| Lists dependencies of a package |
214+
215+
??? info "Further Reference"
216+
For a comprehensive list of commands and advanced usage options, refer to the official Spack documentation:<a href="https://spack.readthedocs.io/en/latest/command_index.html" target="_blank"><strong>Spack Command Index</strong></a>
217+
218+
219+
### Spack Environments
220+
221+
A Spack environment is a powerful feature that allows users to manage sets of software packages, dependencies, and configurations in an isolated and reproducible way.
222+
223+
Below is a list of commonly used Spack environment commands:
224+
225+
| Spack Command | Description |
226+
|-----------------------------------|--------------------------------------------------------------|
227+
| `spack env status` | Displays the currently active Spack environment. |
228+
| `spack env list` | Lists all existing Spack environments. |
229+
| `spack env create <env_name>` | Creates a new Spack environment with the specified name. |
230+
| `spack env activate <env_name>` | Activates the specified Spack environment. |
231+
| `spack env deactivate` | Deactivates the currently active environment. |
232+
|`spack concretize`| Prepares a full dependency spec for an environment or package before install |
233+
| `spack install --add <package>` | Installs a package into the currently active environment. |
234+
235+
236+
??? info "Further Reference"
237+
For more technical details, see the official Spack documentation:<a href="https://spack.readthedocs.io/en/latest/environments.html" target="_blank"><strong>Spack Environments</strong></a>
238+
239+
240+
75241
### Define System-Provided Packages
76242

77-
`packages.yaml` A spack configuration file used to tell Spack what tools and versions already exist on the cluster, so Spack can use those instead of building everything again.Create a packages.yaml file under: `$HOME/.spack/packages.yaml`
243+
Spack allows users to control how software is built using the`packages.yaml` configuration file. This enables users to choose preferred implementations for virtual dependencies (like MPI or BLAS/LAPACK), choose particular compilers, and even configure Spack to use external installed software that are already available on the system while avoiding the need to rebuild everything from source.<a href="https://spack.readthedocs.io/en/latest/packages_yaml.html#package-settings-packages-yaml" target="_blank">[2]</a> </p>Create a `packages.yaml` file under: `$HOME/.spack/packages.yaml`
244+
78245

79246
``` { .sh .copy }
80247
touch $HOME/.spack/packages.yaml

mkdocs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,9 @@ markdown_extensions:
418418
social_url_shorthand: true
419419
- pymdownx.snippets:
420420
base_path: snippets
421-
- pymdownx.tabbed
421+
422+
- pymdownx.tabbed:
423+
alternate_style: true
422424
- pymdownx.smartsymbols
423425
# code blocks with syntax highlighting, graphs
424426
- pymdownx.superfences

0 commit comments

Comments
 (0)