|
| 1 | +# How to Build **spack-stack** at NAS on TOSS5 |
| 2 | + |
| 3 | +This guide documents how to build **spack-stack** on NASA NAS TOSS5 systems. The previous install process used three stages across compute and login nodes, but recent testing shows installation can now be done directly on a compute node. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Table of Contents |
| 8 | + |
| 9 | +- [Overview](#overview) |
| 10 | +- [Machines Required](#machines-required) |
| 11 | +- [Clone spack-stack](#clone-spack-stack) |
| 12 | +- [Obtain an Interactive Compute Node](#obtain-an-interactive-compute-node) |
| 13 | +- [Setup spack-stack](#setup-spack-stack) |
| 14 | +- [Create Environments](#create-environments) |
| 15 | + - [oneAPI - ifx Environment](#oneapi---ifx-environment) |
| 16 | + - [oneAPI - ifort Environment](#oneapi---ifort-environment) |
| 17 | + - [GCC Environment](#gcc-environment) |
| 18 | +- [Activate the Environment](#activate-the-environment) |
| 19 | +- [Concretize the Environment](#concretize-the-environment) |
| 20 | +- [Create Source Cache (LOGIN NODE ONLY)](#create-source-cache-login-node-only) |
| 21 | +- [Pre-Fetch Cargo Dependencies (LOGIN NODE ONLY)](#pre-fetch-cargo-dependencies-login-node-only) |
| 22 | +- [Install Packages (COMPUTE NODE)](#install-packages-compute-node) |
| 23 | +- [Update Module Files](#update-module-files) |
| 24 | +- [Deactivate the Environment](#deactivate-the-environment) |
| 25 | +- [Debugging Package Builds](#debugging-package-builds) |
| 26 | +- [Deprecated: Legacy Three-Step Install](#deprecated-legacy-three-step-install) |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +## Overview |
| 31 | + |
| 32 | +NAS login nodes and compute nodes have different constraints: |
| 33 | + |
| 34 | +- **Login nodes**: |
| 35 | + - Have internet access |
| 36 | + - Limited to **2 processes** |
| 37 | + |
| 38 | +- **Compute nodes** (Turin): |
| 39 | + - No internet access |
| 40 | + - Allow parallel builds |
| 41 | + |
| 42 | +Use login nodes for setup steps that require internet access (e.g., concretization, mirroring sources, pre-fetching Cargo dependencies), then run installation on a compute node. |
| 43 | + |
| 44 | +The install step itself is now a single compute-node command. |
| 45 | + |
| 46 | +--- |
| 47 | + |
| 48 | +## Machines Required |
| 49 | + |
| 50 | +You will need: |
| 51 | + |
| 52 | +- **A login node** |
| 53 | + Used for setup steps that require internet access. |
| 54 | + |
| 55 | +- **A Turin compute node** |
| 56 | + Used for package installation with higher parallelism. |
| 57 | + |
| 58 | +--- |
| 59 | + |
| 60 | +## Clone spack-stack |
| 61 | + |
| 62 | +Use the appropriate branch or tag: |
| 63 | + |
| 64 | +```bash |
| 65 | +git clone --recurse-submodules https://github.com/JCSDA/spack-stack.git -b spack-stack-2.1.0 spack-stack-2.1.0 |
| 66 | +``` |
| 67 | + |
| 68 | +--- |
| 69 | + |
| 70 | +## Obtain an Interactive Compute Node |
| 71 | + |
| 72 | +NAS login nodes allow only **2 processes**, so use: |
| 73 | + |
| 74 | +```bash |
| 75 | +qsub -I -V -X -l select=1:ncpus=128:mpiprocs=128:model=tur_ath -l walltime=12:00:00 -W group_list=s1873 -m b -N Interactive |
| 76 | +``` |
| 77 | + |
| 78 | +This gives a **Turin** compute node for up to 12 hours. |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +## Setup spack-stack |
| 83 | + |
| 84 | +Run on a **login node with internet**: |
| 85 | + |
| 86 | +```bash |
| 87 | +cd spack-stack-2.1.0 |
| 88 | +. setup.sh |
| 89 | +``` |
| 90 | + |
| 91 | +--- |
| 92 | + |
| 93 | +## Create Environments |
| 94 | + |
| 95 | +You only need to create each environment once. |
| 96 | + |
| 97 | +### oneAPI - ifx Environment |
| 98 | + |
| 99 | +```bash |
| 100 | +spack stack create env --name ue-oneapi-2025.3.0 --template unified-dev --site nas-toss5 --compiler=oneapi-2025.3.0 |
| 101 | +cd envs/ue-oneapi-2025.3.0 |
| 102 | +``` |
| 103 | + |
| 104 | +### oneAPI - ifort Environment |
| 105 | + |
| 106 | +```bash |
| 107 | +spack stack create env --name ue-oneapi-2024.2.0 --template unified-dev --site nas-toss5 --compiler=oneapi-2024.2.0 |
| 108 | +cd envs/ue-oneapi-2024.2.0 |
| 109 | +``` |
| 110 | + |
| 111 | +### GCC Environment |
| 112 | + |
| 113 | +```bash |
| 114 | +spack stack create env --name ue-gcc-14.2.1 --template unified-dev --site nas-toss5 --compiler=gcc-14.2.1 |
| 115 | +cd envs/ue-gcc-14.2.1 |
| 116 | +``` |
| 117 | + |
| 118 | +--- |
| 119 | + |
| 120 | +## Activate the Environment |
| 121 | + |
| 122 | +```bash |
| 123 | +spack env activate . |
| 124 | +``` |
| 125 | + |
| 126 | +> **Important:** Run this in *every* terminal where you plan to run Spack commands. |
| 127 | +
|
| 128 | +--- |
| 129 | + |
| 130 | +## Concretize the Environment |
| 131 | + |
| 132 | +Run on a **login node** (internet required for bootstrapping Clingo and other tools): |
| 133 | + |
| 134 | +```bash |
| 135 | +spack concretize 2>&1 | tee log.concretize ; bell |
| 136 | +``` |
| 137 | + |
| 138 | +### Optional `bell` helper |
| 139 | + |
| 140 | +```bash |
| 141 | +bell() { tput bel ; printf "\nFinished at: " ; date; } |
| 142 | +``` |
| 143 | + |
| 144 | +--- |
| 145 | + |
| 146 | +## Create Source Cache (LOGIN NODE ONLY) |
| 147 | + |
| 148 | +This downloads all source tarballs for your environment: |
| 149 | + |
| 150 | +```bash |
| 151 | +spack mirror create -a -d /swbuild/gmao_SIteam/spack-stack/source-cache |
| 152 | +``` |
| 153 | + |
| 154 | +> ⚠️ **Do not run this outside an activated environment.** |
| 155 | +> Otherwise Spack will attempt to mirror **every** known package/version. |
| 156 | +
|
| 157 | +--- |
| 158 | + |
| 159 | +## Pre-Fetch Cargo Dependencies (LOGIN NODE ONLY) |
| 160 | + |
| 161 | +Rust packages frequently require network access during build. Pre-fetch their dependencies: |
| 162 | + |
| 163 | +```bash |
| 164 | +export CARGO_HOME=/swbuild/gmao_SIteam/spack-stack/cargo-cache |
| 165 | +../../util/fetch_cargo_deps.py |
| 166 | +``` |
| 167 | + |
| 168 | +> ⚠️ **Set `CARGO_HOME` on compute nodes** before running `spack install`. |
| 169 | +
|
| 170 | +--- |
| 171 | + |
| 172 | +## Install Packages (COMPUTE NODE) |
| 173 | + |
| 174 | +Run installation on a **compute node**: |
| 175 | + |
| 176 | +```bash |
| 177 | +export CARGO_HOME=/swbuild/gmao_SIteam/spack-stack/cargo-cache |
| 178 | +spack install -j 16 --verbose --fail-fast --show-log-on-error --no-check-signature 2>&1 | tee log.install ; bell |
| 179 | +``` |
| 180 | + |
| 181 | +This replaces the former compute → login → compute install sequence. |
| 182 | + |
| 183 | +> **Note:** You may need to re-run this command multiple times. Some builds fail intermittently but succeed on retry. |
| 184 | +
|
| 185 | +--- |
| 186 | + |
| 187 | +## Update Module Files |
| 188 | + |
| 189 | +After installation completes, run: |
| 190 | + |
| 191 | +```bash |
| 192 | +spack module tcl refresh -y --delete-tree ; bell |
| 193 | +spack stack setup-meta-modules |
| 194 | +``` |
| 195 | + |
| 196 | +--- |
| 197 | + |
| 198 | +## Deactivate the Environment |
| 199 | + |
| 200 | +```bash |
| 201 | +spack env deactivate |
| 202 | +``` |
| 203 | + |
| 204 | +--- |
| 205 | + |
| 206 | +## Debugging Package Builds |
| 207 | + |
| 208 | +```bash |
| 209 | +spack clean |
| 210 | +spack stage <package> |
| 211 | +spack build-env <package> -- bash --norc --noprofile |
| 212 | +``` |
| 213 | + |
| 214 | +This drops you into a clean build environment with the package’s full compiler/runtime environment loaded. |
| 215 | + |
| 216 | +--- |
| 217 | + |
| 218 | +## Deprecated: Legacy Three-Step Install |
| 219 | + |
| 220 | +> ⚠️ **Deprecated:** Keep this only as historical reference. Prefer the single compute-node install above. |
| 221 | +
|
| 222 | +Older workflows used three stages: |
| 223 | + |
| 224 | +1. Compute node: build dependencies for Rust-related Python packages and ecFlow. |
| 225 | +2. `athfe` login node: build `py-cryptography`, `py-maturin`, `py-rpds-py`, and `ecflow` with `-j 2`. |
| 226 | +3. Compute node: run full `spack install` to finish remaining packages. |
| 227 | + |
| 228 | +Typical commands were: |
| 229 | + |
| 230 | +```bash |
| 231 | +# Step 1 (compute node) |
| 232 | +export CARGO_HOME=/swbuild/gmao_SIteam/spack-stack/cargo-cache |
| 233 | +spack install -j 16 --verbose --fail-fast --show-log-on-error --no-check-signature \ |
| 234 | + --only dependencies py-cryptography py-maturin py-rpds-py ecflow 2>&1 | tee log.install.deps-for-rust-and-ecflow ; bell |
| 235 | + |
| 236 | +# Step 2 (athfe login node) |
| 237 | +export CARGO_HOME=/swbuild/gmao_SIteam/spack-stack/cargo-cache |
| 238 | +spack install -j 2 -p 1 --verbose --fail-fast --show-log-on-error --no-check-signature \ |
| 239 | + py-cryptography py-maturin py-rpds-py ecflow 2>&1 | tee log.install.rust-and-ecflow ; bell |
| 240 | + |
| 241 | +# Step 3 (compute node) |
| 242 | +export CARGO_HOME=/swbuild/gmao_SIteam/spack-stack/cargo-cache |
| 243 | +spack install -j 16 --verbose --fail-fast --show-log-on-error --no-check-signature 2>&1 | tee log.install.after-cargo ; bell |
| 244 | +``` |
| 245 | + |
| 246 | +--- |
0 commit comments