From 5d7a32f654eda97cd5a3d2596ebabed55a4dd6f1 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 14 Apr 2026 08:06:24 -0400 Subject: [PATCH 01/39] Updates for geos testing --- configs/sites/tier1/discover-gmao/config.yaml | 2 + .../sites/tier1/discover-gmao/mirrors.yaml | 18 + .../sites/tier1/discover-gmao/modules.yaml | 4 + .../sites/tier1/discover-gmao/packages.yaml | 144 ++++ .../discover-gmao/packages_gcc-13.4.0.yaml | 29 + .../packages_oneapi-2024.2.0.yaml | 57 ++ .../packages_oneapi-2025.3.0.yaml | 54 ++ configs/sites/tier2/alderaan/README.md | 182 +++++ configs/sites/tier2/alderaan/config.yaml | 3 + configs/sites/tier2/alderaan/mirrors.yaml | 3 + configs/sites/tier2/alderaan/modules.yaml | 18 + configs/sites/tier2/alderaan/packages.yaml | 101 +++ .../tier2/alderaan/packages_clang-22.1.3.yaml | 25 + .../tier2/alderaan/packages_gcc-15.2.0.yaml | 25 + configs/sites/tier2/alderaan/toolchains.yaml | 29 + configs/templates/geos-dev/spack.yaml | 21 + util/gmao/batch_install.sh | 680 ++++++++++++++++++ 17 files changed, 1395 insertions(+) create mode 100644 configs/sites/tier1/discover-gmao/config.yaml create mode 100644 configs/sites/tier1/discover-gmao/mirrors.yaml create mode 100644 configs/sites/tier1/discover-gmao/modules.yaml create mode 100644 configs/sites/tier1/discover-gmao/packages.yaml create mode 100644 configs/sites/tier1/discover-gmao/packages_gcc-13.4.0.yaml create mode 100644 configs/sites/tier1/discover-gmao/packages_oneapi-2024.2.0.yaml create mode 100644 configs/sites/tier1/discover-gmao/packages_oneapi-2025.3.0.yaml create mode 100644 configs/sites/tier2/alderaan/README.md create mode 100644 configs/sites/tier2/alderaan/config.yaml create mode 100644 configs/sites/tier2/alderaan/mirrors.yaml create mode 100644 configs/sites/tier2/alderaan/modules.yaml create mode 100644 configs/sites/tier2/alderaan/packages.yaml create mode 100644 configs/sites/tier2/alderaan/packages_clang-22.1.3.yaml create mode 100644 configs/sites/tier2/alderaan/packages_gcc-15.2.0.yaml create mode 100644 configs/sites/tier2/alderaan/toolchains.yaml create mode 100644 configs/templates/geos-dev/spack.yaml create mode 100755 util/gmao/batch_install.sh diff --git a/configs/sites/tier1/discover-gmao/config.yaml b/configs/sites/tier1/discover-gmao/config.yaml new file mode 100644 index 000000000..7e559f33f --- /dev/null +++ b/configs/sites/tier1/discover-gmao/config.yaml @@ -0,0 +1,2 @@ +config: + build_jobs: 6 diff --git a/configs/sites/tier1/discover-gmao/mirrors.yaml b/configs/sites/tier1/discover-gmao/mirrors.yaml new file mode 100644 index 000000000..596a615bf --- /dev/null +++ b/configs/sites/tier1/discover-gmao/mirrors.yaml @@ -0,0 +1,18 @@ +mirrors: + local-source: + fetch: + url: file:///discover/swdev/jcsda/spack-stack/source-cache + access_pair: + - null + - null + access_token: null + profile: null + endpoint_url: null + push: + url: file:///discover/swdev/jcsda/spack-stack/source-cache + access_pair: + - null + - null + access_token: null + profile: null + endpoint_url: null diff --git a/configs/sites/tier1/discover-gmao/modules.yaml b/configs/sites/tier1/discover-gmao/modules.yaml new file mode 100644 index 000000000..4e9771f38 --- /dev/null +++ b/configs/sites/tier1/discover-gmao/modules.yaml @@ -0,0 +1,4 @@ +modules: + default: + enable:: + - lmod diff --git a/configs/sites/tier1/discover-gmao/packages.yaml b/configs/sites/tier1/discover-gmao/packages.yaml new file mode 100644 index 000000000..7363aa96d --- /dev/null +++ b/configs/sites/tier1/discover-gmao/packages.yaml @@ -0,0 +1,144 @@ +packages: +### Modification of common packages + # Problems building shared hdf-eos2 with Intel, not needed + hdf-eos2: + variants: ~shared + met: + variants: +python +grib2 +graphics +lidar2nc +modis + zlib-api: + buildable: False +### All other external packages listed alphabetically + autoconf: + externals: + - spec: autoconf@2.69 + prefix: /usr + automake: + externals: + - spec: automake@1.15.1 + prefix: /usr + binutils: + externals: + - spec: binutils@2.41.0 + prefix: /usr + bison: + externals: + - spec: bison@3.0.4 + prefix: /usr + ccache: + externals: + - spec: ccache@3.4.2 + prefix: /usr + cmake: + externals: + - spec: cmake@3.28.2 + prefix: /usr/local/other/cmake/3.28.2 + coreutils: + externals: + - spec: coreutils@8.32 + prefix: /usr + curl: + externals: + - spec: curl@8.0.1+gssapi+ldap+nghttp2 + prefix: /usr + cvs: + externals: + - spec: cvs@1.12.13 + prefix: /usr + diffutils: + externals: + - spec: diffutils@3.6 + prefix: /usr + findutils: + externals: + - spec: findutils@4.8.0 + prefix: /usr + flex: + externals: + - spec: flex@2.6.4+lex + prefix: /usr + gawk: + externals: + - spec: gawk@4.2.1 + prefix: /usr + gettext: + externals: + - spec: gettext@0.20.2 + prefix: /usr + git: + externals: + - spec: git@2.35.3+tcltk + prefix: /usr + - spec: git@2.42.0+tcltk + prefix: /usr/local/other/git/2.42.0/gcc-7.5.0 + modules: + - git/2.42.0 + # DH* + #- spec: git@2.42.0~tcltk + # prefix: /usr/local/other/git/2.42.0/gcc-7.5.0/libexec/git-core + # modules: + # - git/2.42.0 + git-lfs: + externals: + - spec: git-lfs@3.4.0 + prefix: /usr/local/other/git-lfs/3.4.0 + gmake: + externals: + - spec: gmake@4.2.1 + prefix: /usr + grep: + externals: + - spec: grep@3.1 + prefix: /usr + groff: + externals: + - spec: groff@1.22.4 + prefix: /usr + libtool: + externals: + - spec: libtool@2.4.6 + prefix: /usr + m4: + externals: + - spec: m4@1.4.18 + prefix: /usr + openssh: + externals: + - spec: openssh@8.4p1 + prefix: /usr + openssl: + externals: + - spec: openssl@1.1.1l + prefix: /usr + perl: + externals: + - spec: perl@5.26.1~cpanm+opcode+open+shared+threads + prefix: /usr + pkg-config: + externals: + - spec: pkg-config@0.29.2 + prefix: /usr + qt: + buildable: False + externals: + - spec: qt@5.15.10 + prefix: /usr/local/other/xpdf/4.04/Deps + sed: + externals: + - spec: sed@4.4 + prefix: /usr + subversion: + externals: + - spec: subversion@1.14.1 + prefix: /usr + swig: + externals: + - spec: swig@3.0.12 + prefix: /usr + tar: + externals: + - spec: tar@1.34 + prefix: /usr + texinfo: + externals: + - spec: texinfo@6.5 + prefix: /usr diff --git a/configs/sites/tier1/discover-gmao/packages_gcc-13.4.0.yaml b/configs/sites/tier1/discover-gmao/packages_gcc-13.4.0.yaml new file mode 100644 index 000000000..3e3c1c113 --- /dev/null +++ b/configs/sites/tier1/discover-gmao/packages_gcc-13.4.0.yaml @@ -0,0 +1,29 @@ +packages: + all: + require: + - any_of: ['%gcc@=13.4.0'] + when: '%gcc' + mpi: + buildable: false + require: + - "openmpi@4.1.6" + gcc: + buildable: false + externals: + - spec: gcc@13.4.0 languages:='c,c++,fortran' + prefix: /discover/swdev/gmao_SIteam/other/SLES15.4/GCC/13.4.0 + modules: + - comp/gcc/13.4.0 + extra_attributes: + compilers: + c: /discover/swdev/gmao_SIteam/other/SLES15.4/GCC/13.4.0/bin/gcc + cxx: /discover/swdev/gmao_SIteam/other/SLES15.4/GCC/13.4.0/bin/g++ + fortran: /discover/swdev/gmao_SIteam/other/SLES15.4/GCC/13.4.0/bin/gfortran + openmpi: + buildable: false + externals: + - spec: openmpi@4.1.6 ~cuda~cxx~cxx_exceptions~java~memchecker+pmi~static~wrapper-rpath + fabrics=ucx schedulers=slurm + prefix: /discover/swdev/gmao_SIteam/MPI/openmpi/4.1.6-SLES15/gcc-13.4.0 + modules: + - mpi/openmpi/4.1.6/gcc-13.4.0 diff --git a/configs/sites/tier1/discover-gmao/packages_oneapi-2024.2.0.yaml b/configs/sites/tier1/discover-gmao/packages_oneapi-2024.2.0.yaml new file mode 100644 index 000000000..637a42388 --- /dev/null +++ b/configs/sites/tier1/discover-gmao/packages_oneapi-2024.2.0.yaml @@ -0,0 +1,57 @@ +packages: + all: + require: + - any_of: ['%intel-oneapi-compilers@=2024.2.0'] + when: '%intel-oneapi-compilers' + - any_of: ['%gcc@=12.3.0'] + when: '%gcc' + mpi: + buildable: false + require: + - "intel-oneapi-mpi@2021.13" + intel-oneapi-compilers: + buildable: false + externals: + - spec: intel-oneapi-compilers@2024.2.0 + prefix: /usr/local/intel/oneapi/2024 + modules: + - comp/intel/2024.2.0 + extra_attributes: + compilers: + c: /usr/local/intel/oneapi/2024/compiler/2024.2/bin/icx + cxx: /usr/local/intel/oneapi/2024/compiler/2024.2/bin/icpx + fortran: /usr/local/intel/oneapi/2024/compiler/2024.2/bin/ifort + environment: + set: + # Force ifort not ifx + INTEL_COMPILER_TYPE: 'RECOMMENDED' + prepend_path: + PATH: /usr/local/other/gcc/12.3.0/bin + CPATH: /usr/local/other/gcc/12.3.0/include + LD_LIBRARY_PATH: '/usr/local/intel/oneapi/2024/compiler/2024.2/lib/:/usr/local/other/gcc/12.3.0/lib64' + extra_rpaths: + - /usr/local/other/gcc/12.3.0/lib64 + - /usr/local/other/gcc/12.3.0/lib + gcc: + buildable: false + externals: + - spec: gcc@12.3.0 languages:='c,c++' + prefix: /usr/local/other/gcc/12.3.0 + modules: + - comp/gcc/12.3.0 + extra_attributes: + compilers: + c: /usr/local/other/gcc/12.3.0/bin/gcc + cxx: /usr/local/other/gcc/12.3.0/bin/g++ + fortran: /usr/local/other/gcc/12.3.0/bin/gfortran + intel-oneapi-mpi: + externals: + - spec: intel-oneapi-mpi@2021.13 + prefix: /usr/local/intel/oneapi/2024 + modules: + - mpi/impi/2021.13 + intel-oneapi-mkl: + buildable: false + externals: + - spec: intel-oneapi-mkl@2024.2.0 + prefix: /usr/local/intel/oneapi/2024 diff --git a/configs/sites/tier1/discover-gmao/packages_oneapi-2025.3.0.yaml b/configs/sites/tier1/discover-gmao/packages_oneapi-2025.3.0.yaml new file mode 100644 index 000000000..e8ec1d441 --- /dev/null +++ b/configs/sites/tier1/discover-gmao/packages_oneapi-2025.3.0.yaml @@ -0,0 +1,54 @@ +packages: + all: + require: + - any_of: ['%intel-oneapi-compilers@=2025.3.0'] + when: '%intel-oneapi-compilers' + - any_of: ['%gcc@=12.3.0'] + when: '%gcc' + mpi: + buildable: false + require: + - "intel-oneapi-mpi@2021.17" + intel-oneapi-compilers: + buildable: false + externals: + - spec: intel-oneapi-compilers@2025.3.0 + prefix: /usr/local/intel/oneapi/2025 + modules: + - comp/intel/2025.3.0 + extra_attributes: + compilers: + c: /usr/local/intel/oneapi/2025/compiler/2025.3/bin/icx + cxx: //usr/local/intel/oneapi/2025/compiler/2025.3/bin/icpx + fortran: /usr/local/intel/oneapi/2025/compiler/2025.3/bin/ifx + environment: + prepend_path: + PATH: /usr/local/other/gcc/12.3.0/bin + CPATH: /usr/local/other/gcc/12.3.0/include + LD_LIBRARY_PATH: '/usr/local/intel/oneapi/2025/compiler/2025.3/lib/:/usr/local/other/gcc/12.3.0/lib64' + extra_rpaths: + - /usr/local/other/gcc/12.3.0/lib64 + - /usr/local/other/gcc/12.3.0/lib + gcc: + buildable: false + externals: + - spec: gcc@12.3.0 languages:='c,c++' + prefix: /usr/local/other/gcc/12.3.0 + modules: + - comp/gcc/12.3.0 + extra_attributes: + compilers: + c: /usr/local/other/gcc/12.3.0/bin/gcc + cxx: /usr/local/other/gcc/12.3.0/bin/g++ + fortran: /usr/local/other/gcc/12.3.0/bin/gfortran + intel-oneapi-mpi: + externals: + - spec: intel-oneapi-mpi@2021.17 + prefix: /usr/local/intel/oneapi/2025 + modules: + - mpi/impi/2021.17 + intel-oneapi-mkl: + buildable: false + externals: + - spec: intel-oneapi-mkl@2025.3.0 + prefix: /usr/local/intel/oneapi/2025 diff --git a/configs/sites/tier2/alderaan/README.md b/configs/sites/tier2/alderaan/README.md new file mode 100644 index 000000000..26965c9d6 --- /dev/null +++ b/configs/sites/tier2/alderaan/README.md @@ -0,0 +1,182 @@ +Alderaan is one of @mathomp4's development systems (Mac Studio) + +--- + +## Table of Contents + +- [Overview](#overview) +- [Machines Required](#machines-required) +- [Clone spack-stack](#clone-spack-stack) +- [Obtain an Interactive Compute Node](#obtain-an-interactive-compute-node) +- [Setup spack-stack](#setup-spack-stack) +- [Create Environments](#create-environments) + - [oneAPI - ifx Environment](#oneapi---ifx-environment) + - [oneAPI - ifort Environment](#oneapi---ifort-environment) + - [GCC Environment](#gcc-environment) +- [Activate the Environment](#activate-the-environment) +- [Concretize the Environment](#concretize-the-environment) +- [Create Source Cache (LOGIN NODE ONLY)](#create-source-cache-login-node-only) +- [Pre-Fetch Cargo Dependencies (LOGIN NODE ONLY)](#pre-fetch-cargo-dependencies-login-node-only) +- [Install Packages (COMPUTE NODE)](#install-packages-compute-node) +- [Update Module Files](#update-module-files) +- [Deactivate the Environment](#deactivate-the-environment) +- [Debugging Package Builds](#debugging-package-builds) +- [Deprecated: Legacy Three-Step Install](#deprecated-legacy-three-step-install) + +--- + +## Overview + +--- + +## Brew Packages Required + +You must have `brew` installed and the following packages available: + +``` +brew install coreutils +brew install gcc@15 +brew install flang +brew install git +brew install lmod +brew install wget +brew install bash +brew install tcsh +brew install cmake +brew install openssl +brew install rust +``` + +--- + +## Clone spack-stack + +Use the appropriate branch or tag: + +```bash +git clone --recurse-submodules https://github.com/GMAO-SI-Team/spack-stack.git -b geos-testing spack-stack-dev +``` + +--- + +## Setup spack-stack + +```bash +cd spack-stack-dev +. setup.sh +``` + +--- + +## Create Environments + +You only need to create each environment once. + +### GCC Environment + +```bash +spack stack create env --name ge-gcc-15.2.0 --template geos-dev --site alderaan --compiler=gcc-15.2.0 +cd envs/ge-gcc-15.2.0 +``` + +### Flang Environment + +```bash +spack stack create env --name ge-clang-22.1.3 --template geos-dev --site alderaan --compiler=clang-22.1.3 +cd envs/ge-clang-22.1.3 +``` + +--- + +## Activate the Environment + +```bash +spack env activate . +``` + +> **Important:** Run this in *every* terminal where you plan to run Spack commands. + +--- + +## Concretize the Environment + +Run on a **login node** (internet required for bootstrapping Clingo and other tools): + +```bash +spack concretize 2>&1 | tee log.concretize ; bell +``` + +### Optional `bell` helper + +```bash +bell() { tput bel ; printf "\nFinished at: " ; date; } +``` + +--- + +## Create Source Cache + +This downloads all source tarballs for your environment: + +```bash +spack mirror create -a -d /Users/mathomp4/prod/spack-source-mirror +``` + +> ⚠️ **Do not run this outside an activated environment.** +> Otherwise Spack will attempt to mirror **every** known package/version. + +--- + +## Pre-Fetch Cargo Dependencies (LOGIN NODE ONLY) + +Rust packages frequently require network access during build. Pre-fetch their dependencies: + +```bash +export CARGO_HOME=/Users/mathomp4/prod/spack-cargo-mirror +../../util/fetch_cargo_deps.py +``` + +> ⚠️ **Set `CARGO_HOME` before running `spack install`. + +--- + +## Install Packages + +```bash +export CARGO_HOME=/Users/mathomp4/prod/spack-cargo-mirror +spack install -j 6 --verbose --fail-fast --show-log-on-error --no-check-signature 2>&1 | tee log.install ; bell +``` + +> **Note:** You may need to re-run this command multiple times. Some builds fail intermittently but succeed on retry. + +--- + +## Update Module Files + +After installation completes, run: + +```bash +spack module lmod refresh -y --delete-tree ; bell +spack stack setup-meta-modules +``` + +--- + +## Deactivate the Environment + +```bash +spack env deactivate +``` + +--- + +## Debugging Package Builds + +```bash +spack clean +spack stage +spack build-env -- bash --norc --noprofile +``` + +This drops you into a clean build environment with the package’s full compiler/runtime environment loaded. + diff --git a/configs/sites/tier2/alderaan/config.yaml b/configs/sites/tier2/alderaan/config.yaml new file mode 100644 index 000000000..092d39523 --- /dev/null +++ b/configs/sites/tier2/alderaan/config.yaml @@ -0,0 +1,3 @@ +config: + build_jobs: 6 + installer: new diff --git a/configs/sites/tier2/alderaan/mirrors.yaml b/configs/sites/tier2/alderaan/mirrors.yaml new file mode 100644 index 000000000..cfe5bb55b --- /dev/null +++ b/configs/sites/tier2/alderaan/mirrors.yaml @@ -0,0 +1,3 @@ +mirrors: + local-source: file:///Users/mathomp4/prod/spack-source-mirror + local-binary: file:///Users/mathomp4/prod/spack-build-mirror diff --git a/configs/sites/tier2/alderaan/modules.yaml b/configs/sites/tier2/alderaan/modules.yaml new file mode 100644 index 000000000..30063d42f --- /dev/null +++ b/configs/sites/tier2/alderaan/modules.yaml @@ -0,0 +1,18 @@ +modules: + default: + enable:: + - tcl + tcl: + include: + # Compiler modules + - apple-clang + - gcc + - intel-oneapi-compilers + - llvm + # MPI modules + - cray-mpich + - intel-mpi + - intel-oneapi-mpi + - mpich + - mpt + - openmpi diff --git a/configs/sites/tier2/alderaan/packages.yaml b/configs/sites/tier2/alderaan/packages.yaml new file mode 100644 index 000000000..3fe567557 --- /dev/null +++ b/configs/sites/tier2/alderaan/packages.yaml @@ -0,0 +1,101 @@ +packages: + autoconf: + externals: + - spec: autoconf@2.72 + prefix: /Users/mathomp4/.homebrew/brew + automake: + externals: + - spec: automake@1.18.1 + prefix: /Users/mathomp4/.homebrew/brew + bash: + externals: + - spec: bash@5.3.3 + prefix: /Users/mathomp4/.homebrew/brew + cmake: + externals: + - spec: cmake@4.1.1 + prefix: /Users/mathomp4/.homebrew/brew + cvs: + externals: + - spec: cvs@1.12.13 + prefix: /Users/mathomp4/.homebrew/brew + doxygen: + externals: + - spec: doxygen@1.14.0+graphviz~mscgen + prefix: /Users/mathomp4/.homebrew/brew + flex: + externals: + - spec: flex@2.6.4+lex + prefix: /usr + gawk: + externals: + - spec: gawk@5.3.1 + prefix: /Users/mathomp4/.homebrew/brew + git: + externals: + - spec: git@2.51.0+tcltk + prefix: /Users/mathomp4/.homebrew/brew + - spec: git@2.50.1~tcltk + prefix: /usr + git-lfs: + externals: + - spec: git-lfs@3.7.0 + prefix: /Users/mathomp4/.homebrew/brew + groff: + externals: + - spec: groff@1.23.0 + prefix: /Users/mathomp4/.homebrew/brew + libtool: + externals: + - spec: libtool@2.5.4 + prefix: /Users/mathomp4/.homebrew/brew + ninja: + externals: + - spec: ninja@1.13.1 + prefix: /Users/mathomp4/.homebrew/brew + npm: + externals: + - spec: npm@11.6.0 + prefix: /Users/mathomp4/.homebrew/brew + openssh: + externals: + - spec: openssh@9.9p2 + prefix: /usr + perl: + externals: + - spec: perl@5.42.0~cpanm+opcode+open+shared+threads + prefix: /Users/mathomp4/.homebrew/brew + - spec: perl@5.34.1~cpanm+opcode+open+shared+threads + prefix: /usr + pkgconf: + externals: + - spec: pkgconf@2.5.1 + prefix: /Users/mathomp4/.homebrew/brew + rust: + externals: + - spec: rust@1.90.0 + prefix: /Users/mathomp4/.homebrew/brew + extra_attributes: + cargo: /Users/mathomp4/.homebrew/brew/bin/cargo + compilers: + rust: /Users/mathomp4/.homebrew/brew/bin/rustc + subversion: + externals: + - spec: subversion@1.14.5 + prefix: /Users/mathomp4/.homebrew/brew + swig: + externals: + - spec: swig@4.3.1 + prefix: /Users/mathomp4/.homebrew/brew + tar: + externals: + - spec: tar@1.35 + prefix: /Users/mathomp4 + tcsh: + externals: + - spec: tcsh@6.24.16 + prefix: /Users/mathomp4/.homebrew/brew + texinfo: + externals: + - spec: texinfo@7.2 + prefix: /Users/mathomp4/.homebrew/brew diff --git a/configs/sites/tier2/alderaan/packages_clang-22.1.3.yaml b/configs/sites/tier2/alderaan/packages_clang-22.1.3.yaml new file mode 100644 index 000000000..ef8c19c5d --- /dev/null +++ b/configs/sites/tier2/alderaan/packages_clang-22.1.3.yaml @@ -0,0 +1,25 @@ +packages: + c: + require: [apple-clang@17.0.0] + cxx: + require: [apple-clang@17.0.0] + fortran: + require: [llvm@21.1.3 ~clang +flang] + mpi: + require: [openmpi@=5.0.10] + apple-clang: + externals: + - spec: apple-clang@17.0.0 languages:='c,c++' + prefix: /usr + extra_attributes: + compilers: + c: /usr/bin/clang + cxx: /usr/bin/clang++ + llvm: + buildable: False + externals: + - spec: llvm@21.1.3 ~clang +flang languages:='fortran' + prefix: /Users/mathomp4/.homebrew/brew + extra_attributes: + compilers: + fortran: /Users/mathomp4/.homebrew/brew/bin/flang diff --git a/configs/sites/tier2/alderaan/packages_gcc-15.2.0.yaml b/configs/sites/tier2/alderaan/packages_gcc-15.2.0.yaml new file mode 100644 index 000000000..b107f4ebd --- /dev/null +++ b/configs/sites/tier2/alderaan/packages_gcc-15.2.0.yaml @@ -0,0 +1,25 @@ +packages: + c: + require: [apple-clang@17.0.0] + cxx: + require: [apple-clang@17.0.0] + fortran: + require: [gcc@15.2.0] + mpi: + require: [openmpi@=5.0.10] + apple-clang: + externals: + - spec: apple-clang@17.0.0 languages:='c,c++' + prefix: /usr + extra_attributes: + compilers: + c: /usr/bin/clang + cxx: /usr/bin/clang++ + gcc: + buildable: False + externals: + - spec: gcc@15.2.0 languages:='fortran' + prefix: /Users/mathomp4/.homebrew/brew + extra_attributes: + compilers: + fortran: /Users/mathomp4/.homebrew/brew/bin/gfortran-15 diff --git a/configs/sites/tier2/alderaan/toolchains.yaml b/configs/sites/tier2/alderaan/toolchains.yaml new file mode 100644 index 000000000..7b140d268 --- /dev/null +++ b/configs/sites/tier2/alderaan/toolchains.yaml @@ -0,0 +1,29 @@ +toolchains: + apple-gfortran-15: + - spec: "%c=apple-clang" + when: "%c" + - spec: "%cxx=apple-clang" + when: "%cxx" + - spec: "%fortran=gcc@15" + when: "%fortran" + apple-gfortran-14: + - spec: "%c=apple-clang" + when: "%c" + - spec: "%cxx=apple-clang" + when: "%cxx" + - spec: "%fortran=gcc@14" + when: "%fortran" + gcc-gfortran-15: + - spec: "%c=gcc@15" + when: "%c" + - spec: "%cxx=gcc@15" + when: "%cxx" + - spec: "%fortran=gcc@15" + when: "%fortran" + apple-nag: + - spec: "%c=apple-clang" + when: "%c" + - spec: "%cxx=apple-clang" + when: "%cxx" + - spec: "%fortran=nag" + when: "%fortran" diff --git a/configs/templates/geos-dev/spack.yaml b/configs/templates/geos-dev/spack.yaml new file mode 100644 index 000000000..86e727822 --- /dev/null +++ b/configs/templates/geos-dev/spack.yaml @@ -0,0 +1,21 @@ +# Template for GEOS development +# +spack: + concretizer: + unify: when_possible + + view: false + include: [] + + specs: + - geos-gcm-env ~debug ^esmf@=9.0.0b10 + - geos-gcm-env +debug ^esmf@=9.0.0b10 + + # Various fms builds + - fms ~gfs_phys constants=GEOS + + packages: + # Turn on python variant for esmf + esmf: + require: + - +python diff --git a/util/gmao/batch_install.sh b/util/gmao/batch_install.sh new file mode 100755 index 000000000..ea6ab65b2 --- /dev/null +++ b/util/gmao/batch_install.sh @@ -0,0 +1,680 @@ +#!/usr/bin/env bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +SPACK_STACK_DIR=$(dirname $(dirname ${SCRIPT_DIR})) + +set -e + +################################################################################################## +# Packages for which to run tests when "-t" is specified; caveat: must be listed in order of # +# their respective dependencies (e.g. A depends on B --> B comes first) # +################################################################################################## + +SPACK_STACK_PACKAGES_TO_TEST=( + "oops" + "ioda" + "ioda-converters" + "ropp-ufo" + "ufo" +) + +################################################################################################## +# Options # +################################################################################################## + +usage() { + set +x + echo + echo "Usage: $0 -r -m [-d ] [-c ]" + echo + echo " -r Set role, can be 'ops' or 'dev'" + echo " -m Set mode, can be 'build' or 'install';" + echo " build: build environments and update build caches;" + echo " install: install environments using build caches" + echo " -d Build or install environments in ENV_DIRS;" + echo " if not set, the default location is used" + echo " -c Provide location of build caches as BUILDCACHE_DIR;" + echo " if not set, authoritative build caches are used" + echo " -u Flag to update bootstrap and source caches;" + echo " requires role 'dev' and mode 'build'" + echo " -e Continue builds/install in existing environments;" + echo " by default, exit with an error if already exist" + echo " -s Submit 'spack install' to batch scheduler" + echo " -t Run tests for specific thirdparty dependencies;" + echo " these are currently hardcoded in batch_install.sh" + echo " -h display this help" + echo +} + +while getopts r:m:d:c:uesth flag +do + case "${flag}" in + r) + SPACK_STACK_ROLE=${OPTARG} + ;; + m) + SPACK_STACK_MODE=${OPTARG} + ;; + d) + SPACK_STACK_ENVIRONMENT_DIRS=$(readlink -f ${OPTARG}) + ;; + c) + SPACK_STACK_BUILDCACHE_DIR=$(readlink -f ${OPTARG}) + ;; + u) + SPACK_STACK_UPDATE_DEV_CACHES="true" + ;; + e) + SPACK_STACK_IGNORE_ENV_EXIST="true" + ;; + s) + SPACK_STACK_SUBMIT_TO_SCHEDULER="true" + ;; + t) + SPACK_STACK_RUN_TESTS="true" + ;; + *) + usage + exit 1 + ;; + esac +done + +echo "INFO: $0 options:" +echo " SPACK_STACK_ROLE: ${SPACK_STACK_ROLE:-not set}" +echo " SPACK_STACK_MODE: ${SPACK_STACK_MODE:-not set}" +echo " SPACK_STACK_ENVIRONMENT_DIRS: ${SPACK_STACK_ENVIRONMENT_DIRS:-${SPACK_STACK_DIR}/envs}" +echo " SPACK_STACK_BUILDCACHE_DIR: ${SPACK_STACK_BUILDCACHE_DIR:-use default caches}" +echo " SPACK_STACK_UPDATE_DEV_CACHES: ${SPACK_STACK_UPDATE_DEV_CACHES:-false}" +echo " SPACK_STACK_IGNORE_ENV_EXIST: ${SPACK_STACK_IGNORE_ENV_EXIST:-false}" +echo " SPACK_STACK_SUBMIT_TO_SCHEDULER: ${SPACK_STACK_SUBMIT_TO_SCHEDULER:-false}" +echo " SPACK_STACK_RUN_TESTS: ${SPACK_STACK_RUN_TESTS:-false}" + +if [[ -z ${SPACK_STACK_ROLE} ]]; then + echo "ERROR, SPACK_STACK_ROLE not defined. Provide -r ROLE as argument" + exit 1 +elif [[ ! ${SPACK_STACK_ROLE} == "dev" && ! ${SPACK_STACK_ROLE} == "ops" ]]; then + echo "ERROR, invalid role '${SPACK_STACK_ROLE}'" + exit 1 +fi + +if [[ -z ${SPACK_STACK_MODE} ]]; then + echo "ERROR, SPACK_STACK_MODE not defined. Provide -m MODE as argument" + exit 1 +elif [[ ! ${SPACK_STACK_MODE} == "build" && ! ${SPACK_STACK_MODE} == "install" ]]; then + echo "ERROR, invalid mode '${SPACK_STACK_MODE}'" + exit 1 +fi + +# Role ops cannot write to the default (authoritative) build cache +if [[ ${SPACK_STACK_ROLE} == "ops" && ${SPACK_STACK_MODE} == "build" && -z ${SPACK_STACK_BUILDCACHE_DIR} ]]; then + echo "ERROR, SPACK_STACK_BUILDCACHE_DIR not defined. Provide -c BUILDCACHE_DIR" + echo "as argument when role is 'ops' and mode is 'build'" + exit 1 +fi + +# Updating bootstrap and source caches requires role dev and mode build +if [[ ${SPACK_STACK_UPDATE_DEV_CACHES} == "true" ]]; then + if [[ ! ${SPACK_STACK_ROLE} == "dev" || ! ${SPACK_STACK_MODE} == "build" ]]; then + echo "ERROR, SPACK_STACK_UPDATE_DEV_CACHES requires role 'dev' and mode 'build'" + exit 1 + fi +fi + +################################################################################################## + +# Remove domain name suffices and digits to determine hostname +SPACK_STACK_BATCH_HOST=$(echo ${HOSTNAME} | cut -d "." -f 1) +SPACK_STACK_BATCH_HOST=${SPACK_STACK_BATCH_HOST//[0-9]/} + +case ${SPACK_STACK_BATCH_HOST} in + nas) + SPACK_STACK_BATCH_COMPILERS=("oneapi@=2024.2.0" "oneapi@=2025.3.0" "gcc@=13.2.0") + SPACK_STACK_BATCH_TEMPLATES=("unified-dev") + SPACK_STACK_MODULE_CHOICE="tcl" + SPACK_STACK_BOOTSTRAP_MIRROR="/swbuild/gmao_SIteam/spack-stack/bootstrap-mirror" + SPACK_STACK_CARGO_MIRROR="/swbuild/gmao_SIteam/spack-stack/cargo-mirror" + ;; + nas-toss5) + SPACK_STACK_BATCH_COMPILERS=("oneapi@=2024.2.0" "oneapi@=2025.3.0" "gcc@=14.2.1") + SPACK_STACK_BATCH_TEMPLATES=("unified-dev") + SPACK_STACK_MODULE_CHOICE="tcl" + SPACK_STACK_BOOTSTRAP_MIRROR="/swbuild/gmao_SIteam/spack-stack/bootstrap-mirror" + SPACK_STACK_CARGO_MIRROR="/swbuild/gmao_SIteam/spack-stack/cargo-mirror" + ;; + discover-gmao) + SPACK_STACK_BATCH_COMPILERS=("oneapi@=2024.2.0" "oneapi@=2025.3.0" "gcc@=14.2.1") + SPACK_STACK_BATCH_TEMPLATES=("unified-dev") + SPACK_STACK_MODULE_CHOICE="lmod" + SPACK_STACK_BOOTSTRAP_MIRROR="/swbuild/gmao_SIteam/spack-stack/bootstrap-mirror" + SPACK_STACK_CARGO_MIRROR="/swbuild/gmao_SIteam/spack-stack/cargo-mirror" + ;; + alderaan) + SPACK_STACK_BATCH_COMPILERS=("gcc@=15.2.0" "clang@=22.1.3") + SPACK_STACK_BATCH_TEMPLATES=("geos-dev") + SPACK_STACK_MODULE_CHOICE="lmod" + SPACK_STACK_BOOTSTRAP_MIRROR="/Users/mathomp4/prod/spack-bootstrap-mirror" + SPACK_STACK_CARGO_MIRROR="/Users/mathomp4/prod/spack-cargo-mirror" + ;; + *) + echo "ERROR, host ${SPACK_STACK_BATCH_HOST} not configured" + exit 1 + ;; +esac + +################################################################################################## + +function fix_permissions() { + host=$1 + dir=$2 + executables=$3 + echo "Repairing permissions for directory ${dir} on ${host} ..." + set +e + case ${host} in + nas) + nice -n 19 find ${dir} -type d -print0 | xargs --null chmod a+rx + if [[ ${executables} -eq 1 ]]; then + nice -n 19 find ${dir} -type f -executable -print0 | xargs --null chmod a+rx + fi + nice -n 19 find ${dir} -type f -print0 | xargs --null chmod a+r + ;; + nas-toss5) + nice -n 19 find ${dir} -type d -print0 | xargs --null chmod a+rx + if [[ ${executables} -eq 1 ]]; then + nice -n 19 find ${dir} -type f -executable -print0 | xargs --null chmod a+rx + fi + nice -n 19 find ${dir} -type f -print0 | xargs --null chmod a+r + ;; + discover-gmao) + nice -n 19 find ${dir} -type d -print0 | xargs --null chmod a+rx + if [[ ${executables} -eq 1 ]]; then + nice -n 19 find ${dir} -type f -executable -print0 | xargs --null chmod a+rx + fi + nice -n 19 find ${dir} -type f -print0 | xargs --null chmod a+r + ;; + alderaan) + ;; + *) + echo "ERROR, xargs-chmod command not configured for ${host}" + exit 1 + ;; + esac + set -e +} + +################################################################################################## + +function tasks_per_node() { + host=$1 + case ${host} in + nas) + tpn=128 + ;; + nas-toss5) + tpn=256 + ;; + discover-gmao) + tpn=128 + ;; + *) + echo "ERROR, tasks_per_node command not configured for ${host}" + exit 1 + ;; + esac + echo "${tpn}" +} + +################################################################################################## + +function run_interactive_job() { + host=$1 + script=$2 + reuse_build_cache=$3 + tpn=$(tasks_per_node ${host}) + if [[ "${reuse_build_cache}" == "true" ]]; then + walltime="120" + else + walltime="720" + fi + if [[ ! -n "${ACCOUNT}" ]]; then + echo "ERROR, environment variable ACCOUNT not set" + exit 1 + fi + echo "Starting interactive job on ${host} with ${tpn} tasks and a walltime of ${walltime} minutes for ${script} ..." + case ${host} in + nas) + module load slurm + salloc --exclusive --nodes=1 --ntasks-per-node=${tpn} --time=${walltime} bash ${script} + module unload slurm + ;; + nas-toss5) + salloc --exclusive --nodes=1 --ntasks-per-node=${tpn} --time=${walltime} --qos=serial --account=${ACCOUNT} bash ${script} + ;; + discover-gmao) + salloc --exclusive --nodes=1 --ntasks-per-node=${tpn} --time=${walltime} --qos=compute --account=${ACCOUNT} bash ${script} + ;; + *) + echo "ERROR, run_interactive_job command not configured for ${host}" + exit 1 + ;; + esac +} + +################################################################################################## + +echo +echo "Welcome to GMAO SPACK-STACK BATCH INSTALL" +echo + +if [[ ! -e "setup.sh" || ! -e ".spackstack" ]]; then + echo "ERROR, this script must be executed from the top-level spack-stack directory" + exit 1 +fi + +host=${SPACK_STACK_BATCH_HOST} +module_choice=${SPACK_STACK_MODULE_CHOICE} +bootstrap_mirror_path=${SPACK_STACK_BOOTSTRAP_MIRROR} +cargo_mirror_path=${SPACK_STACK_CARGO_MIRROR} +export CARGO_HOME=${cargo_mirror_path} + +if [[ -z ${SPACK_STACK_ENVIRONMENT_DIRS} ]]; then + environment_dirs=${PWD}/envs +else + environment_dirs=${SPACK_STACK_ENVIRONMENT_DIRS} +fi +mkdir -p ${environment_dirs} + +if [[ ! -z ${SPACK_STACK_BUILDCACHE_DIR} ]]; then + buildcache_dir=${SPACK_STACK_BUILDCACHE_DIR} + if [[ "${SPACK_STACK_MODE}" == "install" && ! -d ${buildcache_dir} ]]; then + echo "ERROR, build cache ${buildcache_dir} not found," + echo "must exist before installing environments" + exit 1 + else + mkdir -p ${buildcache_dir} + fi +fi + +if [[ "${SPACK_STACK_MODE}" == "install" ]]; then + update_bootstrap_mirror="false" + update_cargo_mirror="false" + update_source_cache="false" + update_build_cache="false" + reuse_build_cache="true" +elif [[ "${SPACK_STACK_MODE}" == "build" ]]; then + if [[ "${SPACK_STACK_ROLE}" == "ops" ]]; then + update_bootstrap_mirror="false" + update_cargo_mirror="false" + update_source_cache="false" + elif [[ "${SPACK_STACK_ROLE}" == "dev" ]]; then + if [[ ${SPACK_STACK_UPDATE_DEV_CACHES} == "true" ]]; then + update_bootstrap_mirror="true" + update_cargo_mirror="true" + update_source_cache="true" + else + update_bootstrap_mirror="false" + update_cargo_mirror="false" + update_source_cache="false" + fi + else + echo "ERROR, invalid role ${SPACK_STACK_ROLE}" + exit 1 + fi + update_build_cache="true" + reuse_build_cache="true" +else + echo "ERROR, invalid mode ${SPACK_STACK_MODE}" + exit 1 +fi + +ignore_env_exist=${SPACK_STACK_IGNORE_ENV_EXIST:-false} + +if [[ "${SPACK_STACK_SUBMIT_TO_SCHEDULER}" == "true" ]]; then + submit_to_scheduler="true" +else + submit_to_scheduler="false" +fi + +if [[ "${SPACK_STACK_RUN_TESTS}" == "true" ]]; then + test_packages=("${SPACK_STACK_PACKAGES_TO_TEST[@]}") +else + test_packages=() +fi + +# Loop through all compilers and templates for this host +first_pass="true" +for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do + + if [[ ! ${compiler} == *"@="* ]]; then + echo "ERROR, '@=' not found in compiler string '${compiler}'" + exit 1 + fi + + compiler_name=$(echo ${compiler} | cut -d "@" -f 1) + compiler_version=$(echo ${compiler} | cut -d "=" -f 2) + + for template in "${SPACK_STACK_BATCH_TEMPLATES[@]}"; do + + echo + ############################################################# + # Add excluded combinations of compilers and templates here # + ############################################################# + # cylc-dev only with gcc + #if [[ "${template}" == "cylc-dev" && ! "${compiler_name}" == "gcc" ]]; then + #echo "Skipping template ${template} with compiler ${compiler}" + #continue + ## With clang, only neptune-dev-llvm + #elif [[ "${compiler_name}" == "clang" && ! "${template}" == "neptune-dev-llvm" ]]; then + #echo "Skipping template ${template} with compiler ${compiler}" + #continue + ## With other compilers, skip neptune-dev-llvm + #elif [[ ! "${compiler_name}" == "clang" && "${template}" == "neptune-dev-llvm" ]]; then + #echo "Skipping template ${template} with compiler ${compiler}" + #continue + ## FMS compiler ICE: https://github.com/NOAA-GFDL/FMS/issues/1680 + #elif [[ "${compiler_name}" == "oneapi" && "${compiler_version}" == "2025.1"* && "${template}" == "unified-dev" ]]; then + #echo "Skipping template ${template} with compiler ${compiler}" + #continue + #fi + echo "Processing template ${template} with compiler ${compiler}" + ############################################################# + + # Build environment name. Prefices are defined here + case ${template} in + unified-dev) + env_name_prefix="ue" + ;; + geos-dev) + env_name_prefix="ge" + ;; + *) + echo "ERROR, template ${template} not configured" + exit 1 + ;; + esac + env_name=${env_name_prefix}-${compiler_name}-${compiler_version} + [[ "${update_build_cache}" == "true" ]] && env_name=${env_name}-build + env_dir=${environment_dirs}/${env_name} + + # Bail out if the environment already exists + if [[ -d ${env_dir} ]]; then + if [[ ${ignore_env_exist} == "true" ]]; then + env_exists="true" + else + echo "ERROR, environment ${env_dir} already exists" + exit 1 + fi + else + env_exists="false" + fi + + # Reset environment + echo "Resetting environment ..." + case ${host} in + atlantis) + umask 0022 + module purge + case ${compiler} in + clang@=22.1.0) + module use /gpfs/neptune/spack-stack/llvm-22.1.0/modulefiles + module use /gpfs/neptune/spack-stack/openmpi-4.1.8/llvm-22.1.0/modulefiles + ;; + gcc@=13.4.0) + module use /gpfs/neptune/spack-stack/gcc-13.4.0/modulefiles + module use /gpfs/neptune/spack-stack/openmpi-4.1.8/gcc-13.4.0/modulefiles + ;; + oneapi@=2025.3.0) + module use /gpfs/neptune/spack-stack/oneapi-2025.3.0/modulefiles + ;; + esac + ;; + nas) + umask 0022 + set +e + module purge + set -e + ;; + nas-toss5) + umask 0022 + set +e + module purge + set -e + ;; + discover-gmao) + umask 0022 + set +e + module purge + set -e + ;; + alderaan) + ulimit -s unlimited + ;; + *) + echo "ERROR, host ${host} not configured for resetting environment" + exit 1 + ;; + esac + + # Info prints + ulimit -a + module li + + source setup.sh + if [[ "${first_pass}" == "true" ]]; then + spack clean -a + else + # Don't remove software and configuration needed to bootstrap Spack + spack clean -d -f -m -p -s + fi + + # Update bootstrap mirror if requested before creating any + # environments. It is sufficient to do this one time only. + if [[ "${update_bootstrap_mirror}" == "true"* ]]; then + tmp_bootstrap_mirror_path=${PWD}/tmp-bootstrap-mirror + echo "Creating bootstrap mirror ${tmp_bootstrap_mirror_path} ..." + rm -fr ${tmp_bootstrap_mirror_path} + spack bootstrap mirror --binary-packages ${tmp_bootstrap_mirror_path} 2>&1 | tee log.bootstrap-mirror.001 + rsync -a ${tmp_bootstrap_mirror_path}/ ${bootstrap_mirror_path}/ + rm -fr ${tmp_bootstrap_mirror_path} + # Update buildcache index + spack buildcache update-index ${bootstrap_mirror_path}/bootstrap_cache + # Fix permissions for the bootstrap mirror + fix_permissions ${host} ${bootstrap_mirror_path} 0 + update_bootstrap_mirror="false" + # When spack creates a bootstrap mirror, it populates the "spack" scope + # with compilers and packages it finds, which can create problems later + echo "Removing package config in spack/etc/spack created by spack boostrap mirror" + rm -vf spack/etc/spack/packages.yaml + fi + + if [[ ! ${env_exists} == "true" ]]; then + spack stack create env --name=${env_name} \ + --site=${host} \ + --compiler=${compiler_name}-${compiler_version} \ + --template=${template} \ + --dir=${environment_dirs} \ + --treat-warnings-as-errors \ + 2>&1 | tee log.create.${env_name}.001 + fi + spack env activate -p ${env_dir} + + # Workaround for ParallelWorks (no NRL Enterprise GitHub access yet) + sed -i 's/+adp/~adp/g' ${env_dir}/spack.yaml + + echo "Registering bootstrap mirror ${bootstrap_mirror_path} ..." + if [[ ! -d ${bootstrap_mirror_path} ]]; then + echo "ERROR, directory ${bootstrap_mirror_path} not found" + exit 1 + fi + spack bootstrap list | grep local-sources || \ + spack bootstrap add --trust local-sources ${bootstrap_mirror_path}/metadata/sources + spack bootstrap list | grep local-binaries || \ + spack bootstrap add --trust local-binaries ${bootstrap_mirror_path}/metadata/binaries + + # Check that the site has mirrors configured for local source and build caches, + # and extract the local path on disk. Need to strip leading "file://" from path + result=$(spack mirror list | grep local-source) || \ + (echo "ERROR, no local source cache configured" && exit 1) + source_mirror_path=$(echo ${result} | cut -d " " -f 3) + source_mirror_path=${source_mirror_path:7} + echo "Spack source mirror path: ${source_mirror_path}" + # For build caches, additional logic is needed. If buildcache_dir is defined, + # update the location of the default build cache to this directory. + result=$(spack mirror list | grep local-binary) || \ + (echo "ERROR, no local binary cache configured" && exit 1) + binary_mirror_path=$(echo ${result} | cut -d " " -f 3) + binary_mirror_path=${binary_mirror_path:7} + # If buildcache_dir is set, update binary_mirror_path + if [[ ! -z ${buildcache_dir} ]]; then + sed -i "s#${binary_mirror_path}#${buildcache_dir}#g" ${env_dir}/site/mirrors.yaml + result=$(spack mirror list | grep local-binary) + binary_mirror_path=$(echo ${result} | cut -d " " -f 3) + binary_mirror_path=${binary_mirror_path:7} + fi + echo "Spack binary mirror path: ${binary_mirror_path}" + + if [[ "${update_build_cache}" == "true" ]]; then + spack config add config:install_tree:padded_length:200 + fi + + # Bootstrap spack explicitly + echo "Bootstrapping spack ..." + spack bootstrap now 2>&1 | tee log.bootstrap.${env_name}.001 + + # Concretize environment, and check that spack.lock is created + spack concretize --force --fresh 2>&1 | tee log.concretize.${env_name}.001 + if [[ ! -e ${env_dir}/spack.lock ]]; then + echo "ERROR during concretization of environment ${env_name}, spack.lock not found" + exit 1 + fi + + # Check for duplicate packages + ./util/show_duplicate_packages.py -i crtm -i crtm-fix -i esmf -i mapl -i neptune-env -i py-cython -i ip -i fms + + # Update local source cache if requested + if [[ "${update_source_cache}" == "true"* ]]; then + echo "Updating local source cache ..." + spack mirror create -a -d ${source_mirror_path} + fi + + # Update local cargo mirror if requested; this can be + # unreliable, therefore ignore errors and proceed ... + if [[ "${update_cargo_mirror}" == "true"* ]]; then + set +e + echo "Updating local cargo mirror ..." + ./util/fetch_cargo_deps.py + set -e + fi + + # Install the environment with the correct flags + case ${reuse_build_cache} in + "true") + buildcache_install_flags="--no-check-signature" + ;; + "false") + buildcache_install_flags="--no-cache" + ;; + *) + echo "ERROR, unkown reuse_build_cache value ${reuse_build_cache} for setting install flags" + exit 1 + ;; + esac + + case ${submit_to_scheduler} in + "true") + jobs=$(tasks_per_node ${host}) + parallel_install_flags="--concurrent-packages=10 --jobs=${jobs}" + ;; + "false") + parallel_install_flags="" + ;; + *) + echo "ERROR, unkown submit_to_scheduler value ${submit_to_scheduler} for setting install flags" + exit 1 + ;; + esac + + install_script=${PWD}/spack-install.${env_name}.sh + cat << EOF > ${install_script} +#!/usr/bin/env bash + +set -e + +$(declare -p test_packages) + +# If no tests are required, install everything +if [[ \${#test_packages[@]} -eq 0 ]]; then + set -o pipefail + spack install --verbose ${buildcache_install_flags} ${parallel_install_flags} 2>&1 | tee log.install.${env_name}.001 + set +o pipefail +else + for (( idx=0; idx<\${#test_packages[@]}; idx++ )); do + test_package=\${test_packages[\${idx}]} + # First, check if this package is in this environment + set +e + grep -e "\${test_package}@" log.concretize.${env_name}.001 || continue + set -e + idx_padded=\$(printf "%03d" "\$((idx+1))") + set -o pipefail + spack install --verbose ${buildcache_install_flags} ${parallel_install_flags} --only=dependencies \${test_package} \\ + 2>&1 | tee log.install.${env_name}.\${idx_padded}.\${test_package}-dependencies + spack install --verbose --no-cache --test=root \${test_package} 2>&1 | tee log.install.${env_name}.\${idx_padded}.\${test_package} + set +o pipefail + done + # idx now equals the length of the array; install the rest + idx_padded=\$(printf "%03d" "\$((idx+1))") + set -o pipefail + spack install --verbose ${buildcache_install_flags} ${parallel_install_flags} 2>&1 | tee log.install.${env_name}.\${idx_padded} + set +o pipefail +fi +EOF + chmod u+x ${install_script} + if [[ "${submit_to_scheduler}" == "true" ]]; then + run_interactive_job ${host} ${install_script} ${reuse_build_cache} + else + bash ${install_script} + fi + + # In build mode, update local binary cache + if [[ "${update_build_cache}" == "true" ]]; then + spack buildcache push -u ${binary_mirror_path} + spack buildcache update-index local-binary + fi + + # In install mode, create environment modules + if [[ "${update_build_cache}" == "false" ]]; then + spack module ${module_choice} refresh --yes --upstream-modules 2>&1 | tee log.modules.${env_name}.001 + spack stack setup-meta-modules 2>&1 | tee log.setup-meta-modules.${env_name}.001 + fi + + # When creating or updating buildcaches, fix permissions for mirrors. + # Mirrors do not contain executables, therefore skip looking for them. + if [[ "${update_source_cache}" == "true" ]]; then + fix_permissions ${host} ${source_mirror_path} 0 + fi + if [[ "${update_build_cache}" == "true" ]]; then + fix_permissions ${host} ${binary_mirror_path} 0 + fi + if [[ "${update_cargo_mirror}" == "true" ]]; then + fix_permissions ${host} ${cargo_mirror_path} 0 + fi + + # Clean up (don't remove software and configuration needed to bootstrap Spack) + spack clean -d -f -m -p -s + spack env deactivate + first_pass="false" + + done + +done + +# Repair permissions for environments if in installer mode +if [[ "${update_build_cache}" == "false" ]]; then + # Also search for exectuables + fix_permissions ${host} ${environment_dirs} 1 +fi + +echo "SUCCESS" +echo + +exit 0 From 03a7e08ad2fc58692bc07e5f3ac725a2484932bc Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 14 Apr 2026 08:39:55 -0400 Subject: [PATCH 02/39] Cleanup --- configs/sites/tier2/alderaan/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/sites/tier2/alderaan/README.md b/configs/sites/tier2/alderaan/README.md index 26965c9d6..6cd8c5810 100644 --- a/configs/sites/tier2/alderaan/README.md +++ b/configs/sites/tier2/alderaan/README.md @@ -63,7 +63,7 @@ git clone --recurse-submodules https://github.com/GMAO-SI-Team/spack-stack.git - ```bash cd spack-stack-dev -. setup.sh +. ./setup.sh ``` --- @@ -136,7 +136,7 @@ export CARGO_HOME=/Users/mathomp4/prod/spack-cargo-mirror ../../util/fetch_cargo_deps.py ``` -> ⚠️ **Set `CARGO_HOME` before running `spack install`. +> ⚠️ **Set `CARGO_HOME` before running `spack install`.** --- From 541de7df190d1348013ea6664183b98f062b6fca Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 14 Apr 2026 08:40:26 -0400 Subject: [PATCH 03/39] Add debug variant --- .../spack_stack/packages/geos_gcm_env/package.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/repos/spack_stack/spack_repo/spack_stack/packages/geos_gcm_env/package.py b/repos/spack_stack/spack_repo/spack_stack/packages/geos_gcm_env/package.py index 47c5ff19f..91576e9e5 100644 --- a/repos/spack_stack/spack_repo/spack_stack/packages/geos_gcm_env/package.py +++ b/repos/spack_stack/spack_repo/spack_stack/packages/geos_gcm_env/package.py @@ -1,4 +1,4 @@ -# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2026 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) @@ -18,11 +18,17 @@ class GeosGcmEnv(BundlePackage): # Current version version("1.1.0") + variant("debug", default=False, description="Build debug version of selected dependencies") + depends_on("base-env", type="run") + depends_on("blas", type="run") depends_on("lapack", type="run") + depends_on("mepo", type="run") - depends_on("esmf", type="run") + depends_on("esmf ~debug", type="run", when="~debug") + depends_on("esmf +debug", type="run", when="+debug") + # mapl is built as part of GEOS, don't load; # needs external gftl-shared/fargparse/pflogger # depends_on("mapl", type="run") From 692bb08657c89067f52ee7e140bc983e96a48ef9 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 14 Apr 2026 10:51:26 -0400 Subject: [PATCH 04/39] More updates --- configs/sites/tier2/alderaan/README.md | 10 ++++------ configs/sites/tier2/alderaan/config.yaml | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/configs/sites/tier2/alderaan/README.md b/configs/sites/tier2/alderaan/README.md index 6cd8c5810..0544dab92 100644 --- a/configs/sites/tier2/alderaan/README.md +++ b/configs/sites/tier2/alderaan/README.md @@ -15,9 +15,9 @@ Alderaan is one of @mathomp4's development systems (Mac Studio) - [GCC Environment](#gcc-environment) - [Activate the Environment](#activate-the-environment) - [Concretize the Environment](#concretize-the-environment) -- [Create Source Cache (LOGIN NODE ONLY)](#create-source-cache-login-node-only) -- [Pre-Fetch Cargo Dependencies (LOGIN NODE ONLY)](#pre-fetch-cargo-dependencies-login-node-only) -- [Install Packages (COMPUTE NODE)](#install-packages-compute-node) +- [Create Source Cache](#create-source-cache) +- [Pre-Fetch Cargo Dependencies](#pre-fetch-cargo-dependencies) +- [Install Packages](#install-packages) - [Update Module Files](#update-module-files) - [Deactivate the Environment](#deactivate-the-environment) - [Debugging Package Builds](#debugging-package-builds) @@ -100,8 +100,6 @@ spack env activate . ## Concretize the Environment -Run on a **login node** (internet required for bootstrapping Clingo and other tools): - ```bash spack concretize 2>&1 | tee log.concretize ; bell ``` @@ -127,7 +125,7 @@ spack mirror create -a -d /Users/mathomp4/prod/spack-source-mirror --- -## Pre-Fetch Cargo Dependencies (LOGIN NODE ONLY) +## Pre-Fetch Cargo Dependencies Rust packages frequently require network access during build. Pre-fetch their dependencies: diff --git a/configs/sites/tier2/alderaan/config.yaml b/configs/sites/tier2/alderaan/config.yaml index 092d39523..b4e15cb14 100644 --- a/configs/sites/tier2/alderaan/config.yaml +++ b/configs/sites/tier2/alderaan/config.yaml @@ -1,3 +1,3 @@ config: - build_jobs: 6 - installer: new + build_jobs: 8 + installer: old From 56f2cee74c456b1e481a3368edb93385676b74f7 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Wed, 15 Apr 2026 12:02:01 -0400 Subject: [PATCH 05/39] Configs update --- configs/common/packages.yaml | 4 +++- configs/sites/tier2/alderaan/config.yaml | 2 +- configs/sites/tier2/alderaan/modules.yaml | 9 ++------- configs/sites/tier2/alderaan/packages.yaml | 4 ++++ configs/templates/geos-dev/spack.yaml | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/configs/common/packages.yaml b/configs/common/packages.yaml index 5c209b3ff..68cb6dd5e 100644 --- a/configs/common/packages.yaml +++ b/configs/common/packages.yaml @@ -165,12 +165,14 @@ packages: - '@2.6.4' fms: require: - - '@2025.03' - precision=32,64 - +quad_precision - +openmp - +pic - build_type=Release + - any_of: + - '@=2025.03' + - '@=2024.03' - any_of: - +gfs_phys constants=GFS - ~gfs_phys constants=GEOS diff --git a/configs/sites/tier2/alderaan/config.yaml b/configs/sites/tier2/alderaan/config.yaml index b4e15cb14..8ec652ba9 100644 --- a/configs/sites/tier2/alderaan/config.yaml +++ b/configs/sites/tier2/alderaan/config.yaml @@ -1,3 +1,3 @@ config: - build_jobs: 8 + build_jobs: 6 installer: old diff --git a/configs/sites/tier2/alderaan/modules.yaml b/configs/sites/tier2/alderaan/modules.yaml index 30063d42f..e307f83ba 100644 --- a/configs/sites/tier2/alderaan/modules.yaml +++ b/configs/sites/tier2/alderaan/modules.yaml @@ -1,18 +1,13 @@ modules: default: enable:: - - tcl - tcl: + - lmod + lmod: include: # Compiler modules - apple-clang - gcc - - intel-oneapi-compilers - llvm # MPI modules - - cray-mpich - - intel-mpi - - intel-oneapi-mpi - mpich - - mpt - openmpi diff --git a/configs/sites/tier2/alderaan/packages.yaml b/configs/sites/tier2/alderaan/packages.yaml index 3fe567557..12c25102f 100644 --- a/configs/sites/tier2/alderaan/packages.yaml +++ b/configs/sites/tier2/alderaan/packages.yaml @@ -1,4 +1,8 @@ packages: + + netcdf-c: + require: [+shared] + autoconf: externals: - spec: autoconf@2.72 diff --git a/configs/templates/geos-dev/spack.yaml b/configs/templates/geos-dev/spack.yaml index 86e727822..25b3ade77 100644 --- a/configs/templates/geos-dev/spack.yaml +++ b/configs/templates/geos-dev/spack.yaml @@ -12,7 +12,7 @@ spack: - geos-gcm-env +debug ^esmf@=9.0.0b10 # Various fms builds - - fms ~gfs_phys constants=GEOS + - fms@=2024.03 ~gfs_phys constants=GEOS packages: # Turn on python variant for esmf From 7461e627e5c493792256c038c50f2b17d144b855 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Wed, 15 Apr 2026 12:02:25 -0400 Subject: [PATCH 06/39] Latest updates of batch script --- util/gmao/batch_install.sh | 113 +++++++++++++++++++++++++++++++------ 1 file changed, 96 insertions(+), 17 deletions(-) diff --git a/util/gmao/batch_install.sh b/util/gmao/batch_install.sh index ea6ab65b2..64a8a56b5 100755 --- a/util/gmao/batch_install.sh +++ b/util/gmao/batch_install.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env bash -x SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) SPACK_STACK_DIR=$(dirname $(dirname ${SCRIPT_DIR})) @@ -25,7 +25,7 @@ SPACK_STACK_PACKAGES_TO_TEST=( usage() { set +x echo - echo "Usage: $0 -r -m [-d ] [-c ]" + echo "Usage: $0 -r -m [-d ] [-c ] [-H ]" echo echo " -r Set role, can be 'ops' or 'dev'" echo " -m Set mode, can be 'build' or 'install';" @@ -42,11 +42,14 @@ usage() { echo " -s Submit 'spack install' to batch scheduler" echo " -t Run tests for specific thirdparty dependencies;" echo " these are currently hardcoded in batch_install.sh" + echo " -n Dry-run: print what would be executed without running anything" + echo " -H Provide hostname manually (overrides autodetection);" + echo " useful when VPN/etc masks the real hostname" echo " -h display this help" echo } -while getopts r:m:d:c:uesth flag +while getopts r:m:d:c:H:nuesth flag do case "${flag}" in r) @@ -61,6 +64,12 @@ do c) SPACK_STACK_BUILDCACHE_DIR=$(readlink -f ${OPTARG}) ;; + H) + SPACK_STACK_BATCH_HOST_OPT=${OPTARG} + ;; + n) + SPACK_STACK_DRY_RUN="true" + ;; u) SPACK_STACK_UPDATE_DEV_CACHES="true" ;; @@ -85,6 +94,8 @@ echo " SPACK_STACK_ROLE: ${SPACK_STACK_ROLE:-not set echo " SPACK_STACK_MODE: ${SPACK_STACK_MODE:-not set}" echo " SPACK_STACK_ENVIRONMENT_DIRS: ${SPACK_STACK_ENVIRONMENT_DIRS:-${SPACK_STACK_DIR}/envs}" echo " SPACK_STACK_BUILDCACHE_DIR: ${SPACK_STACK_BUILDCACHE_DIR:-use default caches}" +echo " SPACK_STACK_BATCH_HOST_OPT: ${SPACK_STACK_BATCH_HOST_OPT:-autodetect}" +echo " SPACK_STACK_DRY_RUN: ${SPACK_STACK_DRY_RUN:-false}" echo " SPACK_STACK_UPDATE_DEV_CACHES: ${SPACK_STACK_UPDATE_DEV_CACHES:-false}" echo " SPACK_STACK_IGNORE_ENV_EXIST: ${SPACK_STACK_IGNORE_ENV_EXIST:-false}" echo " SPACK_STACK_SUBMIT_TO_SCHEDULER: ${SPACK_STACK_SUBMIT_TO_SCHEDULER:-false}" @@ -123,9 +134,13 @@ fi ################################################################################################## -# Remove domain name suffices and digits to determine hostname -SPACK_STACK_BATCH_HOST=$(echo ${HOSTNAME} | cut -d "." -f 1) -SPACK_STACK_BATCH_HOST=${SPACK_STACK_BATCH_HOST//[0-9]/} +if [[ -n "${SPACK_STACK_BATCH_HOST_OPT}" ]]; then + SPACK_STACK_BATCH_HOST="${SPACK_STACK_BATCH_HOST_OPT}" +else + # Remove domain name suffices and digits to determine hostname + SPACK_STACK_BATCH_HOST=$(echo ${HOSTNAME} | cut -d "." -f 1) + SPACK_STACK_BATCH_HOST=${SPACK_STACK_BATCH_HOST//[0-9]/} +fi case ${SPACK_STACK_BATCH_HOST} in nas) @@ -150,7 +165,8 @@ case ${SPACK_STACK_BATCH_HOST} in SPACK_STACK_CARGO_MIRROR="/swbuild/gmao_SIteam/spack-stack/cargo-mirror" ;; alderaan) - SPACK_STACK_BATCH_COMPILERS=("gcc@=15.2.0" "clang@=22.1.3") + #SPACK_STACK_BATCH_COMPILERS=("gcc@=15.2.0" "clang@=22.1.3") + SPACK_STACK_BATCH_COMPILERS=("gcc@=15.2.0") SPACK_STACK_BATCH_TEMPLATES=("geos-dev") SPACK_STACK_MODULE_CHOICE="lmod" SPACK_STACK_BOOTSTRAP_MIRROR="/Users/mathomp4/prod/spack-bootstrap-mirror" @@ -282,7 +298,7 @@ if [[ -z ${SPACK_STACK_ENVIRONMENT_DIRS} ]]; then else environment_dirs=${SPACK_STACK_ENVIRONMENT_DIRS} fi -mkdir -p ${environment_dirs} +[[ "${SPACK_STACK_DRY_RUN}" != "true" ]] && mkdir -p ${environment_dirs} if [[ ! -z ${SPACK_STACK_BUILDCACHE_DIR} ]]; then buildcache_dir=${SPACK_STACK_BUILDCACHE_DIR} @@ -291,7 +307,7 @@ if [[ ! -z ${SPACK_STACK_BUILDCACHE_DIR} ]]; then echo "must exist before installing environments" exit 1 else - mkdir -p ${buildcache_dir} + [[ "${SPACK_STACK_DRY_RUN}" != "true" ]] && mkdir -p ${buildcache_dir} fi fi @@ -401,13 +417,68 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do if [[ ${ignore_env_exist} == "true" ]]; then env_exists="true" else - echo "ERROR, environment ${env_dir} already exists" - exit 1 + if [[ "${SPACK_STACK_DRY_RUN}" == "true" ]]; then + echo "[DRY-RUN] ERROR: environment ${env_dir} already exists. (Would exit here)" + continue + else + echo "ERROR, environment ${env_dir} already exists" + exit 1 + fi fi else env_exists="false" fi + if [[ "${SPACK_STACK_DRY_RUN}" == "true" ]]; then + echo "--------------------------------------------------------------------------------" + echo "[DRY-RUN] Target Environment: ${env_name}" + echo "[DRY-RUN] Directory: ${env_dir}" + echo "--------------------------------------------------------------------------------" + if [[ "${update_bootstrap_mirror}" == "true"* ]]; then + echo "[DRY-RUN] spack bootstrap mirror --binary-packages ${PWD}/tmp-bootstrap-mirror" + echo "[DRY-RUN] rsync -a ${PWD}/tmp-bootstrap-mirror/ ${bootstrap_mirror_path}/" + echo "[DRY-RUN] spack buildcache update-index ${bootstrap_mirror_path}/bootstrap_cache" + update_bootstrap_mirror="false" + fi + + if [[ ! ${env_exists} == "true" ]]; then + echo "[DRY-RUN] spack stack create env --name=${env_name} \\" + echo " --site=${host} --compiler=${compiler_name}-${compiler_version} \\" + echo " --template=${template} --dir=${environment_dirs} --treat-warnings-as-errors" + fi + echo "[DRY-RUN] spack env activate -p ${env_dir}" + echo "[DRY-RUN] spack bootstrap now" + echo "[DRY-RUN] spack concretize --force --fresh" + + if [[ "${update_source_cache}" == "true"* ]]; then + echo "[DRY-RUN] spack mirror create -a -d " + fi + if [[ "${update_cargo_mirror}" == "true"* ]]; then + echo "[DRY-RUN] ./util/fetch_cargo_deps.py" + fi + + echo "[DRY-RUN] Generating spack-install.${env_name}.sh and executing via:" + if [[ "${submit_to_scheduler}" == "true" ]]; then + echo "[DRY-RUN] run_interactive_job ${host} spack-install.${env_name}.sh ${reuse_build_cache}" + else + echo "[DRY-RUN] bash spack-install.${env_name}.sh" + fi + + if [[ "${update_build_cache}" == "true" ]]; then + echo "[DRY-RUN] spack buildcache push -u " + echo "[DRY-RUN] spack buildcache update-index local-binary" + else + echo "[DRY-RUN] spack module ${module_choice} refresh --yes --upstream-modules" + echo "[DRY-RUN] spack stack setup-meta-modules" + fi + + echo "[DRY-RUN] spack clean -d -f -m -p -s" + echo "[DRY-RUN] spack env deactivate" + echo "" + first_pass="false" + continue + fi + # Reset environment echo "Resetting environment ..." case ${host} in @@ -447,7 +518,14 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do set -e ;; alderaan) - ulimit -s unlimited + set +e + ulimit -s unlimited 2>/dev/null || ulimit -s hard 2>/dev/null || ulimit -s 65532 2>/dev/null || true + if ! command -v module &> /dev/null; then + if command -v brew &> /dev/null; then + . $(brew --prefix)/opt/lmod/init/bash 2>/dev/null || true + fi + fi + set -e ;; *) echo "ERROR, host ${host} not configured for resetting environment" @@ -498,9 +576,6 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do fi spack env activate -p ${env_dir} - # Workaround for ParallelWorks (no NRL Enterprise GitHub access yet) - sed -i 's/+adp/~adp/g' ${env_dir}/spack.yaml - echo "Registering bootstrap mirror ${bootstrap_mirror_path} ..." if [[ ! -d ${bootstrap_mirror_path} ]]; then echo "ERROR, directory ${bootstrap_mirror_path} not found" @@ -549,7 +624,7 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do fi # Check for duplicate packages - ./util/show_duplicate_packages.py -i crtm -i crtm-fix -i esmf -i mapl -i neptune-env -i py-cython -i ip -i fms + ./util/show_duplicate_packages.py -i crtm -i crtm-fix -i esmf -i mapl -i neptune-env -i py-cython -i ip -i fms -i geos-gcm-env # Update local source cache if requested if [[ "${update_source_cache}" == "true"* ]]; then @@ -671,7 +746,11 @@ done # Repair permissions for environments if in installer mode if [[ "${update_build_cache}" == "false" ]]; then # Also search for exectuables - fix_permissions ${host} ${environment_dirs} 1 + if [[ "${SPACK_STACK_DRY_RUN}" == "true" ]]; then + echo "[DRY-RUN] fix_permissions ${host} ${environment_dirs} 1" + else + fix_permissions ${host} ${environment_dirs} 1 + fi fi echo "SUCCESS" From 845ca9894ed70854455c7c703e14aa45539739c3 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 16 Apr 2026 13:17:00 -0400 Subject: [PATCH 07/39] Update gitignore to ignore log files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 38038e6e3..ab05ab5db 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ cache .vscode doc/build deploy_logs/ +log.* From 678b423010696ffc56de8d1ce947a3ed25383d73 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 16 Apr 2026 13:17:34 -0400 Subject: [PATCH 08/39] Updates from alderaan testing --- configs/sites/tier2/alderaan/README.md | 6 ++--- configs/sites/tier2/alderaan/mirrors.yaml | 4 +-- configs/sites/tier2/alderaan/modules.yaml | 25 +++++++++++++++++++ .../tier2/alderaan/packages_gcc-15.2.0.yaml | 6 +++++ 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/configs/sites/tier2/alderaan/README.md b/configs/sites/tier2/alderaan/README.md index 0544dab92..df8270140 100644 --- a/configs/sites/tier2/alderaan/README.md +++ b/configs/sites/tier2/alderaan/README.md @@ -117,7 +117,7 @@ bell() { tput bel ; printf "\nFinished at: " ; date; } This downloads all source tarballs for your environment: ```bash -spack mirror create -a -d /Users/mathomp4/prod/spack-source-mirror +spack mirror create -a -d /Users/mathomp4/spack-stack-mirrors/spack-source-mirror ``` > ⚠️ **Do not run this outside an activated environment.** @@ -130,7 +130,7 @@ spack mirror create -a -d /Users/mathomp4/prod/spack-source-mirror Rust packages frequently require network access during build. Pre-fetch their dependencies: ```bash -export CARGO_HOME=/Users/mathomp4/prod/spack-cargo-mirror +export CARGO_HOME=/Users/mathomp4/spack-stack-mirrors/spack-cargo-mirror ../../util/fetch_cargo_deps.py ``` @@ -141,7 +141,7 @@ export CARGO_HOME=/Users/mathomp4/prod/spack-cargo-mirror ## Install Packages ```bash -export CARGO_HOME=/Users/mathomp4/prod/spack-cargo-mirror +export CARGO_HOME=/Users/mathomp4/spack-stack-mirrors/spack-cargo-mirror spack install -j 6 --verbose --fail-fast --show-log-on-error --no-check-signature 2>&1 | tee log.install ; bell ``` diff --git a/configs/sites/tier2/alderaan/mirrors.yaml b/configs/sites/tier2/alderaan/mirrors.yaml index cfe5bb55b..d1c9bcc4b 100644 --- a/configs/sites/tier2/alderaan/mirrors.yaml +++ b/configs/sites/tier2/alderaan/mirrors.yaml @@ -1,3 +1,3 @@ mirrors: - local-source: file:///Users/mathomp4/prod/spack-source-mirror - local-binary: file:///Users/mathomp4/prod/spack-build-mirror + local-source: file:///Users/mathomp4/spack-stack-mirrors/spack-source-mirror + local-binary: file:///Users/mathomp4/spack-stack-mirrors/spack-build-mirror diff --git a/configs/sites/tier2/alderaan/modules.yaml b/configs/sites/tier2/alderaan/modules.yaml index e307f83ba..e13bb47f4 100644 --- a/configs/sites/tier2/alderaan/modules.yaml +++ b/configs/sites/tier2/alderaan/modules.yaml @@ -2,7 +2,32 @@ modules: default: enable:: - lmod + prefix_inspections:: + bin: + - PATH + man: + - MANPATH + share/man: + - MANPATH + share/aclocal: + - ACLOCAL_PATH + include: + - CPATH + lib/pkgconfig: + - PKG_CONFIG_PATH + lib64/pkgconfig: + - PKG_CONFIG_PATH + share/pkgconfig: + - PKG_CONFIG_PATH + '': + - CMAKE_PREFIX_PATH lmod: + all: + filter: + exclude_env_vars: + - LD_LIBRARY_PATH + - DYLD_LIBRARY_PATH + - DYLD_FALLBACK_LIBRARY_PATH include: # Compiler modules - apple-clang diff --git a/configs/sites/tier2/alderaan/packages_gcc-15.2.0.yaml b/configs/sites/tier2/alderaan/packages_gcc-15.2.0.yaml index b107f4ebd..a2cf11fe6 100644 --- a/configs/sites/tier2/alderaan/packages_gcc-15.2.0.yaml +++ b/configs/sites/tier2/alderaan/packages_gcc-15.2.0.yaml @@ -23,3 +23,9 @@ packages: extra_attributes: compilers: fortran: /Users/mathomp4/.homebrew/brew/bin/gfortran-15 + + # ESMF by default for Darwin.gfortranclang turns off OpenMP, so + # we do the same here to avoid build failures. + esmf: + require:: + - '~openmp' From 87215fce6d246e32ddca09ed6f8dba464811325a Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 16 Apr 2026 13:17:47 -0400 Subject: [PATCH 09/39] Add new macos.gmao site --- configs/sites/tier2/macos.gmao/config.yaml | 3 ++ .../tier2/macos.gmao/mirrors.yaml.template | 3 ++ configs/sites/tier2/macos.gmao/modules.yaml | 38 +++++++++++++++++++ configs/sites/tier2/macos.gmao/packages.yaml | 21 ++++++++++ .../macos.gmao/packages_clang-22.1.3.yaml | 25 ++++++++++++ .../packages_gcc-15.2.0.yaml.template | 31 +++++++++++++++ .../sites/tier2/macos.gmao/toolchains.yaml | 29 ++++++++++++++ 7 files changed, 150 insertions(+) create mode 100644 configs/sites/tier2/macos.gmao/config.yaml create mode 100644 configs/sites/tier2/macos.gmao/mirrors.yaml.template create mode 100644 configs/sites/tier2/macos.gmao/modules.yaml create mode 100644 configs/sites/tier2/macos.gmao/packages.yaml create mode 100644 configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml create mode 100644 configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml.template create mode 100644 configs/sites/tier2/macos.gmao/toolchains.yaml diff --git a/configs/sites/tier2/macos.gmao/config.yaml b/configs/sites/tier2/macos.gmao/config.yaml new file mode 100644 index 000000000..8ec652ba9 --- /dev/null +++ b/configs/sites/tier2/macos.gmao/config.yaml @@ -0,0 +1,3 @@ +config: + build_jobs: 6 + installer: old diff --git a/configs/sites/tier2/macos.gmao/mirrors.yaml.template b/configs/sites/tier2/macos.gmao/mirrors.yaml.template new file mode 100644 index 000000000..f2e285635 --- /dev/null +++ b/configs/sites/tier2/macos.gmao/mirrors.yaml.template @@ -0,0 +1,3 @@ +mirrors: + local-source: file://@HOME@/spack-stack-mirrors/spack-source-mirror + local-binary: file://@HOME@/spack-stack-mirrors/spack-build-mirror diff --git a/configs/sites/tier2/macos.gmao/modules.yaml b/configs/sites/tier2/macos.gmao/modules.yaml new file mode 100644 index 000000000..e13bb47f4 --- /dev/null +++ b/configs/sites/tier2/macos.gmao/modules.yaml @@ -0,0 +1,38 @@ +modules: + default: + enable:: + - lmod + prefix_inspections:: + bin: + - PATH + man: + - MANPATH + share/man: + - MANPATH + share/aclocal: + - ACLOCAL_PATH + include: + - CPATH + lib/pkgconfig: + - PKG_CONFIG_PATH + lib64/pkgconfig: + - PKG_CONFIG_PATH + share/pkgconfig: + - PKG_CONFIG_PATH + '': + - CMAKE_PREFIX_PATH + lmod: + all: + filter: + exclude_env_vars: + - LD_LIBRARY_PATH + - DYLD_LIBRARY_PATH + - DYLD_FALLBACK_LIBRARY_PATH + include: + # Compiler modules + - apple-clang + - gcc + - llvm + # MPI modules + - mpich + - openmpi diff --git a/configs/sites/tier2/macos.gmao/packages.yaml b/configs/sites/tier2/macos.gmao/packages.yaml new file mode 100644 index 000000000..de01b25cf --- /dev/null +++ b/configs/sites/tier2/macos.gmao/packages.yaml @@ -0,0 +1,21 @@ +packages: + + netcdf-c: + require: [+shared] + + flex: + externals: + - spec: flex@2.6.4+lex + prefix: /usr + git: + externals: + - spec: git@2.50.1~tcltk + prefix: /usr + openssh: + externals: + - spec: openssh@9.9p2 + prefix: /usr + perl: + externals: + - spec: perl@5.34.1~cpanm+opcode+open+shared+threads + prefix: /usr diff --git a/configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml b/configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml new file mode 100644 index 000000000..ef8c19c5d --- /dev/null +++ b/configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml @@ -0,0 +1,25 @@ +packages: + c: + require: [apple-clang@17.0.0] + cxx: + require: [apple-clang@17.0.0] + fortran: + require: [llvm@21.1.3 ~clang +flang] + mpi: + require: [openmpi@=5.0.10] + apple-clang: + externals: + - spec: apple-clang@17.0.0 languages:='c,c++' + prefix: /usr + extra_attributes: + compilers: + c: /usr/bin/clang + cxx: /usr/bin/clang++ + llvm: + buildable: False + externals: + - spec: llvm@21.1.3 ~clang +flang languages:='fortran' + prefix: /Users/mathomp4/.homebrew/brew + extra_attributes: + compilers: + fortran: /Users/mathomp4/.homebrew/brew/bin/flang diff --git a/configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml.template b/configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml.template new file mode 100644 index 000000000..ea6bb02d8 --- /dev/null +++ b/configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml.template @@ -0,0 +1,31 @@ +packages: + c: + require: [apple-clang@17.0.0] + cxx: + require: [apple-clang@17.0.0] + fortran: + require: [gcc@15.2.0] + mpi: + require: [openmpi@=5.0.10] + apple-clang: + externals: + - spec: apple-clang@17.0.0 languages:='c,c++' + prefix: /usr + extra_attributes: + compilers: + c: /usr/bin/clang + cxx: /usr/bin/clang++ + gcc: + buildable: False + externals: + - spec: gcc@15.2.0 languages:='fortran' + prefix: @BREW_PREFIX@ + extra_attributes: + compilers: + fortran: @BREW_PREFIX@/bin/gfortran-15 + + # ESMF by default for Darwin.gfortranclang turns off OpenMP, so + # we do the same here to avoid build failures. + esmf: + require:: + - '~openmp' diff --git a/configs/sites/tier2/macos.gmao/toolchains.yaml b/configs/sites/tier2/macos.gmao/toolchains.yaml new file mode 100644 index 000000000..7b140d268 --- /dev/null +++ b/configs/sites/tier2/macos.gmao/toolchains.yaml @@ -0,0 +1,29 @@ +toolchains: + apple-gfortran-15: + - spec: "%c=apple-clang" + when: "%c" + - spec: "%cxx=apple-clang" + when: "%cxx" + - spec: "%fortran=gcc@15" + when: "%fortran" + apple-gfortran-14: + - spec: "%c=apple-clang" + when: "%c" + - spec: "%cxx=apple-clang" + when: "%cxx" + - spec: "%fortran=gcc@14" + when: "%fortran" + gcc-gfortran-15: + - spec: "%c=gcc@15" + when: "%c" + - spec: "%cxx=gcc@15" + when: "%cxx" + - spec: "%fortran=gcc@15" + when: "%fortran" + apple-nag: + - spec: "%c=apple-clang" + when: "%c" + - spec: "%cxx=apple-clang" + when: "%cxx" + - spec: "%fortran=nag" + when: "%fortran" From af3c7edf1a6e5c56ea02e7b7409ec10012dcf714 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 16 Apr 2026 13:40:49 -0400 Subject: [PATCH 10/39] Update for meta_modules --- spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py b/spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py index 447891dc9..5d582aa55 100755 --- a/spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py +++ b/spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py @@ -403,10 +403,10 @@ def custom_sort_key(entry): logging.debug(" ... ... MODULELOADS: {}".format(substitutes["MODULELOADS"])) # Compiler environment variables; names are lowercase in spack - substitutes["CC"] = compiler.extra_attributes["compilers"]["c"] - substitutes["CXX"] = compiler.extra_attributes["compilers"]["cxx"] - substitutes["F77"] = compiler.extra_attributes["compilers"]["fortran"] - substitutes["FC"] = compiler.extra_attributes["compilers"]["fortran"] + substitutes["CC"] = compiler.extra_attributes.get("compilers", {}).get("c", "") + substitutes["CXX"] = compiler.extra_attributes.get("compilers", {}).get("cxx", "") + substitutes["F77"] = compiler.extra_attributes.get("compilers", {}).get("fortran", "") + substitutes["FC"] = compiler.extra_attributes.get("compilers", {}).get("fortran", "") logging.debug(" ... ... CC : {}".format(substitutes["CC"])) logging.debug(" ... ... CXX : {}".format(substitutes["CXX"])) logging.debug(" ... ... F77 : {}".format(substitutes["F77"])) From c25de7b4f3fbb186360b6dda892efee459acf5ed Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 16 Apr 2026 13:41:34 -0400 Subject: [PATCH 11/39] Batch updates for macos.gmao site --- util/gmao/batch_install.sh | 136 ++++++++++++++++++++++++++++++++----- 1 file changed, 120 insertions(+), 16 deletions(-) diff --git a/util/gmao/batch_install.sh b/util/gmao/batch_install.sh index 64a8a56b5..b5351e52e 100755 --- a/util/gmao/batch_install.sh +++ b/util/gmao/batch_install.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash -x +#!/usr/bin/env bash SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) SPACK_STACK_DIR=$(dirname $(dirname ${SCRIPT_DIR})) @@ -22,6 +22,33 @@ SPACK_STACK_PACKAGES_TO_TEST=( # Options # ################################################################################################## +################################################################################################## +# macOS Prerequisites Check # +################################################################################################## + +check_macos_prerequisites() { + if ! command -v brew &> /dev/null; then + echo "ERROR: brew is not installed or not in PATH." + exit 1 + fi + + local missing_pkgs=() + local required_pkgs=(coreutils gcc git lmod wget bash tcsh cmake openssl rust) + + for pkg in "${required_pkgs[@]}"; do + if ! brew --prefix "$pkg" &> /dev/null; then + missing_pkgs+=("$pkg") + fi + done + + if [ ${#missing_pkgs[@]} -ne 0 ]; then + echo "ERROR: Missing required Homebrew packages: ${missing_pkgs[*]}" + echo "Please run: brew install ${missing_pkgs[*]}" + exit 1 + fi +} + + usage() { set +x echo @@ -169,8 +196,15 @@ case ${SPACK_STACK_BATCH_HOST} in SPACK_STACK_BATCH_COMPILERS=("gcc@=15.2.0") SPACK_STACK_BATCH_TEMPLATES=("geos-dev") SPACK_STACK_MODULE_CHOICE="lmod" - SPACK_STACK_BOOTSTRAP_MIRROR="/Users/mathomp4/prod/spack-bootstrap-mirror" - SPACK_STACK_CARGO_MIRROR="/Users/mathomp4/prod/spack-cargo-mirror" + SPACK_STACK_BOOTSTRAP_MIRROR="/Users/mathomp4/spack-stack-mirrors/spack-bootstrap-mirror" + SPACK_STACK_CARGO_MIRROR="/Users/mathomp4/spack-stack-mirrors/spack-cargo-mirror" + ;; + macos.gmao) + SPACK_STACK_BATCH_COMPILERS=("gcc@=15.2.0") + SPACK_STACK_BATCH_TEMPLATES=("geos-dev") + SPACK_STACK_MODULE_CHOICE="lmod" + SPACK_STACK_BOOTSTRAP_MIRROR="${HOME}/spack-stack-mirrors/spack-bootstrap-mirror" + SPACK_STACK_CARGO_MIRROR="${HOME}/spack-stack-mirrors/spack-cargo-mirror" ;; *) echo "ERROR, host ${SPACK_STACK_BATCH_HOST} not configured" @@ -210,6 +244,8 @@ function fix_permissions() { ;; alderaan) ;; + macos.gmao) + ;; *) echo "ERROR, xargs-chmod command not configured for ${host}" exit 1 @@ -282,6 +318,8 @@ echo echo "Welcome to GMAO SPACK-STACK BATCH INSTALL" echo +LOG_TIMESTAMP=$(date +"%Y%m%d_%H%M%S") + if [[ ! -e "setup.sh" || ! -e ".spackstack" ]]; then echo "ERROR, this script must be executed from the top-level spack-stack directory" exit 1 @@ -442,14 +480,21 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do fi if [[ ! ${env_exists} == "true" ]]; then + if [[ "${host}" == "macos.gmao" ]]; then + echo "[DRY-RUN] Would check macOS prerequisites and generate YAML configs from templates" + fi echo "[DRY-RUN] spack stack create env --name=${env_name} \\" echo " --site=${host} --compiler=${compiler_name}-${compiler_version} \\" echo " --template=${template} --dir=${environment_dirs} --treat-warnings-as-errors" fi echo "[DRY-RUN] spack env activate -p ${env_dir}" + if [[ "${host}" == "macos.gmao" && ! ${env_exists} == "true" ]]; then + echo "[DRY-RUN] spack external find --not-buildable autoconf automake bash cmake cvs doxygen gawk git-lfs groff libtool ninja npm subversion swig texinfo" + echo "[DRY-RUN] generating spack-macos-externals.yaml and applying with 'spack config add -f'" + fi echo "[DRY-RUN] spack bootstrap now" echo "[DRY-RUN] spack concretize --force --fresh" - + if [[ "${update_source_cache}" == "true"* ]]; then echo "[DRY-RUN] spack mirror create -a -d " fi @@ -471,7 +516,7 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do echo "[DRY-RUN] spack module ${module_choice} refresh --yes --upstream-modules" echo "[DRY-RUN] spack stack setup-meta-modules" fi - + echo "[DRY-RUN] spack clean -d -f -m -p -s" echo "[DRY-RUN] spack env deactivate" echo "" @@ -527,6 +572,16 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do fi set -e ;; + macos.gmao) + set +e + ulimit -s unlimited 2>/dev/null || ulimit -s hard 2>/dev/null || ulimit -s 65532 2>/dev/null || true + if ! command -v module &> /dev/null; then + if command -v brew &> /dev/null; then + . $(brew --prefix)/opt/lmod/init/bash 2>/dev/null || true + fi + fi + set -e + ;; *) echo "ERROR, host ${host} not configured for resetting environment" exit 1 @@ -551,7 +606,7 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do tmp_bootstrap_mirror_path=${PWD}/tmp-bootstrap-mirror echo "Creating bootstrap mirror ${tmp_bootstrap_mirror_path} ..." rm -fr ${tmp_bootstrap_mirror_path} - spack bootstrap mirror --binary-packages ${tmp_bootstrap_mirror_path} 2>&1 | tee log.bootstrap-mirror.001 + spack bootstrap mirror --binary-packages ${tmp_bootstrap_mirror_path} 2>&1 | tee log.bootstrap-mirror.${LOG_TIMESTAMP} rsync -a ${tmp_bootstrap_mirror_path}/ ${bootstrap_mirror_path}/ rm -fr ${tmp_bootstrap_mirror_path} # Update buildcache index @@ -566,16 +621,59 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do fi if [[ ! ${env_exists} == "true" ]]; then + if [[ "${host}" == "macos.gmao" ]]; then + check_macos_prerequisites + + macos_site_dir="${SPACK_STACK_DIR}/configs/sites/tier2/macos.gmao" + brew_prefix=$(brew --prefix) + + sed "s#@HOME@#${HOME}#g" "${macos_site_dir}/mirrors.yaml.template" > "${macos_site_dir}/mirrors.yaml" + sed "s#@BREW_PREFIX@#${brew_prefix}#g" "${macos_site_dir}/packages_gcc-15.2.0.yaml.template" > "${macos_site_dir}/packages_gcc-15.2.0.yaml" + + if [[ -d "${SPACK_STACK_DIR}/.git" ]]; then + grep -q "^configs/sites/tier2/macos.gmao/mirrors.yaml$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "configs/sites/tier2/macos.gmao/mirrors.yaml" >> "${SPACK_STACK_DIR}/.git/info/exclude" + grep -q "^configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml" >> "${SPACK_STACK_DIR}/.git/info/exclude" + fi + fi + spack stack create env --name=${env_name} \ --site=${host} \ --compiler=${compiler_name}-${compiler_version} \ --template=${template} \ --dir=${environment_dirs} \ --treat-warnings-as-errors \ - 2>&1 | tee log.create.${env_name}.001 + 2>&1 | tee log.create.${env_name}.${LOG_TIMESTAMP} fi spack env activate -p ${env_dir} + if [[ "${host}" == "macos.gmao" && ! ${env_exists} == "true" ]]; then + echo "Running spack external find for macOS generic packages..." + spack external find --not-buildable autoconf automake bash cmake cvs doxygen gawk git-lfs groff libtool ninja npm subversion swig texinfo + + brew_prefix=$(brew --prefix) + tcsh_version=$(${brew_prefix}/bin/tcsh --version | awk '{print $2}') + rust_version=$(${brew_prefix}/bin/rustc --version | awk '{print $2}') + + echo "Manually injecting tricky macOS packages into Spack configuration..." + cat << EOF > spack-macos-externals.yaml +packages: + tcsh: + externals: + - spec: tcsh@${tcsh_version} + prefix: ${brew_prefix} + rust: + externals: + - spec: rust@${rust_version} + prefix: ${brew_prefix} + extra_attributes: + cargo: ${brew_prefix}/bin/cargo + compilers: + rust: ${brew_prefix}/bin/rustc +EOF + spack config add -f spack-macos-externals.yaml + rm -f spack-macos-externals.yaml + fi + echo "Registering bootstrap mirror ${bootstrap_mirror_path} ..." if [[ ! -d ${bootstrap_mirror_path} ]]; then echo "ERROR, directory ${bootstrap_mirror_path} not found" @@ -614,10 +712,10 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do # Bootstrap spack explicitly echo "Bootstrapping spack ..." - spack bootstrap now 2>&1 | tee log.bootstrap.${env_name}.001 + spack bootstrap now 2>&1 | tee log.bootstrap.${env_name}.${LOG_TIMESTAMP} # Concretize environment, and check that spack.lock is created - spack concretize --force --fresh 2>&1 | tee log.concretize.${env_name}.001 + spack concretize --force --fresh 2>&1 | tee log.concretize.${env_name}.${LOG_TIMESTAMP} if [[ ! -e ${env_dir}/spack.lock ]]; then echo "ERROR during concretization of environment ${env_name}, spack.lock not found" exit 1 @@ -670,6 +768,12 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do esac install_script=${PWD}/spack-install.${env_name}.sh + + # Locally ignore the generated install script in git without changing global .gitignore + if [[ -d "${SPACK_STACK_DIR}/.git" ]] && ! grep -q "^spack-install\.\*\.sh$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null; then + echo "spack-install.*.sh" >> "${SPACK_STACK_DIR}/.git/info/exclude" + fi + cat << EOF > ${install_script} #!/usr/bin/env bash @@ -680,26 +784,26 @@ $(declare -p test_packages) # If no tests are required, install everything if [[ \${#test_packages[@]} -eq 0 ]]; then set -o pipefail - spack install --verbose ${buildcache_install_flags} ${parallel_install_flags} 2>&1 | tee log.install.${env_name}.001 + spack install --verbose ${buildcache_install_flags} ${parallel_install_flags} 2>&1 | tee log.install.${env_name}.${LOG_TIMESTAMP} set +o pipefail else for (( idx=0; idx<\${#test_packages[@]}; idx++ )); do test_package=\${test_packages[\${idx}]} # First, check if this package is in this environment set +e - grep -e "\${test_package}@" log.concretize.${env_name}.001 || continue + grep -e "\${test_package}@" log.concretize.${env_name}.${LOG_TIMESTAMP} || continue set -e idx_padded=\$(printf "%03d" "\$((idx+1))") set -o pipefail spack install --verbose ${buildcache_install_flags} ${parallel_install_flags} --only=dependencies \${test_package} \\ - 2>&1 | tee log.install.${env_name}.\${idx_padded}.\${test_package}-dependencies - spack install --verbose --no-cache --test=root \${test_package} 2>&1 | tee log.install.${env_name}.\${idx_padded}.\${test_package} + 2>&1 | tee log.install.${env_name}.${LOG_TIMESTAMP}.\${idx_padded}.\${test_package}-dependencies + spack install --verbose --no-cache --test=root \${test_package} 2>&1 | tee log.install.${env_name}.${LOG_TIMESTAMP}.\${idx_padded}.\${test_package} set +o pipefail done # idx now equals the length of the array; install the rest idx_padded=\$(printf "%03d" "\$((idx+1))") set -o pipefail - spack install --verbose ${buildcache_install_flags} ${parallel_install_flags} 2>&1 | tee log.install.${env_name}.\${idx_padded} + spack install --verbose ${buildcache_install_flags} ${parallel_install_flags} 2>&1 | tee log.install.${env_name}.${LOG_TIMESTAMP}.\${idx_padded} set +o pipefail fi EOF @@ -718,8 +822,8 @@ EOF # In install mode, create environment modules if [[ "${update_build_cache}" == "false" ]]; then - spack module ${module_choice} refresh --yes --upstream-modules 2>&1 | tee log.modules.${env_name}.001 - spack stack setup-meta-modules 2>&1 | tee log.setup-meta-modules.${env_name}.001 + spack module ${module_choice} refresh --yes --upstream-modules 2>&1 | tee log.modules.${env_name}.${LOG_TIMESTAMP} + spack stack setup-meta-modules 2>&1 | tee log.setup-meta-modules.${env_name}.${LOG_TIMESTAMP} fi # When creating or updating buildcaches, fix permissions for mirrors. From 253c942a44bb9c15e51f7376762a59cf4a8a723b Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Fri, 17 Apr 2026 08:27:34 -0400 Subject: [PATCH 12/39] Update builtin repo --- repos/builtin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repos/builtin b/repos/builtin index e2e4f2d6e..84e3e78ef 160000 --- a/repos/builtin +++ b/repos/builtin @@ -1 +1 @@ -Subproject commit e2e4f2d6ea11685a3aec5dc725c28b6d188dc8b1 +Subproject commit 84e3e78ef3e2cf1814c2c4c864c664aaecb5f438 From a7037205ad76c3b40c394f5f6e5054bbbf1f9bac Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Fri, 17 Apr 2026 15:38:33 -0400 Subject: [PATCH 13/39] Updates for macos.gmao --- configs/sites/tier2/macos.gmao/README.md | 242 ++++++++++++++++++ ...ml => packages_clang-22.1.3.yaml.template} | 4 +- .../packages_gcc-15.2.0.yaml.template | 2 +- .../packages_nag-7.2.7243.yaml.template | 31 +++ .../sites/tier2/macos.gmao/toolchains.yaml | 29 --- 5 files changed, 276 insertions(+), 32 deletions(-) create mode 100644 configs/sites/tier2/macos.gmao/README.md rename configs/sites/tier2/macos.gmao/{packages_clang-22.1.3.yaml => packages_clang-22.1.3.yaml.template} (83%) create mode 100644 configs/sites/tier2/macos.gmao/packages_nag-7.2.7243.yaml.template delete mode 100644 configs/sites/tier2/macos.gmao/toolchains.yaml diff --git a/configs/sites/tier2/macos.gmao/README.md b/configs/sites/tier2/macos.gmao/README.md new file mode 100644 index 000000000..6a48d2644 --- /dev/null +++ b/configs/sites/tier2/macos.gmao/README.md @@ -0,0 +1,242 @@ +Default macOS for GMAO + +--- + +## Table of Contents + +- [Overview](#overview) +- [Brew Packages Required](#brew-packages-required) +- [Clone spack-stack](#clone-spack-stack) +- [Setup spack-stack](#setup-spack-stack) +- [Using batch\_install.sh script](#using-batch_installsh-script) + - [First run](#first-run) + - [Subsequent builds](#subsequent-builds) + - [Installing from build caches](#installing-from-build-caches) + - [Loading the stack](#loading-the-stack) +- [Building the stack by hand](#building-the-stack-by-hand) + - [Create Environments](#create-environments) + - [Activate the Environment](#activate-the-environment) + - [Concretize the Environment](#concretize-the-environment) + - [Create Source Cache](#create-source-cache) + - [Pre-Fetch Cargo Dependencies](#pre-fetch-cargo-dependencies) + - [Install Packages](#install-packages) + - [Update Module Files](#update-module-files) + - [Deactivate the Environment](#deactivate-the-environment) +- [Debugging Package Builds](#debugging-package-builds) + +--- + +## Overview + +This configuration provides a generalized Spack Stack setup for GMAO users on macOS using Homebrew. It serves as a generic Tier 2 site `macos.gmao` that dynamically detects your Homebrew installation prefix. + +--- + +## Brew Packages Required + +You must have `brew` installed and the following packages available. (Note: compilers like NAG or Intel are installed out-of-band and configured separately). + +```bash +brew install coreutils +brew install gcc@15 +brew install flang +brew install git +brew install lmod +brew install wget +brew install bash +brew install tcsh +brew install cmake +brew install openssl +brew install rust +``` + +--- + +## Clone spack-stack + +Use the appropriate branch or tag: + +```bash +git clone --recurse-submodules https://github.com/GMAO-SI-Team/spack-stack.git -b geos-testing spack-stack-dev +``` + +--- + +## Setup spack-stack + +Activate the base spack-stack environment: + +```bash +cd spack-stack-dev +. ./setup.sh +``` + +--- + +## Using batch_install.sh script + +The `batch_install.sh` script automates the creation of environments (e.g., `gcc` and `clang` builds), populating your Spack bootstrap caches, and running the Spack installation pipeline. + +### Usage help + +```bash +./util/gmao/batch_install.sh -h +``` + +### First run (Building Bootstrap and Source Caches) + +When you first run the script on a new machine, you need to use the `-u` option. This tells Spack to build the bootstrap mirror and source caches locally before attempting to register them. + +```bash +./util/gmao/batch_install.sh -r dev -m build -H macos.gmao -u -e +``` + +- `-r dev -m build`: Sets the developer mode and tells Spack to build the environments. +- `-H macos.gmao`: Overrides hostname detection. This is required to force the script to use this specific generic macOS site, avoiding issues where VPNs or routers mask the real hostname. +- `-u`: Updates and populates the bootstrap/source caches. +- `-e`: Allows continuing builds in existing environments (prevents the script from failing if the environment directories were just created). + +### Subsequent builds + +Once the initial caches are set up, you can run builds without the `-u` flag: + +```bash +./util/gmao/batch_install.sh -r dev -m build -H macos.gmao -e +``` + +### Installing from build caches + +If you are just installing environments using already populated build caches (the typical workflow for users after the initial maintainer setup), use `-m install`: + +```bash +./util/gmao/batch_install.sh -r dev -m install -H macos.gmao -e +``` + +### Loading the stack + +Once the installation and module generation are complete, you can point your shell to the newly built modules: + +```bash +module use -a /path/to/envs/ge-gcc-15.2.0/modules/Core +``` + +Then load the stack and your target environment (e.g., for GEOSgcm work): + +```bash +module load stack-gcc stack-openmpi geos-gcm-env +``` + +--- + +## Building the stack by hand + +If you prefer to run the Spack commands manually instead of using `batch_install.sh`, follow these steps. + +### Create Environments + +You only need to create each environment once. Our `macos.gmao` site configurations use `.template` files to dynamically set your local `brew` paths, so you must use `spack stack create env` which automatically resolves them. + +#### GCC Environment + +```bash +spack stack create env --name ge-gcc-15.2.0 --template geos-dev --site macos.gmao --compiler=gcc-15.2.0 +``` + +#### Flang Environment + +```bash +spack stack create env --name ge-clang-22.1.3 --template geos-dev --site macos.gmao --compiler=clang-22.1.3 +``` + +--- + +### Activate the Environment + +```bash +cd envs/ge-gcc-15.2.0 +spack env activate -p . +``` + +> **Important:** Run this in *every* terminal where you plan to run Spack commands for this environment. + +--- + +### Concretize the Environment + +```bash +spack concretize 2>&1 | tee log.concretize ; bell +``` + +*(Optional `bell` helper: `bell() { tput bel ; printf "\nFinished at: " ; date; }`)* + +--- + +### Create Source Cache + +This downloads all source tarballs for your concretized environment to prevent network timeouts during the build: + +```bash +spack mirror create -a -d $HOME/spack-stack-mirrors/spack-source-mirror +``` + +> ⚠️ **Do not run this outside an activated environment.** +> Otherwise, Spack will attempt to mirror **every** known package and version in the registry. + +--- + +### Pre-Fetch Cargo Dependencies + +Rust packages frequently require network access during the build. Pre-fetch their dependencies to the cargo mirror: + +```bash +export CARGO_HOME=$HOME/spack-stack-mirrors/spack-cargo-mirror +../../util/fetch_cargo_deps.py +``` + +> ⚠️ **Set `CARGO_HOME` in your environment before running `spack install`.** + +--- + +### Install Packages + +```bash +export CARGO_HOME=$HOME/spack-stack-mirrors/spack-cargo-mirror +spack install -j 6 --verbose --fail-fast --show-log-on-error --no-check-signature 2>&1 | tee log.install ; bell +``` + +> **Note:** You may need to re-run this command if a package fails due to an intermittent network issue or parallel build race condition. + +--- + +### Update Module Files + +After installation completes, regenerate the Lmod module tree and meta-modules: + +```bash +spack module lmod refresh -y --delete-tree ; bell +spack stack setup-meta-modules +``` + +--- + +### Deactivate the Environment + +```bash +spack env deactivate +``` + +--- + +## Debugging Package Builds + +If a specific package fails to build, you can drop into Spack's build environment to debug it manually: + +```bash +spack clean +spack stage +cd $(spack location -s ) +spack build-env -- bash --norc --noprofile +``` + +This drops you into a clean bash shell with the exact environment variables, compiler wrappers, and dependencies loaded that Spack uses during the build. + diff --git a/configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml b/configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml.template similarity index 83% rename from configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml rename to configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml.template index ef8c19c5d..a094e9fdb 100644 --- a/configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml +++ b/configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml.template @@ -19,7 +19,7 @@ packages: buildable: False externals: - spec: llvm@21.1.3 ~clang +flang languages:='fortran' - prefix: /Users/mathomp4/.homebrew/brew + prefix: @BREW_PREFIX@ extra_attributes: compilers: - fortran: /Users/mathomp4/.homebrew/brew/bin/flang + fortran: @BREW_PREFIX@/bin/flang diff --git a/configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml.template b/configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml.template index ea6bb02d8..3ac85e561 100644 --- a/configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml.template +++ b/configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml.template @@ -27,5 +27,5 @@ packages: # ESMF by default for Darwin.gfortranclang turns off OpenMP, so # we do the same here to avoid build failures. esmf: - require:: + require: - '~openmp' diff --git a/configs/sites/tier2/macos.gmao/packages_nag-7.2.7243.yaml.template b/configs/sites/tier2/macos.gmao/packages_nag-7.2.7243.yaml.template new file mode 100644 index 000000000..ef888cc00 --- /dev/null +++ b/configs/sites/tier2/macos.gmao/packages_nag-7.2.7243.yaml.template @@ -0,0 +1,31 @@ +packages: + c: + require: [apple-clang@17.0.0] + cxx: + require: [apple-clang@17.0.0] + fortran: + require: [nag@7.2.7243] + mpi: + require: [openmpi@=5.0.10] + apple-clang: + externals: + - spec: apple-clang@17.0.0 languages:='c,c++' + prefix: /usr + extra_attributes: + compilers: + c: /usr/bin/clang + cxx: /usr/bin/clang++ + nag: + buildable: False + externals: + - spec: nag@7.2.7243 languages:='fortran' + prefix: /Users/mathomp4/installed/Core/nag/7.2.43 + extra_attributes: + compilers: + fortran: /Users/mathomp4/installed/Core/nag/7.2.43/bin/nagfor + + # ESMF by default for Darwin.gfortranclang turns off OpenMP, so + # we do the same here to avoid build failures. + esmf: + require: + - '~openmp' diff --git a/configs/sites/tier2/macos.gmao/toolchains.yaml b/configs/sites/tier2/macos.gmao/toolchains.yaml deleted file mode 100644 index 7b140d268..000000000 --- a/configs/sites/tier2/macos.gmao/toolchains.yaml +++ /dev/null @@ -1,29 +0,0 @@ -toolchains: - apple-gfortran-15: - - spec: "%c=apple-clang" - when: "%c" - - spec: "%cxx=apple-clang" - when: "%cxx" - - spec: "%fortran=gcc@15" - when: "%fortran" - apple-gfortran-14: - - spec: "%c=apple-clang" - when: "%c" - - spec: "%cxx=apple-clang" - when: "%cxx" - - spec: "%fortran=gcc@14" - when: "%fortran" - gcc-gfortran-15: - - spec: "%c=gcc@15" - when: "%c" - - spec: "%cxx=gcc@15" - when: "%cxx" - - spec: "%fortran=gcc@15" - when: "%fortran" - apple-nag: - - spec: "%c=apple-clang" - when: "%c" - - spec: "%cxx=apple-clang" - when: "%cxx" - - spec: "%fortran=nag" - when: "%fortran" From 96b8cae5b34b1b3e085c1cbb161862b0f286221a Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Fri, 17 Apr 2026 15:38:57 -0400 Subject: [PATCH 14/39] Add nag template --- configs/templates/geos-dev-nag/spack.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 configs/templates/geos-dev-nag/spack.yaml diff --git a/configs/templates/geos-dev-nag/spack.yaml b/configs/templates/geos-dev-nag/spack.yaml new file mode 100644 index 000000000..56217c4be --- /dev/null +++ b/configs/templates/geos-dev-nag/spack.yaml @@ -0,0 +1,19 @@ +# Template for GEOS development +# +spack: + concretizer: + unify: when_possible + + view: false + include: [] + + specs: + - geos-gcm-env ~debug ^esmf@=9.0.0b10 + - geos-gcm-env +debug ^esmf@=9.0.0b10 + + + packages: + # Turn on python variant for esmf + esmf: + require: + - +python From 32ae9bcab9e315949f677d20e66e4447ccdf5a26 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Fri, 17 Apr 2026 15:39:31 -0400 Subject: [PATCH 15/39] Add Python_ROOT_DIR and Python3_ROOT_DIR --- configs/common/modules_lmod.yaml | 5 +++++ configs/common/modules_tcl.yaml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/configs/common/modules_lmod.yaml b/configs/common/modules_lmod.yaml index 62653a174..24a3773d0 100644 --- a/configs/common/modules_lmod.yaml +++ b/configs/common/modules_lmod.yaml @@ -277,6 +277,11 @@ modules: environment: set: 'UDUNITS2_XML_PATH': '{prefix}/share/udunits/udunits2.xml' + python: + environment: + set: + 'Python_ROOT_DIR': '{prefix}' + 'Python3_ROOT_DIR': '{prefix}' hierarchy: - mpi diff --git a/configs/common/modules_tcl.yaml b/configs/common/modules_tcl.yaml index 48c547702..a3097f320 100644 --- a/configs/common/modules_tcl.yaml +++ b/configs/common/modules_tcl.yaml @@ -296,3 +296,8 @@ modules: environment: set: 'UDUNITS2_XML_PATH': '{prefix}/share/udunits/udunits2.xml' + python: + environment: + set: + 'Python_ROOT_DIR': '{prefix}' + 'Python3_ROOT_DIR': '{prefix}' From 85fcc4e584aa50f9b9c207fb00ef2e5b6f86e2ce Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Fri, 17 Apr 2026 15:39:44 -0400 Subject: [PATCH 16/39] Latest updates of batch script --- util/gmao/batch_install.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/util/gmao/batch_install.sh b/util/gmao/batch_install.sh index b5351e52e..50583de28 100755 --- a/util/gmao/batch_install.sh +++ b/util/gmao/batch_install.sh @@ -193,6 +193,7 @@ case ${SPACK_STACK_BATCH_HOST} in ;; alderaan) #SPACK_STACK_BATCH_COMPILERS=("gcc@=15.2.0" "clang@=22.1.3") + #SPACK_STACK_BATCH_COMPILERS=("gcc@=15.2.0" "nag@=7.2.7243") SPACK_STACK_BATCH_COMPILERS=("gcc@=15.2.0") SPACK_STACK_BATCH_TEMPLATES=("geos-dev") SPACK_STACK_MODULE_CHOICE="lmod" @@ -200,8 +201,9 @@ case ${SPACK_STACK_BATCH_HOST} in SPACK_STACK_CARGO_MIRROR="/Users/mathomp4/spack-stack-mirrors/spack-cargo-mirror" ;; macos.gmao) + #SPACK_STACK_BATCH_COMPILERS=("gcc@=15.2.0" "nag@=7.2.7243") SPACK_STACK_BATCH_COMPILERS=("gcc@=15.2.0") - SPACK_STACK_BATCH_TEMPLATES=("geos-dev") + SPACK_STACK_BATCH_TEMPLATES=("geos-dev" "geos-dev-nag") SPACK_STACK_MODULE_CHOICE="lmod" SPACK_STACK_BOOTSTRAP_MIRROR="${HOME}/spack-stack-mirrors/spack-bootstrap-mirror" SPACK_STACK_CARGO_MIRROR="${HOME}/spack-stack-mirrors/spack-cargo-mirror" @@ -430,6 +432,13 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do #echo "Skipping template ${template} with compiler ${compiler}" #continue #fi + if [[ "${template}" == "geos-dev" && "${compiler_name}" == "nag" ]]; then + echo "Skipping template ${template} with compiler ${compiler} (fms not supported by nag)" + continue + elif [[ "${template}" == "geos-dev-nag" && "${compiler_name}" != "nag" ]]; then + echo "Skipping template ${template} with compiler ${compiler} (geos-dev-nag is only for nag)" + continue + fi echo "Processing template ${template} with compiler ${compiler}" ############################################################# @@ -441,6 +450,9 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do geos-dev) env_name_prefix="ge" ;; + geos-dev-nag) + env_name_prefix="genag" + ;; *) echo "ERROR, template ${template} not configured" exit 1 @@ -629,10 +641,12 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do sed "s#@HOME@#${HOME}#g" "${macos_site_dir}/mirrors.yaml.template" > "${macos_site_dir}/mirrors.yaml" sed "s#@BREW_PREFIX@#${brew_prefix}#g" "${macos_site_dir}/packages_gcc-15.2.0.yaml.template" > "${macos_site_dir}/packages_gcc-15.2.0.yaml" + sed "s#@BREW_PREFIX@#${brew_prefix}#g" "${macos_site_dir}/packages_clang-22.1.3.yaml.template" > "${macos_site_dir}/packages_clang-22.1.3.yaml" if [[ -d "${SPACK_STACK_DIR}/.git" ]]; then grep -q "^configs/sites/tier2/macos.gmao/mirrors.yaml$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "configs/sites/tier2/macos.gmao/mirrors.yaml" >> "${SPACK_STACK_DIR}/.git/info/exclude" grep -q "^configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml" >> "${SPACK_STACK_DIR}/.git/info/exclude" + grep -q "^configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml" >> "${SPACK_STACK_DIR}/.git/info/exclude" fi fi From 25f991e563ec394a31fc726f7c18324ee0eeaf22 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Mon, 20 Apr 2026 15:21:27 -0400 Subject: [PATCH 17/39] Update for nag --- util/gmao/batch_install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util/gmao/batch_install.sh b/util/gmao/batch_install.sh index 50583de28..3ae945daa 100755 --- a/util/gmao/batch_install.sh +++ b/util/gmao/batch_install.sh @@ -642,11 +642,13 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do sed "s#@HOME@#${HOME}#g" "${macos_site_dir}/mirrors.yaml.template" > "${macos_site_dir}/mirrors.yaml" sed "s#@BREW_PREFIX@#${brew_prefix}#g" "${macos_site_dir}/packages_gcc-15.2.0.yaml.template" > "${macos_site_dir}/packages_gcc-15.2.0.yaml" sed "s#@BREW_PREFIX@#${brew_prefix}#g" "${macos_site_dir}/packages_clang-22.1.3.yaml.template" > "${macos_site_dir}/packages_clang-22.1.3.yaml" + sed "s#@BREW_PREFIX@#${brew_prefix}#g" "${macos_site_dir}/packages_nag-7.2.7243.yaml.template" > "${macos_site_dir}/packages_nag-7.2.7243.yaml" if [[ -d "${SPACK_STACK_DIR}/.git" ]]; then grep -q "^configs/sites/tier2/macos.gmao/mirrors.yaml$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "configs/sites/tier2/macos.gmao/mirrors.yaml" >> "${SPACK_STACK_DIR}/.git/info/exclude" grep -q "^configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml" >> "${SPACK_STACK_DIR}/.git/info/exclude" grep -q "^configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml" >> "${SPACK_STACK_DIR}/.git/info/exclude" + grep -q "^configs/sites/tier2/macos.gmao/packages_nag-7.2.7243.yaml$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "configs/sites/tier2/macos.gmao/packages_nag-7.2.7243.yaml" >> "${SPACK_STACK_DIR}/.git/info/exclude" fi fi From 5569389f3ce5021948240d932880f2df4d7a0dca Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 21 Apr 2026 07:25:10 -0400 Subject: [PATCH 18/39] Need some openmpi env vars --- configs/sites/tier2/macos.gmao/modules.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configs/sites/tier2/macos.gmao/modules.yaml b/configs/sites/tier2/macos.gmao/modules.yaml index e13bb47f4..828f542af 100644 --- a/configs/sites/tier2/macos.gmao/modules.yaml +++ b/configs/sites/tier2/macos.gmao/modules.yaml @@ -22,6 +22,11 @@ modules: '': - CMAKE_PREFIX_PATH lmod: + openmpi: + environment: + set: + 'TMPDIR': '/tmp' + 'OMPI_MCA_btl': '^tcp' all: filter: exclude_env_vars: From 79a8ea5c76d5df55993aecbd1fb185a9e01a1c7d Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 21 Apr 2026 07:33:12 -0400 Subject: [PATCH 19/39] Updates for openmpi for macos.gmao --- .../macos.gmao/packages_clang-22.1.3.yaml.template | 9 +++++++++ .../macos.gmao/packages_gcc-15.2.0.yaml.template | 12 ++++++++++++ .../macos.gmao/packages_nag-7.2.7243.yaml.template | 12 +++++++++++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml.template b/configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml.template index a094e9fdb..757c6fa88 100644 --- a/configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml.template +++ b/configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml.template @@ -23,3 +23,12 @@ packages: extra_attributes: compilers: fortran: @BREW_PREFIX@/bin/flang + + openmpi: + require:: + - '+internal-hwloc' + - '+internal-libevent' + - '+internal-pmix' + - '+fortran' + # GEOS requires a flat namespace to link properly on macOS + - '~two_level_namespace' diff --git a/configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml.template b/configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml.template index 3ac85e561..a518b0d17 100644 --- a/configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml.template +++ b/configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml.template @@ -24,8 +24,20 @@ packages: compilers: fortran: @BREW_PREFIX@/bin/gfortran-15 + openmpi: + require:: + - '+internal-hwloc' + - '+internal-libevent' + - '+internal-pmix' + - '+fortran' + # GEOS requires a flat namespace to link properly on macOS + - '~two_level_namespace' + # ESMF by default for Darwin.gfortranclang turns off OpenMP, so # we do the same here to avoid build failures. + # We also build as +debug only because testing shows that (so far) + # esmf + Darwin + gfortranclang needs ESMF_BOPT=g to work with GEOS esmf: require: - '~openmp' + - '+debug' diff --git a/configs/sites/tier2/macos.gmao/packages_nag-7.2.7243.yaml.template b/configs/sites/tier2/macos.gmao/packages_nag-7.2.7243.yaml.template index ef888cc00..73fa4c2d7 100644 --- a/configs/sites/tier2/macos.gmao/packages_nag-7.2.7243.yaml.template +++ b/configs/sites/tier2/macos.gmao/packages_nag-7.2.7243.yaml.template @@ -6,7 +6,7 @@ packages: fortran: require: [nag@7.2.7243] mpi: - require: [openmpi@=5.0.10] + require: [openmpi@=5.0.7] apple-clang: externals: - spec: apple-clang@17.0.0 languages:='c,c++' @@ -24,6 +24,16 @@ packages: compilers: fortran: /Users/mathomp4/installed/Core/nag/7.2.43/bin/nagfor + openmpi: + require:: + - '@=5.0.7' + - '+internal-hwloc' + - '+internal-libevent' + - '+internal-pmix' + - '+fortran' + # GEOS requires a flat namespace to link properly on macOS + - '~two_level_namespace' + # ESMF by default for Darwin.gfortranclang turns off OpenMP, so # we do the same here to avoid build failures. esmf: From 8060147df9a7bcc155e739d613e07d5f547bb879 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 21 Apr 2026 07:35:10 -0400 Subject: [PATCH 20/39] Bring over openblas configuration --- configs/sites/tier2/macos.gmao/packages.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configs/sites/tier2/macos.gmao/packages.yaml b/configs/sites/tier2/macos.gmao/packages.yaml index de01b25cf..57307fcb5 100644 --- a/configs/sites/tier2/macos.gmao/packages.yaml +++ b/configs/sites/tier2/macos.gmao/packages.yaml @@ -3,6 +3,11 @@ packages: netcdf-c: require: [+shared] + openblas: + require: + - '~dynamic_dispatch' + - 'build_system=cmake' + flex: externals: - spec: flex@2.6.4+lex From d192299f7e7ab0fbf65f217ac1f324928d760635 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 21 Apr 2026 07:36:21 -0400 Subject: [PATCH 21/39] Latest updates of batch script --- util/gmao/batch_install.sh | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/util/gmao/batch_install.sh b/util/gmao/batch_install.sh index 3ae945daa..ec7e64320 100755 --- a/util/gmao/batch_install.sh +++ b/util/gmao/batch_install.sh @@ -639,16 +639,16 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do macos_site_dir="${SPACK_STACK_DIR}/configs/sites/tier2/macos.gmao" brew_prefix=$(brew --prefix) - sed "s#@HOME@#${HOME}#g" "${macos_site_dir}/mirrors.yaml.template" > "${macos_site_dir}/mirrors.yaml" - sed "s#@BREW_PREFIX@#${brew_prefix}#g" "${macos_site_dir}/packages_gcc-15.2.0.yaml.template" > "${macos_site_dir}/packages_gcc-15.2.0.yaml" - sed "s#@BREW_PREFIX@#${brew_prefix}#g" "${macos_site_dir}/packages_clang-22.1.3.yaml.template" > "${macos_site_dir}/packages_clang-22.1.3.yaml" - sed "s#@BREW_PREFIX@#${brew_prefix}#g" "${macos_site_dir}/packages_nag-7.2.7243.yaml.template" > "${macos_site_dir}/packages_nag-7.2.7243.yaml" + sed "s#@HOME@#${HOME}#g" "${macos_site_dir}/mirrors.yaml.template" > "${SPACK_STACK_DIR}/mirrors.yaml.generated" + sed "s#@BREW_PREFIX@#${brew_prefix}#g" "${macos_site_dir}/packages_gcc-15.2.0.yaml.template" > "${SPACK_STACK_DIR}/packages_gcc-15.2.0.yaml.generated" + sed "s#@BREW_PREFIX@#${brew_prefix}#g" "${macos_site_dir}/packages_clang-22.1.3.yaml.template" > "${SPACK_STACK_DIR}/packages_clang-22.1.3.yaml.generated" + sed "s#@BREW_PREFIX@#${brew_prefix}#g" "${macos_site_dir}/packages_nag-7.2.7243.yaml.template" > "${SPACK_STACK_DIR}/packages_nag-7.2.7243.yaml.generated" if [[ -d "${SPACK_STACK_DIR}/.git" ]]; then - grep -q "^configs/sites/tier2/macos.gmao/mirrors.yaml$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "configs/sites/tier2/macos.gmao/mirrors.yaml" >> "${SPACK_STACK_DIR}/.git/info/exclude" - grep -q "^configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml" >> "${SPACK_STACK_DIR}/.git/info/exclude" - grep -q "^configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml" >> "${SPACK_STACK_DIR}/.git/info/exclude" - grep -q "^configs/sites/tier2/macos.gmao/packages_nag-7.2.7243.yaml$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "configs/sites/tier2/macos.gmao/packages_nag-7.2.7243.yaml" >> "${SPACK_STACK_DIR}/.git/info/exclude" + grep -q "^mirrors.yaml.generated$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "mirrors.yaml.generated" >> "${SPACK_STACK_DIR}/.git/info/exclude" + grep -q "^packages_gcc-15.2.0.yaml.generated$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "packages_gcc-15.2.0.yaml.generated" >> "${SPACK_STACK_DIR}/.git/info/exclude" + grep -q "^packages_clang-22.1.3.yaml.generated$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "packages_clang-22.1.3.yaml.generated" >> "${SPACK_STACK_DIR}/.git/info/exclude" + grep -q "^packages_nag-7.2.7243.yaml.generated$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "packages_nag-7.2.7243.yaml.generated" >> "${SPACK_STACK_DIR}/.git/info/exclude" fi fi @@ -659,6 +659,19 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do --dir=${environment_dirs} \ --treat-warnings-as-errors \ 2>&1 | tee log.create.${env_name}.${LOG_TIMESTAMP} + + # Move the generated YAMLs into the newly created environment site config + if [[ "${host}" == "macos.gmao" && ! ${env_exists} == "true" ]]; then + mv "${SPACK_STACK_DIR}/mirrors.yaml.generated" "${env_dir}/site/mirrors.yaml" + + if [[ -f "${SPACK_STACK_DIR}/packages_${compiler_name}-${compiler_version}.yaml.generated" ]]; then + # We only need the packages.yaml for the compiler we are actually using + mv "${SPACK_STACK_DIR}/packages_${compiler_name}-${compiler_version}.yaml.generated" "${env_dir}/site/packages_${compiler_name}-${compiler_version}.yaml" + fi + + # Clean up any leftover generated package yamls from other compilers + rm -f "${SPACK_STACK_DIR}/packages_*.yaml.generated" + fi fi spack env activate -p ${env_dir} From 61d37777b645410afae9992ee328d5cf080f386b Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 21 Apr 2026 07:36:45 -0400 Subject: [PATCH 22/39] Latest packages update --- repos/builtin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repos/builtin b/repos/builtin index 84e3e78ef..dec57a08f 160000 --- a/repos/builtin +++ b/repos/builtin @@ -1 +1 @@ -Subproject commit 84e3e78ef3e2cf1814c2c4c864c664aaecb5f438 +Subproject commit dec57a08f5ce8665d44c311f0deaa99e53155ae8 From d48816c09a87aa40ea052d2c57d0864d04afcef3 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 21 Apr 2026 08:02:33 -0400 Subject: [PATCH 23/39] More updates --- configs/sites/tier2/macos.gmao/README.md | 38 ++++++++++++++++--- ...ml.template => packages_nag.yaml.template} | 8 ++-- configs/templates/geos-dev-nag/spack.yaml | 2 +- configs/templates/geos-dev/spack.yaml | 2 +- 4 files changed, 38 insertions(+), 12 deletions(-) rename configs/sites/tier2/macos.gmao/{packages_nag-7.2.7243.yaml.template => packages_nag.yaml.template} (79%) diff --git a/configs/sites/tier2/macos.gmao/README.md b/configs/sites/tier2/macos.gmao/README.md index 6a48d2644..fb7c6feb3 100644 --- a/configs/sites/tier2/macos.gmao/README.md +++ b/configs/sites/tier2/macos.gmao/README.md @@ -83,6 +83,26 @@ The `batch_install.sh` script automates the creation of environments (e.g., `gcc ./util/gmao/batch_install.sh -h ``` +### Compiler Selection and NAG Support + +By default, `batch_install.sh` builds the `gcc@=15.2.0` stack. + +If the NAG Fortran compiler (`nagfor`) is found in your `PATH`, the script will automatically detect its version and add it to the build queue (e.g., `nag@=7.2.7243`). + +If your NAG compiler is installed in a non-standard location and not in your `PATH`, you can explicitly provide its path using the `-N` flag: + +```bash +./util/gmao/batch_install.sh -N /path/to/your/nag/bin/nagfor -r dev -m build -H macos.gmao -e +``` + +If you want to explicitly override the compilers built by the script entirely, use the `-C` flag with a comma-separated list of Spack compiler specs: + +```bash +./util/gmao/batch_install.sh -C "gcc@=15.2.0,nag@=7.2.7243" -r dev -m build -H macos.gmao -e +``` + +*Note: For every compiler you specify, you must have a corresponding `packages_-.yaml.template` file in this site directory.* + ### First run (Building Bootstrap and Source Caches) When you first run the script on a new machine, you need to use the `-u` option. This tells Spack to build the bootstrap mirror and source caches locally before attempting to register them. @@ -112,12 +132,16 @@ If you are just installing environments using already populated build caches (th ./util/gmao/batch_install.sh -r dev -m install -H macos.gmao -e ``` +### Generating `.yaml.generated` files +`batch_install.sh` uses `.yaml.template` files in the `macos.gmao` site directory to dynamically detect the path to your Brew installation and your NAG compiler, creating `.yaml.generated` files on the fly. +To prevent cluttering the site configuration directory, the script writes these generated files to the repository root, injects them directly into the target environment's `site/` directory, and then cleans up the temporary files from the root. + ### Loading the stack -Once the installation and module generation are complete, you can point your shell to the newly built modules: +Once the installation and module generation are complete, you can point your shell to the newly built modules. OpenMPI is built specifically with `~two_level_namespace` to support flat namespace linking required by GEOS, and `pflogger` and `esmf` variants are carefully managed to support building with both GCC and NAG. ```bash -module use -a /path/to/envs/ge-gcc-15.2.0/modules/Core +module use -a /path/to/envs/ge-gcc-15.2.0/install/modulefiles/Core ``` Then load the stack and your target environment (e.g., for GEOSgcm work): @@ -130,11 +154,13 @@ module load stack-gcc stack-openmpi geos-gcm-env ## Building the stack by hand -If you prefer to run the Spack commands manually instead of using `batch_install.sh`, follow these steps. +If you prefer to run the Spack commands manually instead of using `batch_install.sh`, you can still follow these steps. However, it's highly recommended to use `batch_install.sh` because it automatically handles dynamic template substitution (e.g. for Homebrew paths and NAG compiler versions) that you will otherwise need to do manually with `sed`. + +If you choose to do this manually, you must first run `sed` over the `*.yaml.template` files and create the `.yaml.generated` files. ### Create Environments -You only need to create each environment once. Our `macos.gmao` site configurations use `.template` files to dynamically set your local `brew` paths, so you must use `spack stack create env` which automatically resolves them. +You only need to create each environment once. Our `macos.gmao` site configurations use `.yaml.template` files which are dynamically processed into `.yaml.generated` files. #### GCC Environment @@ -142,10 +168,10 @@ You only need to create each environment once. Our `macos.gmao` site configurati spack stack create env --name ge-gcc-15.2.0 --template geos-dev --site macos.gmao --compiler=gcc-15.2.0 ``` -#### Flang Environment +#### NAG Environment ```bash -spack stack create env --name ge-clang-22.1.3 --template geos-dev --site macos.gmao --compiler=clang-22.1.3 +spack stack create env --name genag-nag-7.2.7243 --template geos-dev-nag --site macos.gmao --compiler=nag-7.2.7243 ``` --- diff --git a/configs/sites/tier2/macos.gmao/packages_nag-7.2.7243.yaml.template b/configs/sites/tier2/macos.gmao/packages_nag.yaml.template similarity index 79% rename from configs/sites/tier2/macos.gmao/packages_nag-7.2.7243.yaml.template rename to configs/sites/tier2/macos.gmao/packages_nag.yaml.template index 73fa4c2d7..40711b8f3 100644 --- a/configs/sites/tier2/macos.gmao/packages_nag-7.2.7243.yaml.template +++ b/configs/sites/tier2/macos.gmao/packages_nag.yaml.template @@ -4,7 +4,7 @@ packages: cxx: require: [apple-clang@17.0.0] fortran: - require: [nag@7.2.7243] + require: [nag@@NAG_VERSION@] mpi: require: [openmpi@=5.0.7] apple-clang: @@ -18,11 +18,11 @@ packages: nag: buildable: False externals: - - spec: nag@7.2.7243 languages:='fortran' - prefix: /Users/mathomp4/installed/Core/nag/7.2.43 + - spec: nag@@NAG_VERSION@ languages:='fortran' + prefix: @NAG_PREFIX@ extra_attributes: compilers: - fortran: /Users/mathomp4/installed/Core/nag/7.2.43/bin/nagfor + fortran: @NAG_PATH@ openmpi: require:: diff --git a/configs/templates/geos-dev-nag/spack.yaml b/configs/templates/geos-dev-nag/spack.yaml index 56217c4be..bb5ea23a3 100644 --- a/configs/templates/geos-dev-nag/spack.yaml +++ b/configs/templates/geos-dev-nag/spack.yaml @@ -8,7 +8,7 @@ spack: include: [] specs: - - geos-gcm-env ~debug ^esmf@=9.0.0b10 + - geos-gcm-env ^esmf@=9.0.0b10 - geos-gcm-env +debug ^esmf@=9.0.0b10 diff --git a/configs/templates/geos-dev/spack.yaml b/configs/templates/geos-dev/spack.yaml index 25b3ade77..badb8b561 100644 --- a/configs/templates/geos-dev/spack.yaml +++ b/configs/templates/geos-dev/spack.yaml @@ -8,7 +8,7 @@ spack: include: [] specs: - - geos-gcm-env ~debug ^esmf@=9.0.0b10 + - geos-gcm-env ^esmf@=9.0.0b10 - geos-gcm-env +debug ^esmf@=9.0.0b10 # Various fms builds From 396141e5ab76479a0ab7e1987649d7bd5fcea5a2 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 21 Apr 2026 08:03:00 -0400 Subject: [PATCH 24/39] Updates for nag testing --- util/gmao/batch_install.sh | 86 +++++++++++++++++++++++++++----------- 1 file changed, 62 insertions(+), 24 deletions(-) diff --git a/util/gmao/batch_install.sh b/util/gmao/batch_install.sh index ec7e64320..d2f23c5f7 100755 --- a/util/gmao/batch_install.sh +++ b/util/gmao/batch_install.sh @@ -66,6 +66,10 @@ usage() { echo " requires role 'dev' and mode 'build'" echo " -e Continue builds/install in existing environments;" echo " by default, exit with an error if already exist" + echo " -C Set a comma-separated list of compilers to use (e.g. gcc@=15.2.0,nag@=7.2.7243);" + echo " overrides the default compilers for the site" + echo " -N Path to nagfor executable (e.g. /opt/nag/bin/nagfor);" + echo " forces NAG stack to be built using this specific compiler" echo " -s Submit 'spack install' to batch scheduler" echo " -t Run tests for specific thirdparty dependencies;" echo " these are currently hardcoded in batch_install.sh" @@ -76,7 +80,7 @@ usage() { echo } -while getopts r:m:d:c:H:nuesth flag +while getopts r:m:d:c:C:N:H:nuesth flag do case "${flag}" in r) @@ -91,6 +95,12 @@ do c) SPACK_STACK_BUILDCACHE_DIR=$(readlink -f ${OPTARG}) ;; + C) + SPACK_STACK_COMPILER_OPT=${OPTARG} + ;; + N) + SPACK_STACK_NAGFOR_PATH=${OPTARG} + ;; H) SPACK_STACK_BATCH_HOST_OPT=${OPTARG} ;; @@ -201,8 +211,28 @@ case ${SPACK_STACK_BATCH_HOST} in SPACK_STACK_CARGO_MIRROR="/Users/mathomp4/spack-stack-mirrors/spack-cargo-mirror" ;; macos.gmao) - #SPACK_STACK_BATCH_COMPILERS=("gcc@=15.2.0" "nag@=7.2.7243") - SPACK_STACK_BATCH_COMPILERS=("gcc@=15.2.0") + # Detect NAG Fortran Compiler + nag_path_tmp="" + if [[ -n "${SPACK_STACK_NAGFOR_PATH}" && -x "${SPACK_STACK_NAGFOR_PATH}" ]]; then + nag_path_tmp="${SPACK_STACK_NAGFOR_PATH}" + elif command -v nagfor &> /dev/null; then + nag_path_tmp=$(which nagfor) + fi + + if [[ -n "${nag_path_tmp}" ]]; then + export MAC_GMAO_NAG_PATH="${nag_path_tmp}" + export MAC_GMAO_NAG_VERSION=$("${MAC_GMAO_NAG_PATH}" -V 2>&1 | head -n1 | sed -E 's/.*Release ([0-9]+\.[0-9]+).*Build ([0-9]+).*/\1.\2/' || echo "7.2.7243") + export MAC_GMAO_NAG_PREFIX=$(dirname $(dirname "${MAC_GMAO_NAG_PATH}")) + fi + + if [[ -n "${SPACK_STACK_COMPILER_OPT}" ]]; then + IFS=',' read -r -a SPACK_STACK_BATCH_COMPILERS <<< "${SPACK_STACK_COMPILER_OPT}" + else + SPACK_STACK_BATCH_COMPILERS=("gcc@=15.2.0") + if [[ -n "${MAC_GMAO_NAG_VERSION}" ]]; then + SPACK_STACK_BATCH_COMPILERS+=("nag@=${MAC_GMAO_NAG_VERSION}") + fi + fi SPACK_STACK_BATCH_TEMPLATES=("geos-dev" "geos-dev-nag") SPACK_STACK_MODULE_CHOICE="lmod" SPACK_STACK_BOOTSTRAP_MIRROR="${HOME}/spack-stack-mirrors/spack-bootstrap-mirror" @@ -639,17 +669,32 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do macos_site_dir="${SPACK_STACK_DIR}/configs/sites/tier2/macos.gmao" brew_prefix=$(brew --prefix) - sed "s#@HOME@#${HOME}#g" "${macos_site_dir}/mirrors.yaml.template" > "${SPACK_STACK_DIR}/mirrors.yaml.generated" - sed "s#@BREW_PREFIX@#${brew_prefix}#g" "${macos_site_dir}/packages_gcc-15.2.0.yaml.template" > "${SPACK_STACK_DIR}/packages_gcc-15.2.0.yaml.generated" - sed "s#@BREW_PREFIX@#${brew_prefix}#g" "${macos_site_dir}/packages_clang-22.1.3.yaml.template" > "${SPACK_STACK_DIR}/packages_clang-22.1.3.yaml.generated" - sed "s#@BREW_PREFIX@#${brew_prefix}#g" "${macos_site_dir}/packages_nag-7.2.7243.yaml.template" > "${SPACK_STACK_DIR}/packages_nag-7.2.7243.yaml.generated" - - if [[ -d "${SPACK_STACK_DIR}/.git" ]]; then - grep -q "^mirrors.yaml.generated$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "mirrors.yaml.generated" >> "${SPACK_STACK_DIR}/.git/info/exclude" - grep -q "^packages_gcc-15.2.0.yaml.generated$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "packages_gcc-15.2.0.yaml.generated" >> "${SPACK_STACK_DIR}/.git/info/exclude" - grep -q "^packages_clang-22.1.3.yaml.generated$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "packages_clang-22.1.3.yaml.generated" >> "${SPACK_STACK_DIR}/.git/info/exclude" - grep -q "^packages_nag-7.2.7243.yaml.generated$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "packages_nag-7.2.7243.yaml.generated" >> "${SPACK_STACK_DIR}/.git/info/exclude" - fi + # Use NAG vars if available + nag_version=${MAC_GMAO_NAG_VERSION} + nag_path=${MAC_GMAO_NAG_PATH} + nag_prefix=${MAC_GMAO_NAG_PREFIX} + + for template_file in "${macos_site_dir}"/*.yaml.template; do + if [[ -f "${template_file}" ]]; then + filename=$(basename "${template_file}") + base_filename="${filename%.template}" + + # Special case for NAG template: inject version into filename + if [[ "${base_filename}" == "packages_nag.yaml" && -n "${nag_version}" ]]; then + base_filename="packages_nag-${nag_version}.yaml" + fi + + sed_cmd="sed -e \"s#@HOME@#${HOME}#g\" -e \"s#@BREW_PREFIX@#${brew_prefix}#g\"" + if [[ -n "${nag_version}" ]]; then + sed_cmd="${sed_cmd} -e \"s#@NAG_VERSION@#${nag_version}#g\" -e \"s#@NAG_PREFIX@#${nag_prefix}#g\" -e \"s#@NAG_PATH@#${nag_path}#g\"" + fi + + eval "${sed_cmd} \"${template_file}\"" > "${SPACK_STACK_DIR}/configs/sites/tier2/${host}/${base_filename}" + if [[ -d "${SPACK_STACK_DIR}/.git" ]]; then + grep -q "^configs/sites/tier2/${host}/${base_filename}$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "configs/sites/tier2/${host}/${base_filename}" >> "${SPACK_STACK_DIR}/.git/info/exclude" + fi + fi + done fi spack stack create env --name=${env_name} \ @@ -660,17 +705,10 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do --treat-warnings-as-errors \ 2>&1 | tee log.create.${env_name}.${LOG_TIMESTAMP} - # Move the generated YAMLs into the newly created environment site config + # Clean up the generated yamls in the site configuration now that the env is created if [[ "${host}" == "macos.gmao" && ! ${env_exists} == "true" ]]; then - mv "${SPACK_STACK_DIR}/mirrors.yaml.generated" "${env_dir}/site/mirrors.yaml" - - if [[ -f "${SPACK_STACK_DIR}/packages_${compiler_name}-${compiler_version}.yaml.generated" ]]; then - # We only need the packages.yaml for the compiler we are actually using - mv "${SPACK_STACK_DIR}/packages_${compiler_name}-${compiler_version}.yaml.generated" "${env_dir}/site/packages_${compiler_name}-${compiler_version}.yaml" - fi - - # Clean up any leftover generated package yamls from other compilers - rm -f "${SPACK_STACK_DIR}/packages_*.yaml.generated" + rm -f "${SPACK_STACK_DIR}/configs/sites/tier2/${host}/mirrors.yaml" + rm -f "${SPACK_STACK_DIR}/configs/sites/tier2/${host}/packages_*.yaml" fi fi spack env activate -p ${env_dir} From 909ce602f2c09e1d8b866f810afa627dc3fd3f62 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 21 Apr 2026 08:08:11 -0400 Subject: [PATCH 25/39] Add comments --- configs/templates/geos-dev-nag/spack.yaml | 4 ++++ configs/templates/geos-dev/spack.yaml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/configs/templates/geos-dev-nag/spack.yaml b/configs/templates/geos-dev-nag/spack.yaml index bb5ea23a3..7ea090580 100644 --- a/configs/templates/geos-dev-nag/spack.yaml +++ b/configs/templates/geos-dev-nag/spack.yaml @@ -8,6 +8,10 @@ spack: include: [] specs: + # NOTE: Do not explicitly add ~debug to the first geos-gcm-env spec below. + # On some platforms (like macOS with gcc-15/gfortranclang), ESMF requires + # +debug to build successfully, which is enforced via the site's packages.yaml. + # Explicitly requesting ~debug here will cause a concretization conflict on those platforms. - geos-gcm-env ^esmf@=9.0.0b10 - geos-gcm-env +debug ^esmf@=9.0.0b10 diff --git a/configs/templates/geos-dev/spack.yaml b/configs/templates/geos-dev/spack.yaml index badb8b561..461d55a6e 100644 --- a/configs/templates/geos-dev/spack.yaml +++ b/configs/templates/geos-dev/spack.yaml @@ -8,6 +8,10 @@ spack: include: [] specs: + # NOTE: Do not explicitly add ~debug to the first geos-gcm-env spec below. + # On some platforms (like macOS with gcc-15/gfortranclang), ESMF requires + # +debug to build successfully, which is enforced via the site's packages.yaml. + # Explicitly requesting ~debug here will cause a concretization conflict on those platforms. - geos-gcm-env ^esmf@=9.0.0b10 - geos-gcm-env +debug ^esmf@=9.0.0b10 From eb36f71092f263759a8df5e0972d5fda2a32ea63 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 21 Apr 2026 09:35:23 -0400 Subject: [PATCH 26/39] Add common for nag --- configs/common/packages_nag.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 configs/common/packages_nag.yaml diff --git a/configs/common/packages_nag.yaml b/configs/common/packages_nag.yaml new file mode 100644 index 000000000..560727087 --- /dev/null +++ b/configs/common/packages_nag.yaml @@ -0,0 +1,28 @@ +packages: + # Compiler preferences + c: + prefer: + - apple-clang + cxx: + prefer: + - apple-clang + fortran: + prefer: + - nag + # Virtual provider settings + blas: + require: + - openblas + fftw-api: + require: + - fftw + lapack: + require: + - openblas + # Individual package settings + ectrans: + require: + - +fftw + oops: + require: + - ~mkl \ No newline at end of file From c2b2b4524f29291faf96c7e023b39ba3b1e1082f Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 21 Apr 2026 09:35:39 -0400 Subject: [PATCH 27/39] Updates batch script --- util/gmao/batch_install.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util/gmao/batch_install.sh b/util/gmao/batch_install.sh index d2f23c5f7..2e0bc8b96 100755 --- a/util/gmao/batch_install.sh +++ b/util/gmao/batch_install.sh @@ -492,6 +492,9 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do [[ "${update_build_cache}" == "true" ]] && env_name=${env_name}-build env_dir=${environment_dirs}/${env_name} + # Reset env_exists for this specific environment target + env_exists="false" + # Bail out if the environment already exists if [[ -d ${env_dir} ]]; then if [[ ${ignore_env_exist} == "true" ]]; then @@ -505,8 +508,6 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do exit 1 fi fi - else - env_exists="false" fi if [[ "${SPACK_STACK_DRY_RUN}" == "true" ]]; then From 74ebcabeac077b6c842bd021d4094013df559102 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 21 Apr 2026 11:07:48 -0400 Subject: [PATCH 28/39] Add nag fix for openmpi --- repos/builtin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repos/builtin b/repos/builtin index dec57a08f..89ba6af3d 160000 --- a/repos/builtin +++ b/repos/builtin @@ -1 +1 @@ -Subproject commit dec57a08f5ce8665d44c311f0deaa99e53155ae8 +Subproject commit 89ba6af3d6087a8d8edec4ef1ebe7c255641aafe From 10ff47fb6989bf7f1c9bfab1a7977b91728f0ca0 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 23 Apr 2026 07:03:37 -0400 Subject: [PATCH 29/39] Add logs/ folder to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ab05ab5db..cc8a36bda 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ cache .vscode doc/build deploy_logs/ +logs/ log.* From e14b4dad4a3ca6e636b49fccab4630dc71bab458 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 23 Apr 2026 07:04:17 -0400 Subject: [PATCH 30/39] Update for common/packages_nag.yaml --- configs/common/packages_nag.yaml | 57 +++++++++++++++++--------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/configs/common/packages_nag.yaml b/configs/common/packages_nag.yaml index 560727087..2273054b5 100644 --- a/configs/common/packages_nag.yaml +++ b/configs/common/packages_nag.yaml @@ -1,28 +1,31 @@ packages: - # Compiler preferences - c: - prefer: - - apple-clang - cxx: - prefer: - - apple-clang - fortran: - prefer: - - nag - # Virtual provider settings - blas: - require: - - openblas - fftw-api: - require: - - fftw - lapack: - require: - - openblas - # Individual package settings - ectrans: - require: - - +fftw - oops: - require: - - ~mkl \ No newline at end of file + # Compiler preferences + c: + prefer:: + - apple-clang + cxx: + prefer:: + - apple-clang + fortran: + prefer:: + - nag + all: + providers: + fortran: [nag, gcc, llvm, intel-oneapi-compilers] + # Virtual provider settings + blas: + require: + - openblas + fftw-api: + require: + - fftw + lapack: + require: + - openblas + # Individual package settings + ectrans: + require: + - +fftw + oops: + require: + - '~mkl' From 57dce604f38c666e562e542b770d106e825c6499 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 23 Apr 2026 07:05:09 -0400 Subject: [PATCH 31/39] More updates for macos.gmao --- configs/sites/tier2/macos.gmao/modules.yaml | 2 -- .../packages_clang-22.1.3.yaml.template | 5 +++++ .../packages_gcc-15.2.0.yaml.template | 5 +++++ .../macos.gmao/packages_nag.yaml.template | 22 ++++++++++++++++++- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/configs/sites/tier2/macos.gmao/modules.yaml b/configs/sites/tier2/macos.gmao/modules.yaml index 828f542af..320999839 100644 --- a/configs/sites/tier2/macos.gmao/modules.yaml +++ b/configs/sites/tier2/macos.gmao/modules.yaml @@ -31,8 +31,6 @@ modules: filter: exclude_env_vars: - LD_LIBRARY_PATH - - DYLD_LIBRARY_PATH - - DYLD_FALLBACK_LIBRARY_PATH include: # Compiler modules - apple-clang diff --git a/configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml.template b/configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml.template index 757c6fa88..cc785f3d8 100644 --- a/configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml.template +++ b/configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml.template @@ -32,3 +32,8 @@ packages: - '+fortran' # GEOS requires a flat namespace to link properly on macOS - '~two_level_namespace' + + gdbm: + externals: + - spec: gdbm@1.26 + prefix: @BREW_PREFIX@/opt/gdbm diff --git a/configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml.template b/configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml.template index a518b0d17..1336d1399 100644 --- a/configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml.template +++ b/configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml.template @@ -41,3 +41,8 @@ packages: require: - '~openmp' - '+debug' + + gdbm: + externals: + - spec: gdbm@1.26 + prefix: @BREW_PREFIX@/opt/gdbm diff --git a/configs/sites/tier2/macos.gmao/packages_nag.yaml.template b/configs/sites/tier2/macos.gmao/packages_nag.yaml.template index 40711b8f3..2ce08ae42 100644 --- a/configs/sites/tier2/macos.gmao/packages_nag.yaml.template +++ b/configs/sites/tier2/macos.gmao/packages_nag.yaml.template @@ -36,6 +36,26 @@ packages: # ESMF by default for Darwin.gfortranclang turns off OpenMP, so # we do the same here to avoid build failures. + # Also enforce +debug since NAG is meant for debugging. esmf: - require: + require:: - '~openmp' + - '+debug' + + # Disable parallel-netcdf for NAG as it fails to build and is unneeded + parallelio: + require:: + - '@2.6.2' + - '~pnetcdf' + + # netcdf-fortran needs explicit preprocessor and type safety flags for NAG + netcdf-fortran: + require:: + - 'fflags="-fpp -mismatch_all"' + + + gdbm: + externals: + - spec: gdbm@1.26 + prefix: @BREW_PREFIX@/opt/gdbm + From 1b99f3677237d79d4909acb6c13971c8f24d2a9f Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 23 Apr 2026 07:05:26 -0400 Subject: [PATCH 32/39] Remove alderaan --- configs/sites/tier2/alderaan/README.md | 180 ------------------ configs/sites/tier2/alderaan/config.yaml | 3 - configs/sites/tier2/alderaan/mirrors.yaml | 3 - configs/sites/tier2/alderaan/modules.yaml | 38 ---- configs/sites/tier2/alderaan/packages.yaml | 105 ---------- .../tier2/alderaan/packages_clang-22.1.3.yaml | 25 --- .../tier2/alderaan/packages_gcc-15.2.0.yaml | 31 --- configs/sites/tier2/alderaan/toolchains.yaml | 29 --- 8 files changed, 414 deletions(-) delete mode 100644 configs/sites/tier2/alderaan/README.md delete mode 100644 configs/sites/tier2/alderaan/config.yaml delete mode 100644 configs/sites/tier2/alderaan/mirrors.yaml delete mode 100644 configs/sites/tier2/alderaan/modules.yaml delete mode 100644 configs/sites/tier2/alderaan/packages.yaml delete mode 100644 configs/sites/tier2/alderaan/packages_clang-22.1.3.yaml delete mode 100644 configs/sites/tier2/alderaan/packages_gcc-15.2.0.yaml delete mode 100644 configs/sites/tier2/alderaan/toolchains.yaml diff --git a/configs/sites/tier2/alderaan/README.md b/configs/sites/tier2/alderaan/README.md deleted file mode 100644 index df8270140..000000000 --- a/configs/sites/tier2/alderaan/README.md +++ /dev/null @@ -1,180 +0,0 @@ -Alderaan is one of @mathomp4's development systems (Mac Studio) - ---- - -## Table of Contents - -- [Overview](#overview) -- [Machines Required](#machines-required) -- [Clone spack-stack](#clone-spack-stack) -- [Obtain an Interactive Compute Node](#obtain-an-interactive-compute-node) -- [Setup spack-stack](#setup-spack-stack) -- [Create Environments](#create-environments) - - [oneAPI - ifx Environment](#oneapi---ifx-environment) - - [oneAPI - ifort Environment](#oneapi---ifort-environment) - - [GCC Environment](#gcc-environment) -- [Activate the Environment](#activate-the-environment) -- [Concretize the Environment](#concretize-the-environment) -- [Create Source Cache](#create-source-cache) -- [Pre-Fetch Cargo Dependencies](#pre-fetch-cargo-dependencies) -- [Install Packages](#install-packages) -- [Update Module Files](#update-module-files) -- [Deactivate the Environment](#deactivate-the-environment) -- [Debugging Package Builds](#debugging-package-builds) -- [Deprecated: Legacy Three-Step Install](#deprecated-legacy-three-step-install) - ---- - -## Overview - ---- - -## Brew Packages Required - -You must have `brew` installed and the following packages available: - -``` -brew install coreutils -brew install gcc@15 -brew install flang -brew install git -brew install lmod -brew install wget -brew install bash -brew install tcsh -brew install cmake -brew install openssl -brew install rust -``` - ---- - -## Clone spack-stack - -Use the appropriate branch or tag: - -```bash -git clone --recurse-submodules https://github.com/GMAO-SI-Team/spack-stack.git -b geos-testing spack-stack-dev -``` - ---- - -## Setup spack-stack - -```bash -cd spack-stack-dev -. ./setup.sh -``` - ---- - -## Create Environments - -You only need to create each environment once. - -### GCC Environment - -```bash -spack stack create env --name ge-gcc-15.2.0 --template geos-dev --site alderaan --compiler=gcc-15.2.0 -cd envs/ge-gcc-15.2.0 -``` - -### Flang Environment - -```bash -spack stack create env --name ge-clang-22.1.3 --template geos-dev --site alderaan --compiler=clang-22.1.3 -cd envs/ge-clang-22.1.3 -``` - ---- - -## Activate the Environment - -```bash -spack env activate . -``` - -> **Important:** Run this in *every* terminal where you plan to run Spack commands. - ---- - -## Concretize the Environment - -```bash -spack concretize 2>&1 | tee log.concretize ; bell -``` - -### Optional `bell` helper - -```bash -bell() { tput bel ; printf "\nFinished at: " ; date; } -``` - ---- - -## Create Source Cache - -This downloads all source tarballs for your environment: - -```bash -spack mirror create -a -d /Users/mathomp4/spack-stack-mirrors/spack-source-mirror -``` - -> ⚠️ **Do not run this outside an activated environment.** -> Otherwise Spack will attempt to mirror **every** known package/version. - ---- - -## Pre-Fetch Cargo Dependencies - -Rust packages frequently require network access during build. Pre-fetch their dependencies: - -```bash -export CARGO_HOME=/Users/mathomp4/spack-stack-mirrors/spack-cargo-mirror -../../util/fetch_cargo_deps.py -``` - -> ⚠️ **Set `CARGO_HOME` before running `spack install`.** - ---- - -## Install Packages - -```bash -export CARGO_HOME=/Users/mathomp4/spack-stack-mirrors/spack-cargo-mirror -spack install -j 6 --verbose --fail-fast --show-log-on-error --no-check-signature 2>&1 | tee log.install ; bell -``` - -> **Note:** You may need to re-run this command multiple times. Some builds fail intermittently but succeed on retry. - ---- - -## Update Module Files - -After installation completes, run: - -```bash -spack module lmod refresh -y --delete-tree ; bell -spack stack setup-meta-modules -``` - ---- - -## Deactivate the Environment - -```bash -spack env deactivate -``` - ---- - -## Debugging Package Builds - -```bash -spack clean -spack stage -spack build-env -- bash --norc --noprofile -``` - -This drops you into a clean build environment with the package’s full compiler/runtime environment loaded. - diff --git a/configs/sites/tier2/alderaan/config.yaml b/configs/sites/tier2/alderaan/config.yaml deleted file mode 100644 index 8ec652ba9..000000000 --- a/configs/sites/tier2/alderaan/config.yaml +++ /dev/null @@ -1,3 +0,0 @@ -config: - build_jobs: 6 - installer: old diff --git a/configs/sites/tier2/alderaan/mirrors.yaml b/configs/sites/tier2/alderaan/mirrors.yaml deleted file mode 100644 index d1c9bcc4b..000000000 --- a/configs/sites/tier2/alderaan/mirrors.yaml +++ /dev/null @@ -1,3 +0,0 @@ -mirrors: - local-source: file:///Users/mathomp4/spack-stack-mirrors/spack-source-mirror - local-binary: file:///Users/mathomp4/spack-stack-mirrors/spack-build-mirror diff --git a/configs/sites/tier2/alderaan/modules.yaml b/configs/sites/tier2/alderaan/modules.yaml deleted file mode 100644 index e13bb47f4..000000000 --- a/configs/sites/tier2/alderaan/modules.yaml +++ /dev/null @@ -1,38 +0,0 @@ -modules: - default: - enable:: - - lmod - prefix_inspections:: - bin: - - PATH - man: - - MANPATH - share/man: - - MANPATH - share/aclocal: - - ACLOCAL_PATH - include: - - CPATH - lib/pkgconfig: - - PKG_CONFIG_PATH - lib64/pkgconfig: - - PKG_CONFIG_PATH - share/pkgconfig: - - PKG_CONFIG_PATH - '': - - CMAKE_PREFIX_PATH - lmod: - all: - filter: - exclude_env_vars: - - LD_LIBRARY_PATH - - DYLD_LIBRARY_PATH - - DYLD_FALLBACK_LIBRARY_PATH - include: - # Compiler modules - - apple-clang - - gcc - - llvm - # MPI modules - - mpich - - openmpi diff --git a/configs/sites/tier2/alderaan/packages.yaml b/configs/sites/tier2/alderaan/packages.yaml deleted file mode 100644 index 12c25102f..000000000 --- a/configs/sites/tier2/alderaan/packages.yaml +++ /dev/null @@ -1,105 +0,0 @@ -packages: - - netcdf-c: - require: [+shared] - - autoconf: - externals: - - spec: autoconf@2.72 - prefix: /Users/mathomp4/.homebrew/brew - automake: - externals: - - spec: automake@1.18.1 - prefix: /Users/mathomp4/.homebrew/brew - bash: - externals: - - spec: bash@5.3.3 - prefix: /Users/mathomp4/.homebrew/brew - cmake: - externals: - - spec: cmake@4.1.1 - prefix: /Users/mathomp4/.homebrew/brew - cvs: - externals: - - spec: cvs@1.12.13 - prefix: /Users/mathomp4/.homebrew/brew - doxygen: - externals: - - spec: doxygen@1.14.0+graphviz~mscgen - prefix: /Users/mathomp4/.homebrew/brew - flex: - externals: - - spec: flex@2.6.4+lex - prefix: /usr - gawk: - externals: - - spec: gawk@5.3.1 - prefix: /Users/mathomp4/.homebrew/brew - git: - externals: - - spec: git@2.51.0+tcltk - prefix: /Users/mathomp4/.homebrew/brew - - spec: git@2.50.1~tcltk - prefix: /usr - git-lfs: - externals: - - spec: git-lfs@3.7.0 - prefix: /Users/mathomp4/.homebrew/brew - groff: - externals: - - spec: groff@1.23.0 - prefix: /Users/mathomp4/.homebrew/brew - libtool: - externals: - - spec: libtool@2.5.4 - prefix: /Users/mathomp4/.homebrew/brew - ninja: - externals: - - spec: ninja@1.13.1 - prefix: /Users/mathomp4/.homebrew/brew - npm: - externals: - - spec: npm@11.6.0 - prefix: /Users/mathomp4/.homebrew/brew - openssh: - externals: - - spec: openssh@9.9p2 - prefix: /usr - perl: - externals: - - spec: perl@5.42.0~cpanm+opcode+open+shared+threads - prefix: /Users/mathomp4/.homebrew/brew - - spec: perl@5.34.1~cpanm+opcode+open+shared+threads - prefix: /usr - pkgconf: - externals: - - spec: pkgconf@2.5.1 - prefix: /Users/mathomp4/.homebrew/brew - rust: - externals: - - spec: rust@1.90.0 - prefix: /Users/mathomp4/.homebrew/brew - extra_attributes: - cargo: /Users/mathomp4/.homebrew/brew/bin/cargo - compilers: - rust: /Users/mathomp4/.homebrew/brew/bin/rustc - subversion: - externals: - - spec: subversion@1.14.5 - prefix: /Users/mathomp4/.homebrew/brew - swig: - externals: - - spec: swig@4.3.1 - prefix: /Users/mathomp4/.homebrew/brew - tar: - externals: - - spec: tar@1.35 - prefix: /Users/mathomp4 - tcsh: - externals: - - spec: tcsh@6.24.16 - prefix: /Users/mathomp4/.homebrew/brew - texinfo: - externals: - - spec: texinfo@7.2 - prefix: /Users/mathomp4/.homebrew/brew diff --git a/configs/sites/tier2/alderaan/packages_clang-22.1.3.yaml b/configs/sites/tier2/alderaan/packages_clang-22.1.3.yaml deleted file mode 100644 index ef8c19c5d..000000000 --- a/configs/sites/tier2/alderaan/packages_clang-22.1.3.yaml +++ /dev/null @@ -1,25 +0,0 @@ -packages: - c: - require: [apple-clang@17.0.0] - cxx: - require: [apple-clang@17.0.0] - fortran: - require: [llvm@21.1.3 ~clang +flang] - mpi: - require: [openmpi@=5.0.10] - apple-clang: - externals: - - spec: apple-clang@17.0.0 languages:='c,c++' - prefix: /usr - extra_attributes: - compilers: - c: /usr/bin/clang - cxx: /usr/bin/clang++ - llvm: - buildable: False - externals: - - spec: llvm@21.1.3 ~clang +flang languages:='fortran' - prefix: /Users/mathomp4/.homebrew/brew - extra_attributes: - compilers: - fortran: /Users/mathomp4/.homebrew/brew/bin/flang diff --git a/configs/sites/tier2/alderaan/packages_gcc-15.2.0.yaml b/configs/sites/tier2/alderaan/packages_gcc-15.2.0.yaml deleted file mode 100644 index a2cf11fe6..000000000 --- a/configs/sites/tier2/alderaan/packages_gcc-15.2.0.yaml +++ /dev/null @@ -1,31 +0,0 @@ -packages: - c: - require: [apple-clang@17.0.0] - cxx: - require: [apple-clang@17.0.0] - fortran: - require: [gcc@15.2.0] - mpi: - require: [openmpi@=5.0.10] - apple-clang: - externals: - - spec: apple-clang@17.0.0 languages:='c,c++' - prefix: /usr - extra_attributes: - compilers: - c: /usr/bin/clang - cxx: /usr/bin/clang++ - gcc: - buildable: False - externals: - - spec: gcc@15.2.0 languages:='fortran' - prefix: /Users/mathomp4/.homebrew/brew - extra_attributes: - compilers: - fortran: /Users/mathomp4/.homebrew/brew/bin/gfortran-15 - - # ESMF by default for Darwin.gfortranclang turns off OpenMP, so - # we do the same here to avoid build failures. - esmf: - require:: - - '~openmp' diff --git a/configs/sites/tier2/alderaan/toolchains.yaml b/configs/sites/tier2/alderaan/toolchains.yaml deleted file mode 100644 index 7b140d268..000000000 --- a/configs/sites/tier2/alderaan/toolchains.yaml +++ /dev/null @@ -1,29 +0,0 @@ -toolchains: - apple-gfortran-15: - - spec: "%c=apple-clang" - when: "%c" - - spec: "%cxx=apple-clang" - when: "%cxx" - - spec: "%fortran=gcc@15" - when: "%fortran" - apple-gfortran-14: - - spec: "%c=apple-clang" - when: "%c" - - spec: "%cxx=apple-clang" - when: "%cxx" - - spec: "%fortran=gcc@14" - when: "%fortran" - gcc-gfortran-15: - - spec: "%c=gcc@15" - when: "%c" - - spec: "%cxx=gcc@15" - when: "%cxx" - - spec: "%fortran=gcc@15" - when: "%fortran" - apple-nag: - - spec: "%c=apple-clang" - when: "%c" - - spec: "%cxx=apple-clang" - when: "%cxx" - - spec: "%fortran=nag" - when: "%fortran" From d7934a269b7ae2bfa779cb976a09e57ad801959b Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 23 Apr 2026 07:06:28 -0400 Subject: [PATCH 33/39] Latest batch_install update --- util/gmao/batch_install.sh | 53 ++++++++++++-------------------------- 1 file changed, 17 insertions(+), 36 deletions(-) diff --git a/util/gmao/batch_install.sh b/util/gmao/batch_install.sh index 2e0bc8b96..2037b1742 100755 --- a/util/gmao/batch_install.sh +++ b/util/gmao/batch_install.sh @@ -201,15 +201,6 @@ case ${SPACK_STACK_BATCH_HOST} in SPACK_STACK_BOOTSTRAP_MIRROR="/swbuild/gmao_SIteam/spack-stack/bootstrap-mirror" SPACK_STACK_CARGO_MIRROR="/swbuild/gmao_SIteam/spack-stack/cargo-mirror" ;; - alderaan) - #SPACK_STACK_BATCH_COMPILERS=("gcc@=15.2.0" "clang@=22.1.3") - #SPACK_STACK_BATCH_COMPILERS=("gcc@=15.2.0" "nag@=7.2.7243") - SPACK_STACK_BATCH_COMPILERS=("gcc@=15.2.0") - SPACK_STACK_BATCH_TEMPLATES=("geos-dev") - SPACK_STACK_MODULE_CHOICE="lmod" - SPACK_STACK_BOOTSTRAP_MIRROR="/Users/mathomp4/spack-stack-mirrors/spack-bootstrap-mirror" - SPACK_STACK_CARGO_MIRROR="/Users/mathomp4/spack-stack-mirrors/spack-cargo-mirror" - ;; macos.gmao) # Detect NAG Fortran Compiler nag_path_tmp="" @@ -218,7 +209,7 @@ case ${SPACK_STACK_BATCH_HOST} in elif command -v nagfor &> /dev/null; then nag_path_tmp=$(which nagfor) fi - + if [[ -n "${nag_path_tmp}" ]]; then export MAC_GMAO_NAG_PATH="${nag_path_tmp}" export MAC_GMAO_NAG_VERSION=$("${MAC_GMAO_NAG_PATH}" -V 2>&1 | head -n1 | sed -E 's/.*Release ([0-9]+\.[0-9]+).*Build ([0-9]+).*/\1.\2/' || echo "7.2.7243") @@ -274,8 +265,6 @@ function fix_permissions() { fi nice -n 19 find ${dir} -type f -print0 | xargs --null chmod a+r ;; - alderaan) - ;; macos.gmao) ;; *) @@ -352,6 +341,8 @@ echo LOG_TIMESTAMP=$(date +"%Y%m%d_%H%M%S") +mkdir -p "${SPACK_STACK_DIR}/logs" + if [[ ! -e "setup.sh" || ! -e ".spackstack" ]]; then echo "ERROR, this script must be executed from the top-level spack-stack directory" exit 1 @@ -481,7 +472,7 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do env_name_prefix="ge" ;; geos-dev-nag) - env_name_prefix="genag" + env_name_prefix="ge" ;; *) echo "ERROR, template ${template} not configured" @@ -605,16 +596,6 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do module purge set -e ;; - alderaan) - set +e - ulimit -s unlimited 2>/dev/null || ulimit -s hard 2>/dev/null || ulimit -s 65532 2>/dev/null || true - if ! command -v module &> /dev/null; then - if command -v brew &> /dev/null; then - . $(brew --prefix)/opt/lmod/init/bash 2>/dev/null || true - fi - fi - set -e - ;; macos.gmao) set +e ulimit -s unlimited 2>/dev/null || ulimit -s hard 2>/dev/null || ulimit -s 65532 2>/dev/null || true @@ -649,7 +630,7 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do tmp_bootstrap_mirror_path=${PWD}/tmp-bootstrap-mirror echo "Creating bootstrap mirror ${tmp_bootstrap_mirror_path} ..." rm -fr ${tmp_bootstrap_mirror_path} - spack bootstrap mirror --binary-packages ${tmp_bootstrap_mirror_path} 2>&1 | tee log.bootstrap-mirror.${LOG_TIMESTAMP} + spack bootstrap mirror --binary-packages ${tmp_bootstrap_mirror_path} 2>&1 | tee ${SPACK_STACK_DIR}/logs/log.bootstrap-mirror.${LOG_TIMESTAMP} rsync -a ${tmp_bootstrap_mirror_path}/ ${bootstrap_mirror_path}/ rm -fr ${tmp_bootstrap_mirror_path} # Update buildcache index @@ -679,17 +660,17 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do if [[ -f "${template_file}" ]]; then filename=$(basename "${template_file}") base_filename="${filename%.template}" - + # Special case for NAG template: inject version into filename if [[ "${base_filename}" == "packages_nag.yaml" && -n "${nag_version}" ]]; then base_filename="packages_nag-${nag_version}.yaml" fi - + sed_cmd="sed -e \"s#@HOME@#${HOME}#g\" -e \"s#@BREW_PREFIX@#${brew_prefix}#g\"" if [[ -n "${nag_version}" ]]; then sed_cmd="${sed_cmd} -e \"s#@NAG_VERSION@#${nag_version}#g\" -e \"s#@NAG_PREFIX@#${nag_prefix}#g\" -e \"s#@NAG_PATH@#${nag_path}#g\"" fi - + eval "${sed_cmd} \"${template_file}\"" > "${SPACK_STACK_DIR}/configs/sites/tier2/${host}/${base_filename}" if [[ -d "${SPACK_STACK_DIR}/.git" ]]; then grep -q "^configs/sites/tier2/${host}/${base_filename}$" "${SPACK_STACK_DIR}/.git/info/exclude" 2>/dev/null || echo "configs/sites/tier2/${host}/${base_filename}" >> "${SPACK_STACK_DIR}/.git/info/exclude" @@ -704,7 +685,7 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do --template=${template} \ --dir=${environment_dirs} \ --treat-warnings-as-errors \ - 2>&1 | tee log.create.${env_name}.${LOG_TIMESTAMP} + 2>&1 | tee ${SPACK_STACK_DIR}/logs/log.create.${env_name}.${LOG_TIMESTAMP} # Clean up the generated yamls in the site configuration now that the env is created if [[ "${host}" == "macos.gmao" && ! ${env_exists} == "true" ]]; then @@ -780,10 +761,10 @@ EOF # Bootstrap spack explicitly echo "Bootstrapping spack ..." - spack bootstrap now 2>&1 | tee log.bootstrap.${env_name}.${LOG_TIMESTAMP} + spack bootstrap now 2>&1 | tee ${SPACK_STACK_DIR}/logs/log.bootstrap.${env_name}.${LOG_TIMESTAMP} # Concretize environment, and check that spack.lock is created - spack concretize --force --fresh 2>&1 | tee log.concretize.${env_name}.${LOG_TIMESTAMP} + spack concretize --force --fresh 2>&1 | tee ${SPACK_STACK_DIR}/logs/log.concretize.${env_name}.${LOG_TIMESTAMP} if [[ ! -e ${env_dir}/spack.lock ]]; then echo "ERROR during concretization of environment ${env_name}, spack.lock not found" exit 1 @@ -852,7 +833,7 @@ $(declare -p test_packages) # If no tests are required, install everything if [[ \${#test_packages[@]} -eq 0 ]]; then set -o pipefail - spack install --verbose ${buildcache_install_flags} ${parallel_install_flags} 2>&1 | tee log.install.${env_name}.${LOG_TIMESTAMP} + spack install --verbose ${buildcache_install_flags} ${parallel_install_flags} 2>&1 | tee ${SPACK_STACK_DIR}/logs/log.install.${env_name}.${LOG_TIMESTAMP} set +o pipefail else for (( idx=0; idx<\${#test_packages[@]}; idx++ )); do @@ -864,14 +845,14 @@ else idx_padded=\$(printf "%03d" "\$((idx+1))") set -o pipefail spack install --verbose ${buildcache_install_flags} ${parallel_install_flags} --only=dependencies \${test_package} \\ - 2>&1 | tee log.install.${env_name}.${LOG_TIMESTAMP}.\${idx_padded}.\${test_package}-dependencies - spack install --verbose --no-cache --test=root \${test_package} 2>&1 | tee log.install.${env_name}.${LOG_TIMESTAMP}.\${idx_padded}.\${test_package} + 2>&1 | tee ${SPACK_STACK_DIR}/logs/log.install.${env_name}.${LOG_TIMESTAMP}.\${idx_padded}.\${test_package}-dependencies + spack install --verbose --no-cache --test=root \${test_package} 2>&1 | tee ${SPACK_STACK_DIR}/logs/log.install.${env_name}.${LOG_TIMESTAMP}.\${idx_padded}.\${test_package} set +o pipefail done # idx now equals the length of the array; install the rest idx_padded=\$(printf "%03d" "\$((idx+1))") set -o pipefail - spack install --verbose ${buildcache_install_flags} ${parallel_install_flags} 2>&1 | tee log.install.${env_name}.${LOG_TIMESTAMP}.\${idx_padded} + spack install --verbose ${buildcache_install_flags} ${parallel_install_flags} 2>&1 | tee ${SPACK_STACK_DIR}/logs/log.install.${env_name}.${LOG_TIMESTAMP}.\${idx_padded} set +o pipefail fi EOF @@ -890,8 +871,8 @@ EOF # In install mode, create environment modules if [[ "${update_build_cache}" == "false" ]]; then - spack module ${module_choice} refresh --yes --upstream-modules 2>&1 | tee log.modules.${env_name}.${LOG_TIMESTAMP} - spack stack setup-meta-modules 2>&1 | tee log.setup-meta-modules.${env_name}.${LOG_TIMESTAMP} + spack module ${module_choice} refresh --yes --upstream-modules 2>&1 | tee ${SPACK_STACK_DIR}/logs/log.modules.${env_name}.${LOG_TIMESTAMP} + spack stack setup-meta-modules 2>&1 | tee ${SPACK_STACK_DIR}/logs/log.setup-meta-modules.${env_name}.${LOG_TIMESTAMP} fi # When creating or updating buildcaches, fix permissions for mirrors. From 182d40735366a42ea414720571086d5912e06519 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 23 Apr 2026 07:08:08 -0400 Subject: [PATCH 34/39] Get latest repos/builtin submodule --- repos/builtin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repos/builtin b/repos/builtin index 89ba6af3d..0d9f81681 160000 --- a/repos/builtin +++ b/repos/builtin @@ -1 +1 @@ -Subproject commit 89ba6af3d6087a8d8edec4ef1ebe7c255641aafe +Subproject commit 0d9f81681b8f24835a415b4445567bcd4929462f From 56028e185e8fee623d165743377796331b35537f Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 28 Apr 2026 12:22:43 -0400 Subject: [PATCH 35/39] Move discover-gmao to tier2 --- configs/sites/{tier1 => tier2}/discover-gmao/config.yaml | 0 configs/sites/{tier1 => tier2}/discover-gmao/mirrors.yaml | 0 configs/sites/{tier1 => tier2}/discover-gmao/modules.yaml | 0 configs/sites/{tier1 => tier2}/discover-gmao/packages.yaml | 0 .../sites/{tier1 => tier2}/discover-gmao/packages_gcc-13.4.0.yaml | 0 .../{tier1 => tier2}/discover-gmao/packages_oneapi-2024.2.0.yaml | 0 .../{tier1 => tier2}/discover-gmao/packages_oneapi-2025.3.0.yaml | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename configs/sites/{tier1 => tier2}/discover-gmao/config.yaml (100%) rename configs/sites/{tier1 => tier2}/discover-gmao/mirrors.yaml (100%) rename configs/sites/{tier1 => tier2}/discover-gmao/modules.yaml (100%) rename configs/sites/{tier1 => tier2}/discover-gmao/packages.yaml (100%) rename configs/sites/{tier1 => tier2}/discover-gmao/packages_gcc-13.4.0.yaml (100%) rename configs/sites/{tier1 => tier2}/discover-gmao/packages_oneapi-2024.2.0.yaml (100%) rename configs/sites/{tier1 => tier2}/discover-gmao/packages_oneapi-2025.3.0.yaml (100%) diff --git a/configs/sites/tier1/discover-gmao/config.yaml b/configs/sites/tier2/discover-gmao/config.yaml similarity index 100% rename from configs/sites/tier1/discover-gmao/config.yaml rename to configs/sites/tier2/discover-gmao/config.yaml diff --git a/configs/sites/tier1/discover-gmao/mirrors.yaml b/configs/sites/tier2/discover-gmao/mirrors.yaml similarity index 100% rename from configs/sites/tier1/discover-gmao/mirrors.yaml rename to configs/sites/tier2/discover-gmao/mirrors.yaml diff --git a/configs/sites/tier1/discover-gmao/modules.yaml b/configs/sites/tier2/discover-gmao/modules.yaml similarity index 100% rename from configs/sites/tier1/discover-gmao/modules.yaml rename to configs/sites/tier2/discover-gmao/modules.yaml diff --git a/configs/sites/tier1/discover-gmao/packages.yaml b/configs/sites/tier2/discover-gmao/packages.yaml similarity index 100% rename from configs/sites/tier1/discover-gmao/packages.yaml rename to configs/sites/tier2/discover-gmao/packages.yaml diff --git a/configs/sites/tier1/discover-gmao/packages_gcc-13.4.0.yaml b/configs/sites/tier2/discover-gmao/packages_gcc-13.4.0.yaml similarity index 100% rename from configs/sites/tier1/discover-gmao/packages_gcc-13.4.0.yaml rename to configs/sites/tier2/discover-gmao/packages_gcc-13.4.0.yaml diff --git a/configs/sites/tier1/discover-gmao/packages_oneapi-2024.2.0.yaml b/configs/sites/tier2/discover-gmao/packages_oneapi-2024.2.0.yaml similarity index 100% rename from configs/sites/tier1/discover-gmao/packages_oneapi-2024.2.0.yaml rename to configs/sites/tier2/discover-gmao/packages_oneapi-2024.2.0.yaml diff --git a/configs/sites/tier1/discover-gmao/packages_oneapi-2025.3.0.yaml b/configs/sites/tier2/discover-gmao/packages_oneapi-2025.3.0.yaml similarity index 100% rename from configs/sites/tier1/discover-gmao/packages_oneapi-2025.3.0.yaml rename to configs/sites/tier2/discover-gmao/packages_oneapi-2025.3.0.yaml From 08c3eb4baee84d39d0a6a5a49a5b13fa060d3e3d Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 28 Apr 2026 12:25:03 -0400 Subject: [PATCH 36/39] Get latest repos/builtin update --- repos/builtin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repos/builtin b/repos/builtin index 0d9f81681..e667ed19d 160000 --- a/repos/builtin +++ b/repos/builtin @@ -1 +1 @@ -Subproject commit 0d9f81681b8f24835a415b4445567bcd4929462f +Subproject commit e667ed19dfc05e5ba15c5e80f718993dc47d5abc From fff696617e645106142a70574439549877b73d34 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 28 Apr 2026 12:33:35 -0400 Subject: [PATCH 37/39] remove discover-gmao for now --- configs/sites/tier2/discover-gmao/config.yaml | 2 - .../sites/tier2/discover-gmao/mirrors.yaml | 18 --- .../sites/tier2/discover-gmao/modules.yaml | 4 - .../sites/tier2/discover-gmao/packages.yaml | 144 ------------------ .../discover-gmao/packages_gcc-13.4.0.yaml | 29 ---- .../packages_oneapi-2024.2.0.yaml | 57 ------- .../packages_oneapi-2025.3.0.yaml | 54 ------- 7 files changed, 308 deletions(-) delete mode 100644 configs/sites/tier2/discover-gmao/config.yaml delete mode 100644 configs/sites/tier2/discover-gmao/mirrors.yaml delete mode 100644 configs/sites/tier2/discover-gmao/modules.yaml delete mode 100644 configs/sites/tier2/discover-gmao/packages.yaml delete mode 100644 configs/sites/tier2/discover-gmao/packages_gcc-13.4.0.yaml delete mode 100644 configs/sites/tier2/discover-gmao/packages_oneapi-2024.2.0.yaml delete mode 100644 configs/sites/tier2/discover-gmao/packages_oneapi-2025.3.0.yaml diff --git a/configs/sites/tier2/discover-gmao/config.yaml b/configs/sites/tier2/discover-gmao/config.yaml deleted file mode 100644 index 7e559f33f..000000000 --- a/configs/sites/tier2/discover-gmao/config.yaml +++ /dev/null @@ -1,2 +0,0 @@ -config: - build_jobs: 6 diff --git a/configs/sites/tier2/discover-gmao/mirrors.yaml b/configs/sites/tier2/discover-gmao/mirrors.yaml deleted file mode 100644 index 596a615bf..000000000 --- a/configs/sites/tier2/discover-gmao/mirrors.yaml +++ /dev/null @@ -1,18 +0,0 @@ -mirrors: - local-source: - fetch: - url: file:///discover/swdev/jcsda/spack-stack/source-cache - access_pair: - - null - - null - access_token: null - profile: null - endpoint_url: null - push: - url: file:///discover/swdev/jcsda/spack-stack/source-cache - access_pair: - - null - - null - access_token: null - profile: null - endpoint_url: null diff --git a/configs/sites/tier2/discover-gmao/modules.yaml b/configs/sites/tier2/discover-gmao/modules.yaml deleted file mode 100644 index 4e9771f38..000000000 --- a/configs/sites/tier2/discover-gmao/modules.yaml +++ /dev/null @@ -1,4 +0,0 @@ -modules: - default: - enable:: - - lmod diff --git a/configs/sites/tier2/discover-gmao/packages.yaml b/configs/sites/tier2/discover-gmao/packages.yaml deleted file mode 100644 index 7363aa96d..000000000 --- a/configs/sites/tier2/discover-gmao/packages.yaml +++ /dev/null @@ -1,144 +0,0 @@ -packages: -### Modification of common packages - # Problems building shared hdf-eos2 with Intel, not needed - hdf-eos2: - variants: ~shared - met: - variants: +python +grib2 +graphics +lidar2nc +modis - zlib-api: - buildable: False -### All other external packages listed alphabetically - autoconf: - externals: - - spec: autoconf@2.69 - prefix: /usr - automake: - externals: - - spec: automake@1.15.1 - prefix: /usr - binutils: - externals: - - spec: binutils@2.41.0 - prefix: /usr - bison: - externals: - - spec: bison@3.0.4 - prefix: /usr - ccache: - externals: - - spec: ccache@3.4.2 - prefix: /usr - cmake: - externals: - - spec: cmake@3.28.2 - prefix: /usr/local/other/cmake/3.28.2 - coreutils: - externals: - - spec: coreutils@8.32 - prefix: /usr - curl: - externals: - - spec: curl@8.0.1+gssapi+ldap+nghttp2 - prefix: /usr - cvs: - externals: - - spec: cvs@1.12.13 - prefix: /usr - diffutils: - externals: - - spec: diffutils@3.6 - prefix: /usr - findutils: - externals: - - spec: findutils@4.8.0 - prefix: /usr - flex: - externals: - - spec: flex@2.6.4+lex - prefix: /usr - gawk: - externals: - - spec: gawk@4.2.1 - prefix: /usr - gettext: - externals: - - spec: gettext@0.20.2 - prefix: /usr - git: - externals: - - spec: git@2.35.3+tcltk - prefix: /usr - - spec: git@2.42.0+tcltk - prefix: /usr/local/other/git/2.42.0/gcc-7.5.0 - modules: - - git/2.42.0 - # DH* - #- spec: git@2.42.0~tcltk - # prefix: /usr/local/other/git/2.42.0/gcc-7.5.0/libexec/git-core - # modules: - # - git/2.42.0 - git-lfs: - externals: - - spec: git-lfs@3.4.0 - prefix: /usr/local/other/git-lfs/3.4.0 - gmake: - externals: - - spec: gmake@4.2.1 - prefix: /usr - grep: - externals: - - spec: grep@3.1 - prefix: /usr - groff: - externals: - - spec: groff@1.22.4 - prefix: /usr - libtool: - externals: - - spec: libtool@2.4.6 - prefix: /usr - m4: - externals: - - spec: m4@1.4.18 - prefix: /usr - openssh: - externals: - - spec: openssh@8.4p1 - prefix: /usr - openssl: - externals: - - spec: openssl@1.1.1l - prefix: /usr - perl: - externals: - - spec: perl@5.26.1~cpanm+opcode+open+shared+threads - prefix: /usr - pkg-config: - externals: - - spec: pkg-config@0.29.2 - prefix: /usr - qt: - buildable: False - externals: - - spec: qt@5.15.10 - prefix: /usr/local/other/xpdf/4.04/Deps - sed: - externals: - - spec: sed@4.4 - prefix: /usr - subversion: - externals: - - spec: subversion@1.14.1 - prefix: /usr - swig: - externals: - - spec: swig@3.0.12 - prefix: /usr - tar: - externals: - - spec: tar@1.34 - prefix: /usr - texinfo: - externals: - - spec: texinfo@6.5 - prefix: /usr diff --git a/configs/sites/tier2/discover-gmao/packages_gcc-13.4.0.yaml b/configs/sites/tier2/discover-gmao/packages_gcc-13.4.0.yaml deleted file mode 100644 index 3e3c1c113..000000000 --- a/configs/sites/tier2/discover-gmao/packages_gcc-13.4.0.yaml +++ /dev/null @@ -1,29 +0,0 @@ -packages: - all: - require: - - any_of: ['%gcc@=13.4.0'] - when: '%gcc' - mpi: - buildable: false - require: - - "openmpi@4.1.6" - gcc: - buildable: false - externals: - - spec: gcc@13.4.0 languages:='c,c++,fortran' - prefix: /discover/swdev/gmao_SIteam/other/SLES15.4/GCC/13.4.0 - modules: - - comp/gcc/13.4.0 - extra_attributes: - compilers: - c: /discover/swdev/gmao_SIteam/other/SLES15.4/GCC/13.4.0/bin/gcc - cxx: /discover/swdev/gmao_SIteam/other/SLES15.4/GCC/13.4.0/bin/g++ - fortran: /discover/swdev/gmao_SIteam/other/SLES15.4/GCC/13.4.0/bin/gfortran - openmpi: - buildable: false - externals: - - spec: openmpi@4.1.6 ~cuda~cxx~cxx_exceptions~java~memchecker+pmi~static~wrapper-rpath - fabrics=ucx schedulers=slurm - prefix: /discover/swdev/gmao_SIteam/MPI/openmpi/4.1.6-SLES15/gcc-13.4.0 - modules: - - mpi/openmpi/4.1.6/gcc-13.4.0 diff --git a/configs/sites/tier2/discover-gmao/packages_oneapi-2024.2.0.yaml b/configs/sites/tier2/discover-gmao/packages_oneapi-2024.2.0.yaml deleted file mode 100644 index 637a42388..000000000 --- a/configs/sites/tier2/discover-gmao/packages_oneapi-2024.2.0.yaml +++ /dev/null @@ -1,57 +0,0 @@ -packages: - all: - require: - - any_of: ['%intel-oneapi-compilers@=2024.2.0'] - when: '%intel-oneapi-compilers' - - any_of: ['%gcc@=12.3.0'] - when: '%gcc' - mpi: - buildable: false - require: - - "intel-oneapi-mpi@2021.13" - intel-oneapi-compilers: - buildable: false - externals: - - spec: intel-oneapi-compilers@2024.2.0 - prefix: /usr/local/intel/oneapi/2024 - modules: - - comp/intel/2024.2.0 - extra_attributes: - compilers: - c: /usr/local/intel/oneapi/2024/compiler/2024.2/bin/icx - cxx: /usr/local/intel/oneapi/2024/compiler/2024.2/bin/icpx - fortran: /usr/local/intel/oneapi/2024/compiler/2024.2/bin/ifort - environment: - set: - # Force ifort not ifx - INTEL_COMPILER_TYPE: 'RECOMMENDED' - prepend_path: - PATH: /usr/local/other/gcc/12.3.0/bin - CPATH: /usr/local/other/gcc/12.3.0/include - LD_LIBRARY_PATH: '/usr/local/intel/oneapi/2024/compiler/2024.2/lib/:/usr/local/other/gcc/12.3.0/lib64' - extra_rpaths: - - /usr/local/other/gcc/12.3.0/lib64 - - /usr/local/other/gcc/12.3.0/lib - gcc: - buildable: false - externals: - - spec: gcc@12.3.0 languages:='c,c++' - prefix: /usr/local/other/gcc/12.3.0 - modules: - - comp/gcc/12.3.0 - extra_attributes: - compilers: - c: /usr/local/other/gcc/12.3.0/bin/gcc - cxx: /usr/local/other/gcc/12.3.0/bin/g++ - fortran: /usr/local/other/gcc/12.3.0/bin/gfortran - intel-oneapi-mpi: - externals: - - spec: intel-oneapi-mpi@2021.13 - prefix: /usr/local/intel/oneapi/2024 - modules: - - mpi/impi/2021.13 - intel-oneapi-mkl: - buildable: false - externals: - - spec: intel-oneapi-mkl@2024.2.0 - prefix: /usr/local/intel/oneapi/2024 diff --git a/configs/sites/tier2/discover-gmao/packages_oneapi-2025.3.0.yaml b/configs/sites/tier2/discover-gmao/packages_oneapi-2025.3.0.yaml deleted file mode 100644 index e8ec1d441..000000000 --- a/configs/sites/tier2/discover-gmao/packages_oneapi-2025.3.0.yaml +++ /dev/null @@ -1,54 +0,0 @@ -packages: - all: - require: - - any_of: ['%intel-oneapi-compilers@=2025.3.0'] - when: '%intel-oneapi-compilers' - - any_of: ['%gcc@=12.3.0'] - when: '%gcc' - mpi: - buildable: false - require: - - "intel-oneapi-mpi@2021.17" - intel-oneapi-compilers: - buildable: false - externals: - - spec: intel-oneapi-compilers@2025.3.0 - prefix: /usr/local/intel/oneapi/2025 - modules: - - comp/intel/2025.3.0 - extra_attributes: - compilers: - c: /usr/local/intel/oneapi/2025/compiler/2025.3/bin/icx - cxx: //usr/local/intel/oneapi/2025/compiler/2025.3/bin/icpx - fortran: /usr/local/intel/oneapi/2025/compiler/2025.3/bin/ifx - environment: - prepend_path: - PATH: /usr/local/other/gcc/12.3.0/bin - CPATH: /usr/local/other/gcc/12.3.0/include - LD_LIBRARY_PATH: '/usr/local/intel/oneapi/2025/compiler/2025.3/lib/:/usr/local/other/gcc/12.3.0/lib64' - extra_rpaths: - - /usr/local/other/gcc/12.3.0/lib64 - - /usr/local/other/gcc/12.3.0/lib - gcc: - buildable: false - externals: - - spec: gcc@12.3.0 languages:='c,c++' - prefix: /usr/local/other/gcc/12.3.0 - modules: - - comp/gcc/12.3.0 - extra_attributes: - compilers: - c: /usr/local/other/gcc/12.3.0/bin/gcc - cxx: /usr/local/other/gcc/12.3.0/bin/g++ - fortran: /usr/local/other/gcc/12.3.0/bin/gfortran - intel-oneapi-mpi: - externals: - - spec: intel-oneapi-mpi@2021.17 - prefix: /usr/local/intel/oneapi/2025 - modules: - - mpi/impi/2021.17 - intel-oneapi-mkl: - buildable: false - externals: - - spec: intel-oneapi-mkl@2025.3.0 - prefix: /usr/local/intel/oneapi/2025 From 32c519a4322916e2c756af9ea7f63b53fba2e7fd Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Wed, 29 Apr 2026 07:13:16 -0400 Subject: [PATCH 38/39] Move to ESMF 9.0.0b11 --- configs/templates/geos-dev-nag/spack.yaml | 4 ++-- configs/templates/geos-dev/spack.yaml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/configs/templates/geos-dev-nag/spack.yaml b/configs/templates/geos-dev-nag/spack.yaml index 7ea090580..a61c1007d 100644 --- a/configs/templates/geos-dev-nag/spack.yaml +++ b/configs/templates/geos-dev-nag/spack.yaml @@ -12,8 +12,8 @@ spack: # On some platforms (like macOS with gcc-15/gfortranclang), ESMF requires # +debug to build successfully, which is enforced via the site's packages.yaml. # Explicitly requesting ~debug here will cause a concretization conflict on those platforms. - - geos-gcm-env ^esmf@=9.0.0b10 - - geos-gcm-env +debug ^esmf@=9.0.0b10 + - geos-gcm-env ^esmf@=9.0.0b11 + - geos-gcm-env +debug ^esmf@=9.0.0b11 packages: diff --git a/configs/templates/geos-dev/spack.yaml b/configs/templates/geos-dev/spack.yaml index 461d55a6e..0e317ec2f 100644 --- a/configs/templates/geos-dev/spack.yaml +++ b/configs/templates/geos-dev/spack.yaml @@ -9,11 +9,11 @@ spack: specs: # NOTE: Do not explicitly add ~debug to the first geos-gcm-env spec below. - # On some platforms (like macOS with gcc-15/gfortranclang), ESMF requires + # On some platforms (like macOS with gcc-15/gfortranclang), ESMF requires # +debug to build successfully, which is enforced via the site's packages.yaml. # Explicitly requesting ~debug here will cause a concretization conflict on those platforms. - - geos-gcm-env ^esmf@=9.0.0b10 - - geos-gcm-env +debug ^esmf@=9.0.0b10 + - geos-gcm-env ^esmf@=9.0.0b11 + - geos-gcm-env +debug ^esmf@=9.0.0b11 # Various fms builds - fms@=2024.03 ~gfs_phys constants=GEOS From 92dac19c6c7d8f495e05d7b1006a2470834041f3 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Wed, 29 Apr 2026 08:57:15 -0400 Subject: [PATCH 39/39] Generalize clang version --- configs/sites/tier2/macos.gmao/README.md | 32 +++++++++++++------ .../packages_clang-22.1.3.yaml.template | 6 ++-- .../packages_gcc-15.2.0.yaml.template | 6 ++-- .../macos.gmao/packages_nag.yaml.template | 6 ++-- util/gmao/batch_install.sh | 12 ++++++- 5 files changed, 42 insertions(+), 20 deletions(-) diff --git a/configs/sites/tier2/macos.gmao/README.md b/configs/sites/tier2/macos.gmao/README.md index fb7c6feb3..be041f0fa 100644 --- a/configs/sites/tier2/macos.gmao/README.md +++ b/configs/sites/tier2/macos.gmao/README.md @@ -83,11 +83,11 @@ The `batch_install.sh` script automates the creation of environments (e.g., `gcc ./util/gmao/batch_install.sh -h ``` -### Compiler Selection and NAG Support +### Compiler Selection and Auto-Detection By default, `batch_install.sh` builds the `gcc@=15.2.0` stack. -If the NAG Fortran compiler (`nagfor`) is found in your `PATH`, the script will automatically detect its version and add it to the build queue (e.g., `nag@=7.2.7243`). +The script will automatically detect your currently active version of Apple Clang (e.g. `apple-clang@21.0.0`) and substitute it into the templates. If the NAG Fortran compiler (`nagfor`) is found in your `PATH`, the script will automatically detect its version as well and add it to the build queue (e.g., `nag@=7.2.7243`). If your NAG compiler is installed in a non-standard location and not in your `PATH`, you can explicitly provide its path using the `-N` flag: @@ -133,28 +133,36 @@ If you are just installing environments using already populated build caches (th ``` ### Generating `.yaml.generated` files -`batch_install.sh` uses `.yaml.template` files in the `macos.gmao` site directory to dynamically detect the path to your Brew installation and your NAG compiler, creating `.yaml.generated` files on the fly. -To prevent cluttering the site configuration directory, the script writes these generated files to the repository root, injects them directly into the target environment's `site/` directory, and then cleans up the temporary files from the root. +`batch_install.sh` uses `.yaml.template` files in the `macos.gmao` site directory to dynamically detect the path to your Brew installation, your active `apple-clang` version, and your NAG compiler, creating `.yaml.generated` files on the fly. +To prevent cluttering the site configuration directory, the script writes these generated files directly to `configs/sites/tier2/macos.gmao/`, injects them directly into the target environment's `site/` directory during creation, and then automatically cleans up the temporary files from the configurations directory. ### Loading the stack -Once the installation and module generation are complete, you can point your shell to the newly built modules. OpenMPI is built specifically with `~two_level_namespace` to support flat namespace linking required by GEOS, and `pflogger` and `esmf` variants are carefully managed to support building with both GCC and NAG. +Once the installation and module generation are complete, you can point your shell to the newly built modules. OpenMPI is built specifically with `~two_level_namespace` to support flat namespace linking required by GEOS. + +To ensure executables (like MAPL tests) running under macOS System Integrity Protection (SIP) can properly resolve runtime paths (RPATHs) when using compilers like NAG, the `macos.gmao` site-level `modules.yaml` configuration explicitly permits exporting `DYLD_LIBRARY_PATH` and `DYLD_FALLBACK_LIBRARY_PATH` variables into your environment when loading modules. + +Depending on which compiler you built, you will need to add the correct `install/modulefiles/Core` directory to your `module use` path. + +#### Loading the GCC Stack ```bash -module use -a /path/to/envs/ge-gcc-15.2.0/install/modulefiles/Core +module use -a /path/to/spack-stack/envs/ge-gcc-15.2.0-build/install/modulefiles/Core +module load stack-gcc stack-openmpi geos-gcm-env ``` -Then load the stack and your target environment (e.g., for GEOSgcm work): +#### Loading the NAG Stack ```bash -module load stack-gcc stack-openmpi geos-gcm-env +module use -a /path/to/spack-stack/envs/ge-nag-7.2.7243-build/install/modulefiles/Core +module load stack-nag stack-openmpi geos-gcm-env ``` --- ## Building the stack by hand -If you prefer to run the Spack commands manually instead of using `batch_install.sh`, you can still follow these steps. However, it's highly recommended to use `batch_install.sh` because it automatically handles dynamic template substitution (e.g. for Homebrew paths and NAG compiler versions) that you will otherwise need to do manually with `sed`. +If you prefer to run the Spack commands manually instead of using `batch_install.sh`, you can still follow these steps. However, it's highly recommended to use `batch_install.sh` because it automatically handles dynamic template substitution (e.g., for Homebrew paths, `apple-clang` versions, and NAG compiler versions) that you will otherwise need to do manually with `sed`. If you choose to do this manually, you must first run `sed` over the `*.yaml.template` files and create the `.yaml.generated` files. @@ -178,11 +186,15 @@ spack stack create env --name genag-nag-7.2.7243 --template geos-dev-nag --site ### Activate the Environment +Navigate to the environment directory you wish to work on. For example, if you built the GCC stack: + ```bash -cd envs/ge-gcc-15.2.0 +cd envs/ge-gcc-15.2.0-build spack env activate -p . ``` +> **Note:** If you are building or debugging a different compiler stack, be sure to `cd` into that specific environment directory instead (e.g., `envs/ge-nag-7.2.7243-build` or `envs/ge-clang-22.1.3-build`). + > **Important:** Run this in *every* terminal where you plan to run Spack commands for this environment. --- diff --git a/configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml.template b/configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml.template index cc785f3d8..49fa8d5ef 100644 --- a/configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml.template +++ b/configs/sites/tier2/macos.gmao/packages_clang-22.1.3.yaml.template @@ -1,15 +1,15 @@ packages: c: - require: [apple-clang@17.0.0] + require: [apple-clang@@APPLE_CLANG_VERSION@] cxx: - require: [apple-clang@17.0.0] + require: [apple-clang@@APPLE_CLANG_VERSION@] fortran: require: [llvm@21.1.3 ~clang +flang] mpi: require: [openmpi@=5.0.10] apple-clang: externals: - - spec: apple-clang@17.0.0 languages:='c,c++' + - spec: apple-clang@@APPLE_CLANG_VERSION@ languages:='c,c++' prefix: /usr extra_attributes: compilers: diff --git a/configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml.template b/configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml.template index 1336d1399..20c3ac212 100644 --- a/configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml.template +++ b/configs/sites/tier2/macos.gmao/packages_gcc-15.2.0.yaml.template @@ -1,15 +1,15 @@ packages: c: - require: [apple-clang@17.0.0] + require: [apple-clang@@APPLE_CLANG_VERSION@] cxx: - require: [apple-clang@17.0.0] + require: [apple-clang@@APPLE_CLANG_VERSION@] fortran: require: [gcc@15.2.0] mpi: require: [openmpi@=5.0.10] apple-clang: externals: - - spec: apple-clang@17.0.0 languages:='c,c++' + - spec: apple-clang@@APPLE_CLANG_VERSION@ languages:='c,c++' prefix: /usr extra_attributes: compilers: diff --git a/configs/sites/tier2/macos.gmao/packages_nag.yaml.template b/configs/sites/tier2/macos.gmao/packages_nag.yaml.template index 2ce08ae42..6a6a024af 100644 --- a/configs/sites/tier2/macos.gmao/packages_nag.yaml.template +++ b/configs/sites/tier2/macos.gmao/packages_nag.yaml.template @@ -1,15 +1,15 @@ packages: c: - require: [apple-clang@17.0.0] + require: [apple-clang@@APPLE_CLANG_VERSION@] cxx: - require: [apple-clang@17.0.0] + require: [apple-clang@@APPLE_CLANG_VERSION@] fortran: require: [nag@@NAG_VERSION@] mpi: require: [openmpi@=5.0.7] apple-clang: externals: - - spec: apple-clang@17.0.0 languages:='c,c++' + - spec: apple-clang@@APPLE_CLANG_VERSION@ languages:='c,c++' prefix: /usr extra_attributes: compilers: diff --git a/util/gmao/batch_install.sh b/util/gmao/batch_install.sh index 2037b1742..c00450964 100755 --- a/util/gmao/batch_install.sh +++ b/util/gmao/batch_install.sh @@ -224,6 +224,14 @@ case ${SPACK_STACK_BATCH_HOST} in SPACK_STACK_BATCH_COMPILERS+=("nag@=${MAC_GMAO_NAG_VERSION}") fi fi + + # Auto-detect Apple Clang version + if command -v clang &> /dev/null; then + export MAC_GMAO_APPLE_CLANG_VERSION=$(clang --version | grep "Apple clang version" | awk '{print $4}') + else + export MAC_GMAO_APPLE_CLANG_VERSION="21.0.0" + fi + SPACK_STACK_BATCH_TEMPLATES=("geos-dev" "geos-dev-nag") SPACK_STACK_MODULE_CHOICE="lmod" SPACK_STACK_BOOTSTRAP_MIRROR="${HOME}/spack-stack-mirrors/spack-bootstrap-mirror" @@ -655,6 +663,8 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do nag_version=${MAC_GMAO_NAG_VERSION} nag_path=${MAC_GMAO_NAG_PATH} nag_prefix=${MAC_GMAO_NAG_PREFIX} + + apple_clang_version=${MAC_GMAO_APPLE_CLANG_VERSION:-"21.0.0"} for template_file in "${macos_site_dir}"/*.yaml.template; do if [[ -f "${template_file}" ]]; then @@ -666,7 +676,7 @@ for compiler in "${SPACK_STACK_BATCH_COMPILERS[@]}"; do base_filename="packages_nag-${nag_version}.yaml" fi - sed_cmd="sed -e \"s#@HOME@#${HOME}#g\" -e \"s#@BREW_PREFIX@#${brew_prefix}#g\"" + sed_cmd="sed -e \"s#@HOME@#${HOME}#g\" -e \"s#@BREW_PREFIX@#${brew_prefix}#g\" -e \"s#@APPLE_CLANG_VERSION@#${apple_clang_version}#g\"" if [[ -n "${nag_version}" ]]; then sed_cmd="${sed_cmd} -e \"s#@NAG_VERSION@#${nag_version}#g\" -e \"s#@NAG_PREFIX@#${nag_prefix}#g\" -e \"s#@NAG_PATH@#${nag_path}#g\"" fi