Skip to content

Commit c925136

Browse files
authored
Update Spack lecture, demo notes, and exercise (#206)
* Update Spack version and installation commands * Add notes for installing curl manually to the Spack demo * Update Spack demo notes * Update Spack exercise
1 parent 07d6f71 commit c925136

File tree

3 files changed

+37
-29
lines changed

3 files changed

+37
-29
lines changed

03_building_and_packaging/spack_demo.md

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
- Git repository of Python scripts
88

99
```bash
10-
git clone -b releases/v0.19 https://github.com/spack/spack.git
10+
git clone -b v0.23.0 -c feature.manyFiles=true --depth=2 https://github.com/spack/spack.git
1111
```
1212

13-
- `v0.19` is currently the latest release
14-
- Update to newer versions using `git pull`/`git checkout -b`
13+
- `v0.23.0` is currently the latest major release
14+
15+
- **Note:** Install `curl`, `libcurl4-openssl-dev`, and `vim` to ensure that Spack v0.23.0 works in a fresh Ubuntu Jammy container.
1516

1617
- Initializing Spack with
1718

@@ -159,6 +160,14 @@
159160

160161
We see that `cmake` is an implicit dependency as we need it for building our package.
161162

163+
- If the same Docker container as in step 2 is used, make sure to uninstall `zlib` before installing `helloworld`.
164+
165+
- Make sure Spack finds external packages that `HelloWorld` needs
166+
167+
```bash
168+
spack external find
169+
```
170+
162171
- Install package
163172

164173
```bash
@@ -187,29 +196,29 @@
187196

188197
This will concretize (internally, i.e. no output on terminal) and then build the software.
189198

199+
- If one wants to edit the package later, there are two options
200+
201+
```bash
202+
spack edit helloworld
203+
```
204+
205+
or open `package.py` file in `${HOME}/var/spack/repos/builtin/packages/helloworld/`
206+
190207
- **Optional**: one could add `main` branch and thus GitHub repository
191208

192209
```diff
193210
+ git = "https://github.com/Simulation-Software-Engineering/HelloWorld.git"
194211
+
195-
+ version('main', branch='main')
212+
+ version("main", branch="main")
196213
```
197214

198215
This can also be used for `develop` branches etc. It is useful if one needs really the newest version of a package or if one develops software using Spack.
199216

200-
- If one wants to edit the package later, there are two options
201-
202-
```bash
203-
spack edit helloworld
204-
```
205-
206-
or open `package.py` file in `${HOME}/var/spack/repos/builtin/packages/helloworld/`
207-
208217
- Add artificial dependencies
209218

210219
```diff
211-
+ depends_on('python@3:', when='@0.3.0:')
212-
+ depends_on('zlib@:1.2')
220+
+ depends_on("python@3:", when="@0.3.0:")
221+
+ depends_on("zlib@:1.2")
213222
```
214223

215224
This means that the package depends on Python `3.0.0` or newer and newer if we use `helloworld` of version `0.3.0` or newer. The software also requires at most `zlib` in version `1.2.10`
@@ -227,9 +236,9 @@
227236
- Add an artificial variant
228237

229238
```diff
230-
+ variant('python', default=True, description='Enable Python support')
231-
- depends_on('python@3:', when='@0.3.0:')
232-
+ depends_on('python@3:', when='@0.3.0:+python')
239+
- depends_on("python@3:", when="@0.3.0:")
240+
+ variant("python", default=True, description="Enable Python support")
241+
+ depends_on("python@3:", when="@0.3.0:+python")
233242
```
234243

235244
and check its existence
@@ -246,7 +255,7 @@
246255

247256
`~` can be (often) used instead of `-`. There are [examples in the documentation](https://spack.readthedocs.io/en/latest/basic_usage.html#variants).
248257

249-
## Further reading
258+
## Further material
250259

251260
### References
252261

03_building_and_packaging/spack_exercise.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ This exercise is about packaging code with Spack. We work with a simplified vers
44

55
At the end of the exercise you find a section with hints and remarks. Make sure to check this section.
66

7-
Deadline: **Thursday, December 15th, 2022, 9:00**
7+
Deadline: **Wednesday, December 4th, 2024, 09:00**
88

99
## Creation of a Spack Package
1010

11-
We want to package the [Spack example code on GitHub](https://github.com/Simulation-Software-Engineering/spack-exercise). It is an adapted version of the previous week's exercise again. The `deal.ii` dependency has been removed as compiling `deal.ii` from scratch takes too long. Additionally, several releases with different dependencies have been added. The code in the repository creates an executable that is called `spackexample`. It also creates a library `libspackexamplelib` (what a name) which is needed to run `spackexample`.
11+
We want to package the [Spack example code on GitHub](https://github.com/Simulation-Software-Engineering/spack-exercise). It is an adapted version of the last week's exercise. The `deal.ii` dependency has been removed as compiling `deal.ii` from scratch takes too long. Additionally, several releases with different dependencies have been added. The code in the repository creates an executable that is called `spackexample`. It also creates a library `libspackexamplelib` (what a name) which is needed to run `spackexample`.
1212

1313
The default name of your Spack package is `spack-exercise`. The Spack package should create the executable `spackexample` and the corresponding library `libspackexamplelib` mentioned above. Under normal circumstances you do not need to edit the CMake configuration for this exercise.
1414

@@ -24,7 +24,7 @@ Create a Spack package for all releases of the given code and make sure that the
2424

2525
### Development/Packaging Environment
2626

27-
Please do all the development inside a Docker container. The Docker container is based on the image built from the recipe provided in the [exercise repository](https://github.com/Simulation-Software-Engineering/spack-exercise). You can find the recipe of the image inside the `docker/` directory of [the example code on GitHub](https://github.com/Simulation-Software-Engineering/spack-exercise). The image itself is based on Ubuntu 20.04 and has the Boost dependency preinstalled. Additionally, Spack has been set up in the recipe. Two editors `vim` and `nano` preinstalled. If you want to install further software in your container you are free to do so.
27+
Please do all the development inside a Docker container. The Docker container is based on the image built from the recipe provided in the [exercise repository](https://github.com/Simulation-Software-Engineering/spack-exercise). You can find the recipe of the image inside the `docker/` directory. The image itself is based on Ubuntu 20.04 and has the Boost dependency preinstalled. Additionally, Spack has been set up in the recipe. Two editors `vim` and `nano` are preinstalled. If you want to install further software in your container you are free to do so.
2828

2929
### Packaging Steps
3030

03_building_and_packaging/spack_slides.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ slideOptions:
3838

3939
## Learning goals
4040

41-
- What are the challenges when bringing (your) software to supercomputers?
42-
- How to use Spack to install software.
43-
- How to create a Spack package for your own software.
41+
- Understand the challenges when bringing (your) software to supercomputers.
42+
- Use Spack to install software.
43+
- Create a Spack package for your own software.
4444

4545
---
4646

@@ -104,24 +104,23 @@ slideOptions:
104104
- Steps:
105105
1. Install and configure Spack
106106
2. Learn how to use Spack for package management and installation
107-
3. Create a Spack package for our HelloWorld code
107+
3. Create a Spack package for a HelloWorld code
108108
- Code is on [GitHub](https://github.com/Simulation-Software-Engineering/HelloWorld)
109109

110110
---
111111

112112
## Spack Installation
113113

114114
- Dependencies: Python, Git, C/C++ compiler, patch, make, tar...
115-
- Basically `build-essentials`, `git`, and `python` on Ubuntu
115+
- Basically `build-essential`, `git`, and `python` on Ubuntu
116116
- May be old, install newer versions with Spack if needed
117117
- Installation in user-writable location
118118

119119
```bash
120-
git clone -b releases/v0.19 https://github.com/spack/spack.git
120+
git clone -b v0.23.0 -c feature.manyFiles=true --depth=2 https://github.com/spack/spack.git
121121
```
122122

123-
- `v0.19` is currently the latest release
124-
- Update to newer versions using `git pull`/`git checkout -b`
123+
- `v0.23.0` is currently the latest major release
125124

126125
---
127126

0 commit comments

Comments
 (0)