|
| 1 | +[](){#ref-porting} |
| 2 | +# Porting recipes to Spack 1.0 |
| 3 | + |
| 4 | +This guide covers the main differences between version 1 and version 2 of the Stackinator recipe format. |
| 5 | +Follow it to update uenv recipes that were created for Spack v0.23 and earlier to target Spack 1.0 using Stackinator 6. |
| 6 | + |
| 7 | +## `config.yaml` |
| 8 | + |
| 9 | +First, add `version: 2` as a specification in the config.yaml file to tell Stackinator that the recipe is in the new format. |
| 10 | + |
| 11 | +Spack 1.0 moved the `builtin` package definition repository from the Spack main repository to its own standard location, which is now versioned separately. |
| 12 | +This change is reflected in the config file |
| 13 | + |
| 14 | +!!! example |
| 15 | + === "Stackinator 5" |
| 16 | + |
| 17 | + ```yaml title="config.yaml" |
| 18 | + name: prgenv-gnu |
| 19 | + store: /user-environment |
| 20 | + spack: |
| 21 | + repo: https://github.com/spack/spack.git |
| 22 | + commit: releases/v0.23 |
| 23 | + modules: true |
| 24 | + description: "HPC development tools for building MPI applications with the GNU compiler toolchain" |
| 25 | + ``` |
| 26 | + |
| 27 | + |
| 28 | + === "Stackinator 6" |
| 29 | + |
| 30 | + ```yaml title="config.yaml" |
| 31 | + name: prgenv-gnu |
| 32 | + store: /user-environment |
| 33 | + spack: |
| 34 | + repo: https://github.com/spack/spack.git |
| 35 | + commit: releases/v1.0 |
| 36 | + packages: # (1) |
| 37 | + repo: https://github.com/spack/spack-packages.git |
| 38 | + commit: releases/v2025.07 |
| 39 | + modules: true |
| 40 | + description: "HPC development tools for building MPI applications with the GNU compiler toolchain" |
| 41 | + version: 2 # (2) |
| 42 | + ``` |
| 43 | + |
| 44 | + 1. the `packages` field is new. |
| 45 | + 1. don't forget to specify version 2. |
| 46 | + |
| 47 | +## `compilers.yaml` |
| 48 | + |
| 49 | +The format of the `compilers.yaml` file has been simplified, and support for llvm has been added. |
| 50 | + |
| 51 | +There is no bootstrap compiler, and only a single version of `gcc`, `nvhpc` or `llvm` is allowed. |
| 52 | +Because of this, the compiler description is greatly streamlined. |
| 53 | + |
| 54 | +!!! example "a gcc based uenv" |
| 55 | + This uenv uses `gcc@13` as the only compiler. |
| 56 | + |
| 57 | + === "Stackinator 5" |
| 58 | + |
| 59 | + ```yaml title="compilers.yaml" |
| 60 | + bootstrap: |
| 61 | + spec: gcc@12.3 |
| 62 | + gcc: |
| 63 | + specs: |
| 64 | + - gcc@13 |
| 65 | + ``` |
| 66 | + |
| 67 | + |
| 68 | + === "Stackinator 6" |
| 69 | + |
| 70 | + ```yaml title="compilers.yaml" |
| 71 | + gcc: |
| 72 | + version: "13" |
| 73 | + ``` |
| 74 | + |
| 75 | +!!! example "a gcc and nvhpc based uenv" |
| 76 | + This uenv uses `gcc@13` and `nvhpc@25.1`. |
| 77 | + |
| 78 | + === "Stackinator 5" |
| 79 | + |
| 80 | + ```yaml title="compilers.yaml" |
| 81 | + bootstrap: |
| 82 | + spec: gcc@12.3 |
| 83 | + gcc: |
| 84 | + specs: |
| 85 | + - gcc@13.2 |
| 86 | + llvm: |
| 87 | + requires: gcc@13 |
| 88 | + specs: |
| 89 | + - nvhpc@25.1 |
| 90 | + ``` |
| 91 | + |
| 92 | + === "Stackinator 6" |
| 93 | + |
| 94 | + ```yaml title="compilers.yaml" |
| 95 | + gcc: |
| 96 | + version: "13" |
| 97 | + nvhpc: |
| 98 | + version: "25.1" |
| 99 | + ``` |
| 100 | + |
| 101 | +## `environments.yaml` |
| 102 | + |
| 103 | +The main change in `environments.yaml` is how the compiler toolchain is specified. |
| 104 | +The compilers are provided as a list, without version information. |
| 105 | + |
| 106 | +!!! example "a gcc based uenv" |
| 107 | + This uenv uses `gcc@13` as the only compiler. |
| 108 | + |
| 109 | + === "Stackinator 5" |
| 110 | + |
| 111 | + ```yaml title="environments.yaml" |
| 112 | + compiler: |
| 113 | + - toolchain: gcc |
| 114 | + spec: gcc |
| 115 | + ``` |
| 116 | + |
| 117 | + === "Stackinator 6" |
| 118 | + |
| 119 | + ```yaml title="environments.yaml" |
| 120 | + compiler: [gcc] |
| 121 | + ``` |
| 122 | + |
| 123 | +!!! example "a gcc and nvhpc based uenv" |
| 124 | + This uenv uses `gcc@13` and `nvhpc@25.1`. |
| 125 | + |
| 126 | + === "Stackinator 5" |
| 127 | + |
| 128 | + ```yaml title="environments.yaml" |
| 129 | + compiler: |
| 130 | + - toolchain: gcc |
| 131 | + spec: gcc |
| 132 | + - toolchain: llvm |
| 133 | + spec: nvhpc |
| 134 | + ``` |
| 135 | + |
| 136 | + === "Stackinator 6" |
| 137 | + |
| 138 | + ```yaml title="environments.yaml" |
| 139 | + compiler: [gcc, nvhpc] |
| 140 | + ``` |
| 141 | + |
| 142 | +Avoid specifying the compiler to use for `cray-mpich`, because this conflicts with the new Spack specification format. |
| 143 | + |
| 144 | +!!! example "do not specify compiler to use for cray-mpich" |
| 145 | + This uenv uses `gcc@13` and `nvhpc@25.1`. |
| 146 | + |
| 147 | + === "Stackinator 5" |
| 148 | + |
| 149 | + ```yaml title="environments.yaml" |
| 150 | + mpi: |
| 151 | + spec: cray-mpich@8.1.30%nvhpc |
| 152 | + gpu: cuda |
| 153 | + ``` |
| 154 | + |
| 155 | + === "Stackinator 6" |
| 156 | + |
| 157 | + ```yaml title="environments.yaml" |
| 158 | + mpi: |
| 159 | + spec: cray-mpich@8.1.30 |
| 160 | + gpu: cuda |
| 161 | + ``` |
| 162 | + |
| 163 | +!!! note |
| 164 | + The method for specifying MPI and networking software stacks will be updated to give you more control over how MPI is compiled before Stackinator 6 is released. |
| 165 | + |
| 166 | + Typically you want to install `cray-mpich` with `nvhpc` to support building Fortran applications with the `nvfortran` compiler. |
| 167 | + You can force this by adding `%fortran=nvhpc` to one of the specs in your environment that is compiled with Fortran, e.g. |
| 168 | + ```yaml title="environments.yaml |
| 169 | + specs: |
| 170 | + - hdf5+mpi+hl+fortran %fortran=nvhpc |
| 171 | + ``` |
| 172 | + This will transitively require that `cray-mpich` be installed using `nvhpc`. |
| 173 | + |
| 174 | +## `modules.yaml` |
| 175 | + |
| 176 | +There are no changes required to the modules.yaml definition. |
| 177 | + |
| 178 | +## repo |
| 179 | + |
| 180 | +If your recipe contains custom package definitions in a , you may have to update these to support Spack 1.0. |
| 181 | + |
| 182 | +If the package was based on one from Spack, have a look at the updated package definition for Spack 1.0. |
| 183 | +You can also look at changes that were made to similar custom packages in [alps-uenv](https://github.com/eth-cscs/alps-uenv) recipes when they were updated to Stackinator 6.0 |
0 commit comments