diff --git a/03_building_and_packaging/spack_demo.md b/03_building_and_packaging/spack_demo.md index 842eb301..d5080a2f 100644 --- a/03_building_and_packaging/spack_demo.md +++ b/03_building_and_packaging/spack_demo.md @@ -7,11 +7,12 @@ - Git repository of Python scripts ```bash - git clone -b releases/v0.19 https://github.com/spack/spack.git + git clone -b v0.23.0 -c feature.manyFiles=true --depth=2 https://github.com/spack/spack.git ``` - - `v0.19` is currently the latest release - - Update to newer versions using `git pull`/`git checkout -b` + - `v0.23.0` is currently the latest major release + +- **Note:** Install `curl`, `libcurl4-openssl-dev`, and `vim` to ensure that Spack v0.23.0 works in a fresh Ubuntu Jammy container. - Initializing Spack with @@ -159,6 +160,14 @@ We see that `cmake` is an implicit dependency as we need it for building our package. +- If the same Docker container as in step 2 is used, make sure to uninstall `zlib` before installing `helloworld`. + +- Make sure Spack finds external packages that `HelloWorld` needs + + ```bash + spack external find + ``` + - Install package ```bash @@ -187,29 +196,29 @@ This will concretize (internally, i.e. no output on terminal) and then build the software. +- If one wants to edit the package later, there are two options + + ```bash + spack edit helloworld + ``` + + or open `package.py` file in `${HOME}/var/spack/repos/builtin/packages/helloworld/` + - **Optional**: one could add `main` branch and thus GitHub repository ```diff + git = "https://github.com/Simulation-Software-Engineering/HelloWorld.git" + - + version('main', branch='main') + + version("main", branch="main") ``` 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. -- If one wants to edit the package later, there are two options - - ```bash - spack edit helloworld - ``` - - or open `package.py` file in `${HOME}/var/spack/repos/builtin/packages/helloworld/` - - Add artificial dependencies ```diff - + depends_on('python@3:', when='@0.3.0:') - + depends_on('zlib@:1.2') + + depends_on("python@3:", when="@0.3.0:") + + depends_on("zlib@:1.2") ``` 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 @@ - Add an artificial variant ```diff - + variant('python', default=True, description='Enable Python support') - - depends_on('python@3:', when='@0.3.0:') - + depends_on('python@3:', when='@0.3.0:+python') + - depends_on("python@3:", when="@0.3.0:") + + variant("python", default=True, description="Enable Python support") + + depends_on("python@3:", when="@0.3.0:+python") ``` and check its existence @@ -246,7 +255,7 @@ `~` can be (often) used instead of `-`. There are [examples in the documentation](https://spack.readthedocs.io/en/latest/basic_usage.html#variants). -## Further reading +## Further material ### References diff --git a/03_building_and_packaging/spack_exercise.md b/03_building_and_packaging/spack_exercise.md index d567acf7..52db87a5 100644 --- a/03_building_and_packaging/spack_exercise.md +++ b/03_building_and_packaging/spack_exercise.md @@ -4,11 +4,11 @@ This exercise is about packaging code with Spack. We work with a simplified vers At the end of the exercise you find a section with hints and remarks. Make sure to check this section. -Deadline: **Thursday, December 15th, 2022, 9:00** +Deadline: **Wednesday, December 4th, 2024, 09:00** ## Creation of a Spack Package -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`. +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`. 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. @@ -24,7 +24,7 @@ Create a Spack package for all releases of the given code and make sure that the ### Development/Packaging Environment -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. +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. ### Packaging Steps diff --git a/03_building_and_packaging/spack_slides.md b/03_building_and_packaging/spack_slides.md index ef50a6cd..c529f4ed 100644 --- a/03_building_and_packaging/spack_slides.md +++ b/03_building_and_packaging/spack_slides.md @@ -38,9 +38,9 @@ slideOptions: ## Learning goals -- What are the challenges when bringing (your) software to supercomputers? -- How to use Spack to install software. -- How to create a Spack package for your own software. +- Understand the challenges when bringing (your) software to supercomputers. +- Use Spack to install software. +- Create a Spack package for your own software. --- @@ -104,7 +104,7 @@ slideOptions: - Steps: 1. Install and configure Spack 2. Learn how to use Spack for package management and installation - 3. Create a Spack package for our HelloWorld code + 3. Create a Spack package for a HelloWorld code - Code is on [GitHub](https://github.com/Simulation-Software-Engineering/HelloWorld) --- @@ -112,16 +112,15 @@ slideOptions: ## Spack Installation - Dependencies: Python, Git, C/C++ compiler, patch, make, tar... - - Basically `build-essentials`, `git`, and `python` on Ubuntu + - Basically `build-essential`, `git`, and `python` on Ubuntu - May be old, install newer versions with Spack if needed - Installation in user-writable location ```bash - git clone -b releases/v0.19 https://github.com/spack/spack.git + git clone -b v0.23.0 -c feature.manyFiles=true --depth=2 https://github.com/spack/spack.git ``` - - `v0.19` is currently the latest release - - Update to newer versions using `git pull`/`git checkout -b` + - `v0.23.0` is currently the latest major release ---