Skip to content

Commit

Permalink
Merge pull request #2 from ACCESS-NRI/1-initial-spack-yaml
Browse files Browse the repository at this point in the history
Initial `spack.yaml`
  • Loading branch information
CodeGat authored Aug 16, 2024
2 parents 793811b + 4b39587 commit 4bd9362
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 105 deletions.
76 changes: 2 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,75 +1,3 @@
# model-deployment-template
# ACCESS-RAM3

A template repository for the deployment of `spack`-based models.

> [!NOTE]
> Feel free to replace this README with information on the model once the TODOs have been ticked off.
## Things TODO to get your model deployed

### Settings

#### Repository Settings

Branch protections should be set up on `main` and the special `backport/*.*` branches, which are used for backporting of fixes to major releases (the `YEAR.MONTH` portion of the `YEAR.MONTH.MINOR` version) of models.

#### Repository Secrets/Variables

There is only one variable in `vars` that needs to be set:

* `NAME`: which corresponds to the model name - which is usually the repository name.

#### Environment Secrets/Variables

GitHub Environments are sets of variables and secrets that are used specifically to deploy software, and hence have more security requirements for their use.

Currently, we have two Environments per deployment target - one for `Release` and one for `Prerelease`. Our current list of deployment targets and Environments can be found in this [deployment configuration file in `build-cd`](https://github.com/ACCESS-NRI/build-cd/blob/main/config/deployment-environment.json).

In order to deploy to a given deployment target:

* Environments with the name of the deployment target must be created _in this repository_ and have the associated secrets/variables set ([see below](#secrets))
* There must be a `Prerelease` Environment associated with the `Release` Environment. For example, if we are deploying to `SUPERCOMPUTER`, we require Environments with the names `SUPERCOMPUTER`, `SUPERCOMPUTER Prerelease`.

When setting the environment up, remember to require sign off by a member of ACCESS-NRI when deploying as a `Release`.

Regarding the secrets and variables that must be created:

##### Secrets

* `HOST`: The deployment location SSH Host
* `HOST_DATA`: The deployment location SSH Host for data transfer (may be the same as `HOST`)
* `SSH_KEY`: A SSH Key that allows access to the above `HOST`/`HOST_DATA`
* `USER`: A Username to login to the above `HOST`/`HOST_DATA`

##### Variables

* `DEPLOYMENT_TARGET`: Name of the deployment target for logging purposes
* `SPACK_LOCATION`: Path to the `spack` installation on the deployment target that will be used to install the model
* `SPACK_PACKAGES_LOCATION`: Path to the [ACCESS-NRI/spack-packages](https://github.com/ACCESS-NRI/spack-packages) repository on the deployment target that will be used to source package definitions
* `SPACK_CONFIG_LOCATION`: Path to the [ACCESS-NRI/spack-config](https://github.com/ACCESS-NRI/spack-config) repository on the deployment target that will be used to source default spack configuration
* `SPACK_RELEASE_LOCATION`: Path to a directory that will hold the created model package binaries
* `SPACK_YAML_LOCATION`: Path to a directory that will contain the `spack.yaml` from this repository during deployment
* (Optional) `SPACK_INSTALL_PARALLEL_JOBS`: Explicit number of parallel jobs for the installation of the given model. Must be either of the form `--jobs N` or unset (for the default `--jobs 16`).

### File Modifications

#### In `.github/workflows`

* Reminder that these workflows use `vars.NAME` (as well as inherit the above environment secrets) and hence these must be set.
* If the name of the root SBD for the model (in [`spack-packages`](https://github.com/ACCESS-NRI/spack-packages/tree/main/packages)) is different from the model name (for example, `ACCESS-ESM1.5`s root SBD is `access-esm1p5`), you must uncomment and set the `jobs.[pr-ci|pr-comment].with.root-sbd` line to the appropriate SBD name.

#### In `config/versions.json`

* `.spack` must be given a version. For example, it will clone the associated `releases/VERSION` branch of `ACCESS-NRI/spack` if you give it `VERSION`.
* `.spack-packages` should also have a CalVer-compliant tag as the version. See the [associated repo](https://github.com/ACCESS-NRI/spack-packages/tags) for a list of available tags.
* `.spack-config` should also have a CalVer-compliant tag as the version. See the [associated repo](https://github.com/ACCESS-NRI/spack-config/tags) for a list of available tags.

#### In `spack.yaml`

There are a few TODOs for the `spack.yaml`:

* `spack.specs`: Set the root SBD as the only element of `spack.specs`. This must also have an `@git.YEAR.MONTH.MINOR` version as it is the version of the entire deployment (and indeed will be a tag in this repository).
* `spack.packages.*`: In this section, you can specify the versions and variants of dependencies. Note that the first element of the `spack.packages.*.require` must be only a version. Variants and other configuration can be done on subsequent lines.
* `spack.packages.all`: Can set configuration for all packages. For example, the compiler used, or the target architecture.
* `spack.modules.default.tcl.include`: List of package names that will be explicitly included and available to `module load`.
* `spack.modules.default.tcl.projections`: For included modules, you must set the name of the module to be the same as the `spack.packages.*.require[0]` version, without the `@git.`.
The ACCESS Regional Nesting Suite repository.
6 changes: 3 additions & 3 deletions config/versions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://github.com/ACCESS-NRI/schema/blob/main/au.org.access-nri/model/deployment/config/versions/2-0-0.json",
"spack": "0.21",
"spack-packages": "SOME_SPECIFIC_TAG",
"spack-config": "SOME_SPECIFIC_TAG"
"spack": "0.22",
"spack-packages": "2024.08.09",
"spack-config": "2024.07.05"
}
74 changes: 46 additions & 28 deletions spack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,45 @@
# configuration settings.
spack:
specs:
# TODO: Replace the MODEL and VERSION.
# The root SBD for the model and overall version of the deployment:
# - [email protected]
- [email protected]
packages:
# TODO: Specify versions and variants of dependencies where required
# Specification of dependency versions and variants goes here.
# CI/CD requires that the first element of the require is only a version:
# openmpi:
# require:
# - '@4.0.2'
# Direct dependencies
um:
require:
- '@13.0'

# Indirect dependencies
eccodes:
require:
- '@2.34.0'

netcdf-c:
require:
- '@4.9.2'

netcdf-fortran:
require:
- '@4.5.2'

fcm:
require:
- '@2021.05.0'
# TODO: Generalize this Gadi-specific variant for spack.yaml
- 'site=nci-gadi'

gcom:
require:
- '@7.8'

openmpi:
require:
- '@4.1.5'

# Specifications that apply to all packages
all:
# TODO: Specify compiler/targets for all packages
# compiler: [[email protected].5.281]
# target: [x86_64]
require:
- '%[email protected].3.199'
- target=x86_64_v4
view: true
concretizer:
unify: true
Expand All @@ -33,10 +56,9 @@ spack:
tcl:
hash_length: 0
include:
# Explicitly, which packages are accessible as modules
# TODO: Add packages that will be included as modules
# - MODEL
hide_implicits: true
- access-ram3
- um
exclude_implicits: true
all:
autoload: direct
conflict:
Expand All @@ -45,16 +67,12 @@ spack:
set:
'SPACK_{name}_ROOT': '{prefix}'
projections:
# TODO: Add explicit projections for modules that will be found with `module load`.
# Naming scheme for the above included modules.
# These projection versions must be the same as the
# `spack.packages.*.require[0]` version but without the `@git.`.
# Ex. `require` version `@git.2024.04.21` -> projection `2024.04.21`.
all: '{name}/{version}'
# MODEL: '{name}/VERSION'
# config:
# overridden spack configurations, if needed
# mirrors:
# overridden spack package tarball directories, if needed
# repos:
# overridden repo sources, if needed
access-ram3: '{name}/2024.08.0'
um: '{name}/13.0'
config:
install_tree:
root: $spack/../restricted/ukmo/release
source_cache: $spack/../restricted/ukmo/source_cache
build_stage:
- $TMPDIR/restricted/spack-stage

0 comments on commit 4bd9362

Please sign in to comment.